RFR: JDK-8318228: RISC-V: C2 ConvF2HF

Vladimir Kempik vkempik at openjdk.org
Fri Jan 19 21:34:27 UTC 2024


On Tue, 16 Jan 2024 18:43:03 GMT, Hamlin Li <mli at openjdk.org> wrote:

> Hi,
> Can you review the patch to add ConvF2HF intrinsic to JDK for riscv?
> Thanks!
> 
> ## Test
> ### Functionality
> #### hotspot tests
> test/hotspot/jtreg/compiler/intrinsics/ 
> test/hotspot/jtreg/compiler/c2/irTests
> 
> #### jdk tests
> test/jdk/java/lang/Float/Binary16Conversion*.java
> 
> ### Performance
> tested on licheepi.
> 
> #### with UseZfh enabled
> 
> Benchmark                                     (size)  Mode  Cnt     Score   Error  Units
> Fp16ConversionBenchmark.floatToFloat16          2048  avgt    2  4170.549          ns/op
> Fp16ConversionBenchmark.floatToFloat16Memory    2048  avgt    2    21.492          ns/op
> 
> 
> #### with UseZfh disabled
> (i.e. disable the intrinsic)
> 
> Benchmark                                     (size)  Mode  Cnt      Score   Error  Units
> Fp16ConversionBenchmark.floatToFloat16          2048  avgt    2  25036.647          ns/op
> Fp16ConversionBenchmark.floatToFloat16Memory    2048  avgt    2     27.326          ns/op

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 ?

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

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


More information about the hotspot-compiler-dev mailing list