RFR: 8318227: RISC-V: C2 ConvHF2F

Quan Anh Mai qamai at openjdk.org
Fri Nov 24 10:35:07 UTC 2023


On Thu, 23 Nov 2023 17:13:47 GMT, Hamlin Li <mli at openjdk.org> wrote:

> Hi,
> Can you review the patch to add ConvHF2F intrinsic to JDK for riscv?
> Thanks!
> 
> (By latest kernel patch, `#define		RISCV_HWPROBE_EXT_ZFH		(1 << 27)`
> https://lore.kernel.org/lkml/20231114141256.126749-11-cleger@rivosinc.com/)
> 
> ## 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
> (i.e. enable the intrinsic)
> 
> Benchmark                                     (size)  Mode  Cnt      Score     Error  Units
> Fp16ConversionBenchmark.float16ToFloat          2048  avgt   10   4659.796 ?  13.262  ns/op
> Fp16ConversionBenchmark.float16ToFloatMemory    2048  avgt   10     22.957 ?   0.098  ns/op
> 
> 
> #### with UseZfh disabled
> (i.e. disable the intrinsic)
> 
> Benchmark                                     (size)  Mode  Cnt      Score    Error  Units
> Fp16ConversionBenchmark.float16ToFloat          2048  avgt   10  22930.591 ? 72.595  ns/op
> Fp16ConversionBenchmark.float16ToFloatMemory    2048  avgt   10     25.970 ?  0.063  ns/op

src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp line 1691:

> 1689:   fmv_h_x(dst, src);
> 1690:   fcvt_s_h(dst, dst);
> 1691:   j(done);

Since `Nan`s are exceptional inputs, it would be beneficial to move the handling below to an out-of-line stub.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16802#discussion_r1404198128


More information about the hotspot-dev mailing list