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

Jatin Bhateja jbhateja at openjdk.org
Wed Jun 4 12:40:02 UTC 2025


On Wed, 4 Jun 2025 05:57:53 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Extending tests and review resolutions
>
> test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java line 335:
> 
>> 333:         res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() - INEXACT_FP16);
>> 334:         res += Float.floatToFloat16(INEXACT_FP16 * POSITIVE_ZERO_VAR.floatValue());
>> 335:         res += Float.floatToFloat16(POSITIVE_ZERO_VAR.floatValue() / INEXACT_FP16);
> 
> Why is the mul case flipped here?

To check for constant on either side of an expression.

> test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java line 363:
> 
>> 361:     @Check(test="testSNaNFP16ConstantPatterns")
>> 362:     public void checkSNaNFP16ConstantPatterns(short actual) throws Exception {
>> 363:         TestFramework.deoptimize(TestFloat16ScalarOperations.class.getMethod("testSNaNFP16ConstantPatterns"));
> 
> Oh wow, I have never seen this pattern used. Cool idea! Do you know what impact this has on test runtime?

IIUC, since entier framework is based on whitebox APIs hence @Check annotated method is only invoked once after each @Test annotated method execution, I don't see much impact on test execution time here, we are just making sure that the expected value gets computed by the interpreter.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24179#discussion_r2126466180
PR Review Comment: https://git.openjdk.org/jdk/pull/24179#discussion_r2126466229


More information about the hotspot-compiler-dev mailing list