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 08:56:51 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Jatin Bhateja has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains six commits:
>> 
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8352635
>>  - Enabling some test points
>>  - Adding test points and some re-factoring
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into JDK-8352635
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8352635
>>  - 8352635: Improve inferencing of Float16 operations with constant inputs
>
> src/hotspot/share/opto/convertnode.cpp line 290:
> 
>> 288:       // If constant lie within Float16 value range, convert it to
>> 289:       // a half-float constant.
>> 290:       if (StubRoutines::hf2f(StubRoutines::f2hf(conF)) == conF) {
> 
> How does this behave with `NaN` values? Do you have a test for that below?

Extended coveage for NaNs, yes we have new test points for them.

> src/hotspot/share/opto/convertnode.cpp line 298:
> 
>> 296:         } else {
>> 297:           f16bOp = phase->transform(Float16NodeFactory::make(f32bOp->Opcode(), f32bOp->in(0), new_var_inp, new_con_inp));
>> 298:         }
> 
> Why is the order important here? A comment could help :)

Addressed.

> src/hotspot/share/opto/subnode.cpp line 566:
> 
>> 564:   // applicable to other floating point types.
>> 565:   // There are no known undefined, unspecified or implimentation specific
>> 566:   // behaviors w.r.t to floating point non-pointer subtraction.
> 
> That sounds like we are not quite sure "no known" ... problems. Could there be any, or are we sure there are none?

C++ follows IEEE 754 semantics for floating-point subtraction and there is no specified undefined behavior related to it in C++ standard.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24179#discussion_r2119357586
PR Review Comment: https://git.openjdk.org/jdk/pull/24179#discussion_r2119357694
PR Review Comment: https://git.openjdk.org/jdk/pull/24179#discussion_r2119358354


More information about the hotspot-compiler-dev mailing list