RFR: 8352635: Improve inferencing of Float16 operations with constant inputs [v13]
Sandhya Viswanathan
sviswanathan at openjdk.org
Tue Jun 24 21:47:33 UTC 2025
On Thu, 19 Jun 2025 07:50:22 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
>> This is a follow-up PR#22755 to improve Float16 operations inferencing.
>>
>> The existing scheme to detect Float16 operations for some operations is based on pattern matching which expects to receive inputs through ConvHF2F IR, this patch extends matching to accept constant floating point inputs within the Float16 value range.
>>
>> Best Regards,
>> Jatin
>
> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
>
> Update src/hotspot/share/opto/subnode.cpp
>
> Co-authored-by: Emanuel Peter <emanuel.peter at oracle.com>
test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java line 81:
> 79: private static final float EXACT_FP16 = 2052.0f;
> 80: private static final float SNAN_FP16 = Float.intBitsToFloat(0x7F8000F0);
> 81: private static final float QNAN_FP16 = Float.intBitsToFloat(0x7FC00000);
A nitpick, the values assigned here are float SNaN and QNaN. The FP16 suffix could be removed.
test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java line 381:
> 379:
> 380: @Check(test="testSNaNFP16ConstantPatterns")
> 381: public void checkSNaNFP16ConstantPatterns(short actual) throws Exception {
Why throw exception here? This is short comparison in Verify.checkEQ. Also Java doesn't inherently throw exception for SNaN.
test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java line 649:
> 647: // FIXME : C2 compiler limitaition to identify sign of ZERO value.
> 648: // assertResult(divide(valueOf(2.0f), NEGATIVE_ZERO).floatValue(), Float.NEGATIVE_INFINITY, "testDivConstantFolding");
> 649: // assertResult(divide(valueOf(2.0f), POSITIVE_ZERO).floatValue(), Float.POSITIVE_INFINITY, "testDivConstantFolding");
Would be good to file a JBS for this compiler limitation.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24179#discussion_r2164970718
PR Review Comment: https://git.openjdk.org/jdk/pull/24179#discussion_r2164968367
PR Review Comment: https://git.openjdk.org/jdk/pull/24179#discussion_r2164961346
More information about the hotspot-compiler-dev
mailing list