-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8342103: C2 compiler support for Float16 type and associated scalar operations #22754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Some FAQs on the newly added ideal type for half-float IR nodes:- Q. Why do we not use existing TypeInt::SHORT instead of creating a new TypeH type? Q. Problem with ConF? All Float16 IR nodes now carry newly defined Type::HALF_FLOAT type instead of Type::FLOAT, thus we no longer need special handling in auto-vectorizer to prune their container type to short. |
|
👋 Welcome back jbhateja! A progress list of the required criteria for merging this PR into |
|
/contributor add @PaulSandoz |
|
/contributor add @Bhavana-Kilambi |
|
@jatin-bhateja This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 218 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
@jatin-bhateja |
|
/contributor add @jddarcy |
|
/contributor add @rgiulietti |
|
@jatin-bhateja |
|
@jatin-bhateja |
|
@jatin-bhateja |
|
@jatin-bhateja The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
|
/label add hotspot-compiler-dev |
|
@jatin-bhateja |
Webrevs
|
eme64
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you quickly summarize what tests you have, and what they test?
| @IR(applyIfCPUFeatureOr = {"f16c", "true", "avx512vl", "true", "zvfh", "true"}, counts = {IRNode.VECTOR_CAST_HF2F, IRNode.VECTOR_SIZE_ANY, ">= 1", IRNode.VECTOR_CAST_F2HF, IRNode.VECTOR_SIZE_ANY, " >= 1"}) | ||
| @IR(applyIfCPUFeatureAnd = {"avx512_fp16", "false", "avx512vl", "true"}, | ||
| counts = {IRNode.VECTOR_CAST_HF2F, IRNode.VECTOR_SIZE_ANY, ">= 1", IRNode.VECTOR_CAST_F2HF, IRNode.VECTOR_SIZE_ANY, " >= 1"}) | ||
| @IR(applyIfCPUFeatureAnd = {"avx512_fp16", "false", "f16c", "true"}, | ||
| counts = {IRNode.VECTOR_CAST_HF2F, IRNode.VECTOR_SIZE_ANY, ">= 1", IRNode.VECTOR_CAST_F2HF, IRNode.VECTOR_SIZE_ANY, " >= 1"}) | ||
| @IR(applyIfCPUFeatureAnd = {"avx512_fp16", "false", "zvfh", "true"}, | ||
| counts = {IRNode.VECTOR_CAST_HF2F, IRNode.VECTOR_SIZE_ANY, ">= 1", IRNode.VECTOR_CAST_F2HF, IRNode.VECTOR_SIZE_ANY, " >= 1"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is having vector changes?
And this is pre-existing: but why are we using VECTOR_SIZE_ANY here? Can we not know the vector size? Maybe we can introduce a new tag max_float16 or max_hf. And do something like this:
IRNode.VECTOR_SIZE + "min(max_float, max_hf)", "> 0"
The downside with using ANY is that the exact size is not tested, and that might mean that the size is much smaller than ideal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @eme64 , Test modification looks ok to me, we intend to trigger these IR rules on non AVX512-FP16 targets.
On AVX512-FP16 target compiler will infer scalar float16 add operation which will not get auto-vectorized.
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. |
|
eme64
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops, I found a few more details. But the C++ VM changes look really good now.
The Java changes I leave to @PaulSandoz
Thanks @eme64, looking forward to your approval :-) |
eme64
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jatin-bhateja for all your patience, this really took a while 🙈
It looks good to me - again I'm only reviewing the C++ VM changes, so someone else has to review the Java changes.
src/java.base/share/classes/jdk/internal/vm/vector/Float16Math.java
Outdated
Show resolved
Hide resolved
|
Hi @PaulSandoz , Kindly let us know if this is good for integration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An impressive and substantial change. I focused on the Java code, there are some small tweaks, presented in comments, we can make to the intrinsics to improve the expression of code, and it has no impact on the intrinsic implementation.
src/java.base/share/classes/jdk/internal/vm/vector/Float16Math.java
Outdated
Show resolved
Hide resolved
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/jdk/internal/vm/vector/Float16Math.java
Outdated
Show resolved
Hide resolved
|
Hi @PaulSandoz , Your comments have been addressed. |
PaulSandoz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I merged this PR with master, successfully (at the time) with no conflicts, and ran it through tier 1 to 3 testing and there were no failures.
|
/integrate |
|
Going to push as commit 4b463ee.
Your commit was automatically rebased without conflicts. |
|
@jatin-bhateja Pushed as commit 4b463ee. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
|
Thanks @PaulSandoz , @eme64 and @sviswa7 for your valuable feedback. |
|
Is anyone else getting compile failures after this was integrated? This weirdly seems to only happen on Linux |
|
@TheShermanTanker I don't see any compile failures on Linux. Both the fastdebug and release build successfully. |
Hi @TheShermanTanker , Please file a separate JBS issue for the errors you are observing with non-standard build options. Best Regards, |
Hi All,
This patch adds C2 compiler support for various Float16 operations added by PR#22128
Following is the summary of changes included with this patch:-
Kindly review the patch and share your feedback.
Best Regards,
Jatin
Progress
Issue
Reviewers
Contributors
<[email protected]><[email protected]><[email protected]><[email protected]>Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22754/head:pull/22754$ git checkout pull/22754Update a local copy of the PR:
$ git checkout pull/22754$ git pull https://git.openjdk.org/jdk.git pull/22754/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22754View PR using the GUI difftool:
$ git pr show -t 22754Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22754.diff
Using Webrev
Link to Webrev Comment