RFR: 8346236: Auto vectorization support for various Float16 operations [v8]

Galder Zamarreño galder at openjdk.org
Tue Jan 13 05:34:46 UTC 2026


On Fri, 28 Mar 2025 18:34:58 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> test/hotspot/jtreg/compiler/lib/generators/Generators.java line 375:
>> 
>>> 373:      * @return Random float16 generator.
>>> 374:      */
>>> 375:     public Generator<Short> float16s() {
>> 
>> Why do you not generate a `Float16` here? This here would probably conflict with a future `Short` generator which we might add in the future....
>
> 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);
  }

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22755#discussion_r2684887233


More information about the hotspot-compiler-dev mailing list