RFR: 8352635: Improve inferencing of Float16 operations with constant inputs [v4]

Jatin Bhateja jbhateja at openjdk.org
Sun Jun 1 17:26:10 UTC 2025


On Wed, 28 May 2025 09:09:46 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java line 320:
>> 
>>> 318:          res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() / INEXACT_FP16);
>>> 319:          assertResult(Float.float16ToFloat(res), 32.125f, "testInexactFP16ConstantPatterns");
>>> 320:     }
>> 
>> Alignment is messed up by one space indentation.
>> 
>> Can you add a comment why we are expecting none of the `HF` ops here? 
>> Are we expecting any other ops, maybe `F` ops?
>> It could be good to check for that, so that we are sure that we get anything even close to our expectation.
>
> Same for the tests below :)

Fixed, IR checks and indentaitons.

>> test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java line 363:
>> 
>>> 361:          res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() / EXACT_FP16);
>>> 362:          assertResult(Float.float16ToFloat(res), 32.125f, "testExactFP16ConstantPatterns");
>>> 363:     }
>> 
>> Can we have a test that picks a random `FP16` value, and does result verification on it? Because currently, you are testing the new pattern only with a few example values.
>
> And: your pattern matching allows the constant to be lhs or rhs, so you should add corresponding tests.

Done.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24179#discussion_r2119358477
PR Review Comment: https://git.openjdk.org/jdk/pull/24179#discussion_r2119358543


More information about the hotspot-compiler-dev mailing list