RFR: 8342103: C2 compiler support for Float16 type and associated scalar operations [v12]
Emanuel Peter
epeter at openjdk.org
Mon Jan 27 07:45:57 UTC 2025
On Fri, 24 Jan 2025 10:39:34 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
>> Hi All,
>>
>> This patch adds C2 compiler support for various Float16 operations added by [PR#22128](https://github.com/openjdk/jdk/pull/22128)
>>
>> Following is the summary of changes included with this patch:-
>>
>> 1. Detection of various Float16 operations through inline expansion or pattern folding idealizations.
>> 2. Float16 operations like add, sub, mul, div, max, and min are inferred through pattern folding idealization.
>> 3. Float16 SQRT and FMA operation are inferred through inline expansion and their corresponding entry points are defined in the newly added Float16Math class.
>> - These intrinsics receive unwrapped short arguments encoding IEEE 754 binary16 values.
>> 5. New specialized IR nodes for Float16 operations, associated idealizations, and constant folding routines.
>> 6. New Ideal type for constant and non-constant Float16 IR nodes. Please refer to [FAQs ](https://github.com/openjdk/jdk/pull/22754#issuecomment-2543982577)for more details.
>> 7. Since Float16 uses short as its storage type, hence raw FP16 values are always loaded into general purpose register, but FP16 ISA generally operates over floating point registers, thus the compiler injects reinterpretation IR before and after Float16 operation nodes to move short value to floating point register and vice versa.
>> 8. New idealization routines to optimize redundant reinterpretation chains. HF2S + S2HF = HF
>> 9. X86 backend implementation for all supported intrinsics.
>> 10. Functional and Performance validation tests.
>>
>> Kindly review the patch and share your feedback.
>>
>> Best Regards,
>> Jatin
>
> Jatin Bhateja has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 14 commits:
>
> - Rebasing to jdk mainline
> - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8342103
> - Refining IR match rule
> - Review suggestions incorporated.
> - Review comments resolutions
> - Updating copyright year of modified files.
> - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8342103
> - Review suggestions incorporated.
> - Review comments resolutions
> - Addressing review comments
> - ... and 4 more: https://git.openjdk.org/jdk/compare/4a375e5b...e0602c1d
test/micro/org/openjdk/bench/jdk/incubator/vector/Float16OperationsBenchmark.java line 2:
> 1: /*
> 2: * Copyright (c) 2025, Oracle and/or its affiliates. All rights vectorReserved.
Suggestion:
* Copyright (c) 2025, Oracle and/or its affiliates. All rights Reserved.
Looks like a "vector" snuck in there 😉
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22754#discussion_r1930090362
More information about the hotspot-compiler-dev
mailing list