RFR: 8296515: RISC-V: Optimized MaxReductionV/MinReductionV/AddReductionV node implementation

Ludovic Henry luhenry at openjdk.org
Tue Nov 8 09:51:38 UTC 2022


On Tue, 8 Nov 2022 09:16:22 GMT, Gui Cao <gcao at openjdk.org> wrote:

> HI,
> 
> The MaxReductionV, MinReductionV, AddReductionV nodes currently implemented by riscv rvv can be implemented by calling shared functions, and the T_BYTE and T_SHORT types in the MaxReductionV and MinReductionV node implementations can also be implemented in the same way as the T_INT type.
> 
> Please take a look and have some reviews. Thanks a lot.
> 
> ## Testing:
> - hotspot and jdk tier1 on unmatched board without new failures
> - test/jdk/jdk/incubator/vector/* with fastdebug on qemu

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

> 819:   ins_encode %{
> 820:     BasicType bt = Matcher::vector_element_basic_type(this, $src2);
> 821:     __ reduce_operation($dst$$Register, as_VectorRegister($tmp$$reg),

Given the predicate `Matcher::vector_element_basic_type(n->in(2)) != T_LONG`, is there a risk it's going to match for types that don't fit the assert at https://github.com/openjdk/jdk/pull/11036/files#diff-35eb1d2f1e2f0514dd46bd7fbad49ff2c87703d5a3041a6433956df00a3fe6e6R1696 ?

It seems the same approach as `reduce_addI` should be taken with the following predicate:

  predicate(Matcher::vector_element_basic_type(n->in(2)) == T_BYTE || 
            Matcher::vector_element_basic_type(n->in(2)) == T_SHORT ||
            Matcher::vector_element_basic_type(n->in(2)) == T_INT);

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

> 853:   ins_encode %{
> 854:     BasicType bt = Matcher::vector_element_basic_type(this, $src2);
> 855:     __ rvv_reduce_integral($dst$$Register, as_VectorRegister($tmp$$reg),

Same as https://github.com/openjdk/jdk/pull/11036#discussion_r1016358443

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

> 887:   ins_encode %{
> 888:     BasicType bt = Matcher::vector_element_basic_type(this, $src2);
> 889:     __ rvv_reduce_integral($dst$$Register, as_VectorRegister($tmp$$reg),

Same as https://github.com/openjdk/jdk/pull/11036#discussion_r1016358443

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

PR: https://git.openjdk.org/jdk/pull/11036


More information about the hotspot-dev mailing list