RFR: 8330266: RISC-V: Restore frm to RoundingMode::rne after JNI [v2]
Vladimir Kempik
vkempik at openjdk.org
Tue Apr 16 10:51:59 UTC 2024
On Tue, 16 Apr 2024 10:12:36 GMT, Ludovic Henry <luhenry at openjdk.org> wrote:
>> @luhenry I've already saw a big criticism of that document. So it makes me take it with a grain of salt. It was written by a limited group of vendors ( not all of them participated) and basically shows u-arch peculiarities of limited hw group.
>>
>> I'm gonna check few version of this patch in jni_blank jmh microtest
>
> @VladimirKempik again, happy to get input from more people on that document! :)
Here are results from c910 ( licheePi4a). using:
a) jni_blank as is
b) modified jni_blank where native func() does this:
int x = 2;
asm
("csrw fcsr,%0\n\t"
:
: "r" (x)
);
branchful - exactly this PR
branchless - this PR without csrr&beq
results:
no fcsr change in native code
branchless
Benchmark Mode Cnt Score Error Units
CallOverheadConstant.jni_blank avgt 30 133.586 ? 1.431 ns/op
CallOverheadVirtual.jni_blank avgt 30 131.715 ? 0.570 ns/op
branchful
Benchmark Mode Cnt Score Error Units
CallOverheadConstant.jni_blank avgt 30 133.376 ? 1.491 ns/op
CallOverheadVirtual.jni_blank avgt 30 133.560 ? 1.782 ns/op
fcsr changed to rdn in native code
branchless
Benchmark Mode Cnt Score Error Units
CallOverheadConstant.jni_blank avgt 30 153.708 ? 1.191 ns/op
CallOverheadVirtual.jni_blank avgt 30 150.653 ? 1.617 ns/op
branchful
Benchmark Mode Cnt Score Error Units
CallOverheadConstant.jni_blank avgt 30 153.595 ? 0.759 ns/op
CallOverheadVirtual.jni_blank avgt 30 149.992 ? 1.605 ns/op
Basically there are not difference here ( thanks to BranchPredictor), so why would you make code more complex (and require additional registers) ?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18785#discussion_r1567141957
More information about the hotspot-dev
mailing list