RFR: 8372978: [VectorAPI] Fix incorrect identity values in UMIN/UMAX reductions
Paul Sandoz
psandoz at openjdk.org
Tue Dec 9 17:49:48 UTC 2025
On Tue, 9 Dec 2025 08:30:01 GMT, Eric Fang <erfang at openjdk.org> wrote:
>> For masking we need to start with the identity or otherwise use the identify when no mask bits are set. It would be better to declare as constants and refer to them e.g., `UMAX_VALUE`, `UMIN_VALUE`. There are also other cases where we use identity values for reduction and they follow the same pattern of declaration and use.
>
> Okay, I understand, thank you for your insight! I'll wait for @PaulSandoz 's comment and see if we should add two **public** constants to this PR. Then I'll modify it accordingly.
I would prefer to declare identity constants, but **only** in tests [1] , such as `MUL_IDENTITY`, `UMAX_IDENTITY` etc, that we consistently refer to and then add basic tests to verify that identity with respect to the scalar operation. The identity values are also embedded in the JDK and HotSpot compiler and i want to ensure they are clearly compared against the expected identity when an all-false mask is used.
[1] later we could place these in some internal JDK class so we can use the same values in the JDK code, then adjust the tests to grant access to the internal JDK class to use those values. A more general place to surface up scalar identity values is in `VectorOperators` for the associative operators, something to consider later on perhaps, and that would require a CSR.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28692#discussion_r2603648258
More information about the core-libs-dev
mailing list