[vectorIntrinsics+fp16] RFR: 8277304: Java support for FP16 [v8]
Jatin Bhateja
jbhateja at openjdk.java.net
Wed Jun 15 15:00:31 UTC 2022
On Tue, 14 Jun 2022 16:54:39 GMT, Smita Kamath <svkamath at openjdk.org> wrote:
>> Initial FP16 vectorAPI Java support.
>
> Smita Kamath has updated the pull request incrementally with one additional commit since the last revision:
>
> Changed file mode of gen-src.sh
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Halffloat.java line 75:
> 73: float f = Float.intBitsToFloat(((val&0x8000)<<16) | (((val&0x7c00)+0x1C000)<<13) | ((val&0x03FF)<<13));
> 74: return f;
> 75: }
Please add a switch to handle special case values (NaN, Inf, -Inf), i.e. HF.NaN -> Float.NaN :
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Halffloat.java line 83:
> 81: */
> 82: public static boolean isFinite(float f) {
> 83: return Math.abs(f) <= Halffloat.MAX_VALUE;
We are comparing abs value with short. wont work well.
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Halffloat.java line 94:
> 92: if (!isFinite(f)) return Halffloat.POSITIVE_INFINITY;
> 93:
> 94: int val = Float.floatToIntBits(f);
Handling for NaN and NEG_INF missing.
-------------
PR: https://git.openjdk.org/panama-vector/pull/164
More information about the panama-dev
mailing list