RFR: 8342103: C2 compiler support for Float16 type and associated scalar operations [v5]
Emanuel Peter
epeter at openjdk.org
Tue Dec 17 17:01:40 UTC 2024
On Mon, 16 Dec 2024 14:19:49 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
>>> > Can you quickly summarize what tests you have, and what they test?
>>>
>>> Patch includes functional and performance tests, as per your suggestions IR framework-based tests now cover various special cases for constant folding transformation. Let me know if you see any gaps.
>>
>> I was hoping that you could make a list of all optimizations that are included here, and tell me where the tests are for it. That would significantly reduce the review time on my end. Otherwise I have to correlate everything myself, and that will take me hours.
>
>> > > Can you quickly summarize what tests you have, and what they test?
>> >
>> >
>> > Patch includes functional and performance tests, as per your suggestions IR framework-based tests now cover various special cases for constant folding transformation. Let me know if you see any gaps.
>>
>> I was hoping that you could make a list of all optimizations that are included here, and tell me where the tests are for it. That would significantly reduce the review time on my end. Otherwise I have to correlate everything myself, and that will take me hours.
>
>
> Validations details:-
>
> A) x86 backend changes
> - new assembler instruction
> - macro assembly routines.
> Test point:- test/jdk/jdk/incubator/vector/ScalarFloat16OperationsTest.java
> - This test is based on a testng framework and includes new DataProviders to generate test vectors.
> - Test vectors cover the entire float16 value range and also special floating point values (NaN, +Int, -Inf, 0.0 and -0.0)
> B) GVN transformations:-
> - Value Transforms
> Test point:- test test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java
> - Covers all the constant folding scenarios for add, sub, mul, div, sqrt, fma, min, and max operations addressed by this patch.
> - It also tests special case scenarios for each operation as specified by Java language specification.
> - identity Transforms
> Test point:- test test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java
> - Covers identity transformation for ReinterpretS2HFNode, DivHFNode
> - idealization Transforms
> Test points:- test/hotspot/jtreg/compiler/c2/irTests/MulHFNodeIdealizationTests.java
> :- test test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java
> - Contains test point for the following transform
> MulHF idealization i.e. MulHF * 2 => AddHF
> - Contains test point for the following transform
> DivHF SRC , PoT(constant) => MulHF SRC * reciprocal (constant)
> - Contains idealization test points for the following transform
> ConvF2HF(FP32BinOp(ConvHF2F(x), ConvHF2F(y))) =>
> ReinterpretHF2S(FP16BinOp(ReinterpretS2HF(x), ReinterpretS2HF(y)))
@jatin-bhateja thanks for all the updates and explanations.
I'm still missing some tests for rounding effects. It would be important to verify that the interpreter, constant folding, and backend instructions all lead to the same rounding for add/sub/div/mul/fma/... I propose that you pick random `short` values, reinterpet them as `Float16`, then do the calculation via interpreter, let it constant fold with C2, and put it in variables that cannot be constant folded, so that backend instructions are emitted for it.
Does that make sense?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22754#issuecomment-2549040374
More information about the hotspot-compiler-dev
mailing list