[lworld+fp16] RFR: 8341414: Add support for FP16 conversion routines [v2]
Bhavana Kilambi
bkilambi at openjdk.org
Fri Nov 8 10:26:36 UTC 2024
On Fri, 8 Nov 2024 07:54:47 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
> No, I am not suggesting to add <Primitive_Box_Type>.float16Value() API in existing primitive classes for time being, let Joe decide that. If you intrinsify leaf level wrapper routine, then we just need to plug that into Integer.float16Value(), we will lose this flexibility if we intrinsify Float16.valueOf(int).
Thanks for the explanation. So from what I understand - we currently have four valueOf() routines in Float16.java, float16 to int/long/float/double. The valueOf(long) calls valueOf(float) inside it which contains an intrinsified routine already so we have ConvL2F -> ConvF2HF being generated for that. I can add an Ideal optimization to generate ConvL2HF for this sequence.
For `valueOf(int)` which calls `valueOf(double)` -> I will add a new leaf routine something like `short d2hf(double d)` in Float16.java which I will intrinsify to generate ConvD2HF and this routine will be called in valueOf(int i) -
public static Float16 valueOf(int value) {
return Float16(d2hf((double) value);
}
This would probably generate a ConvI2D -> ConvD2HF which can be optimized to ConvI2HF. The same routine can be called in `Float16 valueOf(double value)` as well which should generate ConvD2HF. Is this ok?
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/1283#issuecomment-2464329525
More information about the valhalla-dev
mailing list