RFR: 8342103: C2 compiler support for Float16 type and associated scalar operations [v3]
Jatin Bhateja
jbhateja at openjdk.org
Tue Dec 17 08:03:07 UTC 2024
On Tue, 17 Dec 2024 00:14:39 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
>> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java line 1415:
>>
>>> 1413: // double; not necessary to widen to double before the
>>> 1414: // multiply.
>>> 1415: short fa = float16ToRawShortBits(a);
>>
>> The new implementations in fma and sqrt are comparatively long and obscure compared to the current versions. That might be the price of intrinsification, but it would be helpful to at least have a comment to the reader explaining why the more obvious code was not being used.
>
> @jatin-bhateja could we change the intrinsic to declare the three Float16 values as additional parameters which are only ever passed to the lambda? I believe when intrinsic we will just drop those extra parameters.
Our intent here is to explicitly unbox the float16 values in Java code to avoid complexifying unboxing by C2. In that case, the VM needs to be aware of the Float16 class and record its field offsets, as it did for the [VectorPayload class.](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/classfile/javaClasses.cpp#L5065)
I have re-structured the code to remove unnecessary obfuscation introduced as a side effect of intrinsification. Let me know if we need to refine it further.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22754#discussion_r1888053509
More information about the hotspot-compiler-dev
mailing list