RFR: 8355667: RISC-V: Add backend implementation for unsigned vector Min / Max operations [v2]

Hamlin Li mli at openjdk.org
Tue Apr 29 10:05:49 UTC 2025


On Mon, 28 Apr 2025 09:38:16 GMT, Fei Yang <fyang at openjdk.org> wrote:

>> Hi, please review this change.
>> https://bugs.openjdk.org/browse/JDK-8338021 proposed new vector operators including Unsigned Vector Min / Max.
>> This intrinsify Unsigned Vector Min / Max operations with RVV extension for RISC-V backend to improve performance.
>> This also enables some extra IR tests in file `test/hotspot/jtreg/compiler/vectorapi/VectorCommutativeOperSharingTest.java`.
>> 
>> Testing:
>> - [x] make test TEST="jdk_vector" (QEMU / fastdebug)
>> 
>> JMH tested on BPI-F3 SBC (256-bit VLEN) for reference:
>> Before:
>> 
>> ByteMaxVector.UMAX          1024  thrpt    5  58.657 ± 17.216  ops/ms
>> ByteMaxVector.UMAXMasked    1024  thrpt    5  45.581 ± 18.164  ops/ms
>> ByteMaxVector.UMIN          1024  thrpt    5  55.275 ± 15.863  ops/ms
>> ByteMaxVector.UMINMasked    1024  thrpt    5  44.651 ± 29.209  ops/ms
>> ShortMaxVector.UMAX          1024  thrpt    5  24.146 ± 7.570  ops/ms
>> ShortMaxVector.UMAXMasked    1024  thrpt    5  21.506 ± 0.430  ops/ms
>> ShortMaxVector.UMIN          1024  thrpt    5  24.261 ± 6.993  ops/ms
>> ShortMaxVector.UMINMasked    1024  thrpt    5  20.980 ± 1.622  ops/ms
>> IntMaxVector.UMAX          1024  thrpt    5  10.780 ± 0.812  ops/ms
>> IntMaxVector.UMAXMasked    1024  thrpt    5  10.609 ± 0.851  ops/ms
>> IntMaxVector.UMIN          1024  thrpt    5  10.845 ± 0.578  ops/ms
>> IntMaxVector.UMINMasked    1024  thrpt    5  10.705 ± 0.562  ops/ms
>> LongMaxVector.UMAX          1024  thrpt    5  5.445 ± 0.439  ops/ms
>> LongMaxVector.UMAXMasked    1024  thrpt    5  5.387 ± 0.285  ops/ms
>> LongMaxVector.UMIN          1024  thrpt    5  5.379 ± 0.407  ops/ms
>> LongMaxVector.UMINMasked    1024  thrpt    5  5.373 ± 0.236  ops/ms
>> 
>> 
>> After:
>> 
>> ByteMaxVector.UMAX          1024  thrpt    5  2552.161 ±  121.213  ops/ms
>> ByteMaxVector.UMAXMasked    1024  thrpt    5  2444.001 ±  105.139  ops/ms
>> ByteMaxVector.UMIN          1024  thrpt    5  2616.963 ±    3.065  ops/ms
>> ByteMaxVector.UMINMasked    1024  thrpt    5  2367.968 ± 1057.028  ops/ms
>> ShortMaxVector.UMAX          1024  thrpt    5  1363.676 ±   9.294  ops/ms
>> ShortMaxVector.UMAXMasked    1024  thrpt    5  1321.759 ± 121.471  ops/ms
>> ShortMaxVector.UMIN          1024  thrpt    5  1368.598 ±   5.251  ops/ms
>> ShortMaxVector.UMINMasked    1024  thrpt    5  1337.044 ±   1.434  ops/ms
>> IntMaxVector.UMAX          1024  thrpt    5  566.509 ±  0.658  ops/ms
>> IntMaxVector.UMAXMasked    1024  thrpt    5  559.456 ±  0.491  ops/ms
>> IntMaxVector.UMIN          1024  thrpt    5  569.238 ±  1.30...
>
> Fei Yang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
> 
>  - Merge remote-tracking branch 'upstream/master' into JDK-8355667
>  - 8355667: RISC-V: Add backend implementation for unsigned vector Min / Max operations

Looks good.
Just one minor question, should we add an assert like below for these instructs? Seems not, but I'm not quite sure.

assert(Matcher::vector_element_basic_type(n) != T_FLOAT &&
            Matcher::vector_element_basic_type(n) != T_DOUBLE);

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

Marked as reviewed by mli (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/24909#pullrequestreview-2802834980


More information about the hotspot-compiler-dev mailing list