RFR: 8342103: C2 compiler support for Float16 type and associated operations
Jatin Bhateja
jbhateja at openjdk.org
Tue Nov 19 19:57:09 UTC 2024
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/21490#issuecomment-2482867818)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 instructions generally operate over floating point registers, therefore compiler injectes 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
6. Auto-vectorization of newly supported scalar operations.
7. X86 and AARCH64 backend implementation for all supported intrinsics.
9. Functional and Performance validation tests.
**Missing Pieces:-**
**- AARCH64 Backend.**
Kindly review and share your feedback.
Best Regards,
Jatin
-------------
Commit messages:
- Code styling changes
- Review comments resoultion.
- Jcheck and build fixes
- New halffloat type 'TypeH' and associated changes
- Merge branch 'master' of http://github.com/openjdk/jdk into float16_support
- Jcheck cleanup
- Review comments and tests cleanup.
- Annotating Float16 as a ValueBased class
- Merge branch 'master' of http://github.com/openjdk/jdk into float16_support
- Merge branch 'master' of http://github.com/openjdk/jdk into float16_support
- ... and 6 more: https://git.openjdk.org/jdk/compare/2c509a15...132878ba
Changes: https://git.openjdk.org/jdk/pull/21490/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21490&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8342103
Stats: 3055 lines in 58 files changed: 2974 ins; 0 del; 81 mod
Patch: https://git.openjdk.org/jdk/pull/21490.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/21490/head:pull/21490
PR: https://git.openjdk.org/jdk/pull/21490
More information about the core-libs-dev
mailing list