RFR: 8350960: RISC-V: Add riscv backend for Float16 operations - vectorization

Fei Yang fyang at openjdk.org
Tue May 13 03:20:56 UTC 2025


On Mon, 12 May 2025 11:35:40 GMT, Hamlin Li <mli at openjdk.org> wrote:

> Hi,
> Can you help to review this patch?
> It's a follow-up of https://github.com/openjdk/jdk/commit/9a3f9997b68a1f64e53b9711b878fb073c3c9b90.
> Thanks!
> 
> ## Test
> 
> performance test running in progress ...

Two comments after a cursory look. Thanks.

src/hotspot/cpu/riscv/riscv_v.ad line 125:

> 123:         return UseZvfh;
> 124:       case Op_FmaVHF:
> 125:         return UseZvfh && UseFMA;

Maybe group with the existing two cases at L98 and L99 (Op_VectorCastHF2F / Op_VectorCastF2HF)?

src/hotspot/cpu/riscv/riscv_v.ad line 382:

> 380:   ins_encode %{
> 381:     assert(UseZvfh, "must");
> 382:     BasicType bt = Matcher::vector_element_basic_type(this);

Question: What is `bt` calculated here? Seems there isn't one for HF16 in `enum BasicType` definition in file src/hotspot/share/utilities/globalDefinitions.hpp. I only see `T_FLOAT` and `T_DOUBLE`, which I don't think is usable here as we need to set SEW=16 for this instruction.

src/hotspot/cpu/riscv/riscv_v.ad line 383:

> 381:     assert(UseZvfh, "must");
> 382:     BasicType bt = Matcher::vector_element_basic_type(this);
> 383:     __ vsetvli_helper(bt, Matcher::vector_length(this));

Question: What is `bt` calculated here? Seems there isn't one for HF16 in `enum BasicType` definition in file src/hotspot/share/utilities/globalDefinitions.hpp. I only see `T_FLOAT` and `T_DOUBLE`, which I don't think is usable here as we need to set SEW=16 for this instruction.

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

PR Review: https://git.openjdk.org/jdk/pull/25181#pullrequestreview-2835167722
PR Review Comment: https://git.openjdk.org/jdk/pull/25181#discussion_r2085849317
PR Review Comment: https://git.openjdk.org/jdk/pull/25181#discussion_r2085848619
PR Review Comment: https://git.openjdk.org/jdk/pull/25181#discussion_r2085848726


More information about the hotspot-compiler-dev mailing list