RFR: 8341260: Add Float16 to jdk.incubator.vector

Joe Darcy darcy at openjdk.org
Sun Oct 20 18:59:36 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.

> Comparing with #21490 we can see that there are more than minimum number of intrinsics I recommended above, but (crucially) the intrinsics are decoupled from the box type, and refactored into `Float16Math.java`.
> 
> https://github.com/openjdk/jdk/pull/21490/files#diff-105a2bf4929174c594b5bcc54f749e93d9fca1b5371ca301fff02badd0e8da5a
> 
> For example, see the max intrinsics line 53. These intrinsics are better structured for the JIT, because there is no extraneous boxing to deal with. (Boxes involve null checks and heap allocation and other details which are just extra overhead.)
> 
> Apart from intrinsic classification, a simpler thing to do that may help the box methods to fold up correctly would be a `@ForceInline` annotation. But for the simple methods in this PR that is usually overkill.

I'm agnostic toward how the intrinsification of Float16 is implemented. I've removed the commented-out intrinsics annotations in a subsequent push. As noted, for review purposes I wanted to have a least one iteration of Float16 in the incubator that was as close as possible to the version of Float16 that has been in use in the lworld+fp16 branch.

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

PR Comment: https://git.openjdk.org/jdk/pull/21574#issuecomment-2425177653


More information about the core-libs-dev mailing list