[lworld+fp16] RFR: 8341414: Add support for FP16 conversion routines

Jatin Bhateja jbhateja at openjdk.org
Mon Oct 28 12:30:25 UTC 2024


On Wed, 23 Oct 2024 14:07:52 GMT, Bhavana Kilambi <bkilambi at openjdk.org> wrote:

> This patch adds intrinsic support for FP16 conversion routines to int/long/double and also the aarch64 backend support. This patch implements both scalar and vector versions for these conversions.
> 
> Performance numbers on aarch64 machine with SVE support :
> 
> 
> Benchmark                         (vectorDim)   Gain
> Float16OpsBenchmark.fp16ToDouble  1024          18.23
> Float16OpsBenchmark.fp16ToInt     1024          1.93
> Float16OpsBenchmark.fp16ToLong    1024          3.95
> 
> 
> The Gain column is the ratio between thrpt of this patch and the thrpt with the intrinsics disabled (which generates FP32 arithmetic).

src/java.base/share/classes/java/lang/Float16.java line 643:

> 641:     @IntrinsicCandidate
> 642:     public int intValue() {
> 643:         return (int)floatValue();

Should it be handled trough Idealization xform ?

ConvHF2F + ConvF2I => ConvHF2I

src/java.base/share/classes/java/lang/Float16.java line 653:

> 651:      */
> 652:     @Override
> 653:     @IntrinsicCandidate

Should this be handled trough Idealization xform ?

ConvHF2F + ConvF2L => ConvHF2L

src/java.base/share/classes/java/lang/Float16.java line 686:

> 684:     @IntrinsicCandidate
> 685:     public double doubleValue() {
> 686:         return (double)floatValue();

Should it be handled trough Idealization step ?

ConvHF2F + ConvF2D => ConvHF2D

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1283#discussion_r1818966378
PR Review Comment: https://git.openjdk.org/valhalla/pull/1283#discussion_r1818966022
PR Review Comment: https://git.openjdk.org/valhalla/pull/1283#discussion_r1818968514


More information about the valhalla-dev mailing list