RFR: 8338021: Support new unsigned and saturating vector operators in VectorAPI [v23]

Jatin Bhateja jbhateja at openjdk.org
Thu Oct 10 16:27:25 UTC 2024


On Tue, 8 Oct 2024 19:25:24 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> Hi All,
>> 
>> As per the discussion on panama-dev mailing list[1], patch adds the support for following new vector operators.
>> 
>> 
>>      . SUADD   : Saturating unsigned addition.
>>      . SADD    : Saturating signed addition. 
>>      . SUSUB   : Saturating unsigned subtraction.
>>      . SSUB    : Saturating signed subtraction.
>>      . UMAX    : Unsigned max
>>      . UMIN    : Unsigned min.
>>      
>> 
>> New vector operators are applicable to only integral types since their values wraparound in over/underflowing scenarios after setting appropriate status flags. For floating point types, as per IEEE 754 specs there are multiple schemes to handler underflow, one of them is gradual underflow which transitions the value to subnormal range. Similarly, overflow implicitly saturates the floating-point value to an Infinite value.
>> 
>> As the name suggests, these are saturating operations, i.e. the result of the computation is strictly capped by lower and upper bounds of the result type and is not wrapped around in underflowing or overflowing scenarios.
>> 
>> Summary of changes:
>> - Java side implementation of new vector operators.
>> - Add new scalar saturating APIs for each of the above saturating vector operator in corresponding primitive box classes, fallback implementation of vector operators is based over it.
>> - C2 compiler IR and inline expander changes.
>> - Optimized x86 backend implementation for new vector operators and their predicated counterparts.
>> - Extends existing VectorAPI Jtreg test suite to cover new operations.
>> 
>> Kindly review and share your feedback.
>> 
>> Best Regards,
>> PS: Intrinsification and auto-vectorization of new core-lib API will be addressed separately in a follow-up patch.
>> 
>> [1] https://mail.openjdk.org/pipermail/panama-dev/2024-May/020408.html
>
> Jatin Bhateja has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 26 commits:
> 
>  - Merge branch 'JDK-8338201' of http://github.com/jatin-bhateja/jdk into JDK-8338201
>  - Update VectorMath.java
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8338201
>  - Typographical error fixups
>  - Doc fixups
>  - Typographic error
>  - Merge stashing and re-commit
>  - Tuning extra spaces.
>  - Tests for newly added VectorMath.* operations
>  - Test cleanups.
>  - ... and 16 more: https://git.openjdk.org/jdk/compare/7312eea3...ce76c3e5

Hi @vnkozlov , Can you kindly run this through your test infrastructure. We have two review approvals for Java and x86 backend code.

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

PR Comment: https://git.openjdk.org/jdk/pull/20507#issuecomment-2405554905


More information about the hotspot-compiler-dev mailing list