On Mon, 25 May 2026 05:03:22 GMT, Jatin Bhateja <[email protected]> wrote:

>> Add a new  Float16lVector type and corresponding concrete vector classes, in 
>> addition to existing primitive vector types, maintaining operation parity 
>> with the FloatVector type.
>> - Add necessary inline expander support.
>>    - Enable intrinsification for a few vector operations, namely 
>> ADD/SUB/MUL/DIV/MAX/MIN/SQRT/FMA.
>> - Use existing Float16 vector IR and backend support.
>> - Extended the existing VectorAPI JTREG test suite for the newly added 
>> Float16Vector operations.
>>  
>> The idea here is to first be at par with Float16 auto-vectorization support 
>> before intrinsifying new operations (conversions, reduction, etc).
>> 
>> The following are the performance numbers for some of the selected 
>> Float16Vector benchmarking kernels compared to equivalent auto-vectorized 
>> Float16OperationsBenchmark kernels.
>> 
>> <img width="1344" height="532" alt="image" 
>> src="https://github.com/user-attachments/assets/c8157c3c-22b0-4bc1-9de9-7a68cadb7b2a";
>>  />
>> 
>> Initial RFP[1] was floated on the panama-dev mailing list.
>> 
>> Kindly review the draft PR and share your feedback.
>> 
>> Best Regards,
>> Jatin
>> 
>> [1] https://mail.openjdk.org/pipermail/panama-dev/2025-August/021100.html
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Jatin Bhateja has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Changes to accomodate CSR feedback

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16Vector.java 
line 825:

> 823:         switch (opc_) {
> 824:             case VECTOR_OP_NEG: return (v0, m) ->
> 825:                     v0.uOp(m, (i, a) -> (float) -a);

I think we need to use `Float16.negate` as per the comments in the 
implementation of that method:

    public static Float16 negate(Float16 f16) {
        // Negate sign bit only. Per IEEE 754-2019 section 5.5.1,
        // negate is a bit-level operation and not a logical
        // operation. Therefore, in this case do _not_ use the float
        // unary minus as an implementation as that is not guaranteed
        // to flip the sign bit of a NaN.
        return shortBitsToFloat16((short)(f16.value ^ SIGN_BIT_MASK));
    }


We would also need to update tests, specifically the `scalar_neg` method to 
call `Float16.negate`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28002#discussion_r3306921641

Reply via email to