On Thu, 9 Jul 2026 16:27:13 GMT, Jatin Bhateja <[email protected]> wrote:

>> Patch optimizes Float16 to integral conversion operations. Currently, its a 
>> two step process where by first a Float16 value is
>> converted to a single precision floating point value followed by a 
>> conversion to an integral value.
>> 
>> x86 targets supporting AVX512-FP16 feature (Intel Sapphire Rapids+ and 
>> upcoming AMD Zen6) provides direct instruction to convert a Float16 value to 
>> integral value.
>> 
>> Following are the performance numbers of micro benchmark included with the 
>> patch on Granite Rapids with and without auto-vectorization.
>> 
>> <img width="1125" height="636" alt="image" 
>> src="https://github.com/user-attachments/assets/ca6e6757-1579-475f-8307-9454c7c025c1";
>>  />
>> 
>> Kindly review and share your feedback.
>> 
>> Best Regards,
>> Jatin
>> 
>> ---------
>> - [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:
> 
>   Review comments resolution

Just a few drive-by nits. May review more next week.

test/hotspot/jtreg/compiler/vectorapi/TestFloat16ToIntegralConv.java line 40:

> 38:  * @requires vm.compiler2.enabled
> 39:  * @library /test/lib /
> 40:  * @run driver compiler.vectorapi.TestFloat16ToIntegralConv

Suggestion:

 * @run driver ${test.main.class}

Please always use this.

test/micro/org/openjdk/bench/jdk/incubator/vector/Float16ToIntegralConvBenchmark.java
 line 43:

> 41:     long [] lout;
> 42:     short [] sout;
> 43:     byte [] bout;

Suggestion:

    short[] fp16inp;
    int[] iout;
    long[] lout;
    short[] sout;
    byte[] bout;

Formatting nit.

test/micro/org/openjdk/bench/jdk/incubator/vector/Float16ToIntegralConvBenchmark.java
 line 53:

> 51:         bout = new byte[size];
> 52: 
> 53:         IntStream.range(0, size).forEach(i -> {fp16inp[i] = 
> Float.floatToFloat16((float)i);});

Suggestion:

        Arrays.setAll(fp16inp, i -> Float.floatToFloat16((float)i));

Would that not be a bit simpler?

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

Changes requested by epeter (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/30928#pullrequestreview-4672995199
PR Review Comment: https://git.openjdk.org/jdk/pull/30928#discussion_r3560255775
PR Review Comment: https://git.openjdk.org/jdk/pull/30928#discussion_r3560258363
PR Review Comment: https://git.openjdk.org/jdk/pull/30928#discussion_r3560271373

Reply via email to