RFR: JDK-8318228: RISC-V: C2 ConvF2HF [v2]

Hamlin Li mli at openjdk.org
Mon Jan 22 10:49:40 UTC 2024


On Fri, 19 Jan 2024 21:30:30 GMT, Vladimir Kempik <vkempik at openjdk.org> wrote:

>> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   replace fclass with feq as performance optimization.
>
> src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp line 1863:
> 
>> 1861: 
>> 1862:   // check whether it's a NaN.
>> 1863:   fclass_s(t0, src);
> 
> As showed roundD intrinsic PR, ( https://github.com/openjdk/jdk/pull/16382/files#diff-7a5c3ed05b6f3f06ed1c59f5fc2a14ec566a6a5bd1d09606115767daa99115bdR4252 ) the feq_s(t0, src, src) + beqz(t0, label) seems to be a faster check for NaN, could you check the jmh numbers with feq_s ?

Thanks for the suggestion. Yes, it bring better performance.

After: 

Benchmark                                     (size)  Mode  Cnt     Score    Error  Units
Fp16ConversionBenchmark.floatToFloat16          2048  avgt    5  3753.179 ? 43.557  ns/op
Fp16ConversionBenchmark.floatToFloat16Memory    2048  avgt    5    19.772 ?  0.860  ns/op

Before:

Benchmark                                     (size)  Mode  Cnt     Score    Error  Units
Fp16ConversionBenchmark.floatToFloat16          2048  avgt    5  4099.820 ? 57.671  ns/op
Fp16ConversionBenchmark.floatToFloat16Memory    2048  avgt    5    20.181 ?  0.108  ns/op

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17450#discussion_r1461681485


More information about the hotspot-compiler-dev mailing list