RFR: 8346236: Auto vectorization support for various Float16 operations [v8]
Emanuel Peter
epeter at openjdk.org
Tue Jan 13 10:23:42 UTC 2026
On Tue, 13 Jan 2026 05:31:00 GMT, Galder Zamarreño <galder at openjdk.org> wrote:
>> To avoid dependency on an incubating module.
>
> I was trying to use this API today and I was wondering the exact same thing. I would have expected this to be `Generator<Float16> float16s()`. I can see @jatin-bhateja's point but this should have been noted in the code for future readers? Is this being tracked somewhere?
>
> Anyway, again for future readers, this is what I've done to actually get a `Float16[]`, to avoid the need to first generate a `short[]` and fill that before transforming it to to `Float16[]`:
>
>
> private static Float16[] input_47 = new Float16[10000];
> private static final Generator<Short> GEN_input_47 = Generators.G.float16s();
>
> static void fill_input_47(Float16[] a) {
> for (int i = 0; i < a.length; i++) {
> a[i] = Float16.shortBitsToFloat16(GEN_input_47.next());
> }
> }
>
> static {
> fill_input_47(input_47);
> }
@galderz No, it is not tracked. Feel free to file an RFE and add documentation.
One reason to use `short[]` is that it allows us to auto vectorize. A `Float[]` is an Object array and that would prevent vectorization.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22755#discussion_r2685757916
More information about the hotspot-compiler-dev
mailing list