[lworld+fp16] RFR: 8329817: Augment prototype Float16 class [v12]

Bhavana Kilambi bkilambi at openjdk.org
Mon Jun 17 08:49:28 UTC 2024


On Fri, 14 Jun 2024 16:44:04 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/Float16.java line 736:
>> 
>>> 734:      */
>>> 735:     // @IntrinsicCandidate
>>> 736:     public static Float16 add(Float16 addend, Float16 augend) {
>> 
>> Hi, thanks for implementing these operations for Float16. May I ask why do we have both `Float16 sum()` and `Float16 add()`? Also, both seem to be marked as `@IntrinsicsCandidate`.
>
>> Hi, thanks for implementing these operations for Float16. May I ask why do we have both `Float16 sum()` and `Float16 add()`? Also, both seem to be marked as `@IntrinsicsCandidate`.
> 
> Hello @Bhavana-Kilambi ,
> The Float16 class already had a sum method before I started my work, so I left it in place. I assume "sum" was added in analogy to the the sum method added to Float and Double in the context of the stream work done in JDK 8.
> 
> For the purpose of including support for methods to perform the addition, subtraction, multiplication, and division operation, I think "add" is a better name than "sum".
> 
> I don't have any appreciable experience changing HotSpot, so I was going to leave that aspect of this work to others. The build fails if the `@IntrinsicCandidate` annotation is applied to methods without the possibility of a matching candidate in HotSpot. Therefore, I left a commented out form of the annotation on methods I assumed would be eligible for such support, but those were just my guesses and should be updated for what the actual intrinsic support could be.

Ok, got it. Thank you for the detailed response.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1117#discussion_r1642438023


More information about the valhalla-dev mailing list