RFR: 8341260: Add Float16 to jdk.incubator.vector
John R Rose
jrose at openjdk.org
Sat Oct 19 23:07:05 UTC 2024
On Thu, 17 Oct 2024 23:11:07 GMT, Joe Darcy <darcy at openjdk.org> wrote:
> Port of Float16 from java.lang in the lworld+fp16 branch to jdk.incubabor.vector.
Somebody might ask as a followup, "But what about calling sequences? Without intrinsics, how does the JIT know to store Float16 values in the correct type of argument register?" Presumably some platforms may wish to store arguments (and return values) in floating point registers, not in the integer registers used by a typical value class (such as Float16, containing a single `short` value).
That question might be motivated by the observation that, while FP16 stored in temps might well be stored in FPU registers, simply due to proximity to decode/encode intrinsics, changing the calling sequence requires that we give the Float16 class a little extra magic. (More detail: There are fundamentally 3 different places that FP16 values might need type-specific storage: IR temps, argument/return registers, and heap variables. The first can often be FPU regs. The last can be untyped memory words and a `short` is just fine. The middle are driven by the type of the value field, but can also take the field container Float16 into account.)
In any case, getting those details right does not require any `@IntrinsicCandidate` annotation, or any other source-level annotation. It just requires the VM to know about Float16 and treat it a little bit specially. Wholesale marking of methods is overkill.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21574#issuecomment-2424274895
More information about the core-libs-dev
mailing list