-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8370666: VectorAPI: Add clear comments for vector relative code in c2 #29130
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
|
👋 Welcome back xgong! A progress list of the required criteria for merging this PR into |
|
@XiaohongGong 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 103 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 |
|
@XiaohongGong The following label 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 list. If you would like to change these labels, use the /label pull request command. |
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.
Nice work, thanks for taking the time for this, much appreciated!
On the whole I'm super happy with this, but left a few extra comments :)
| // Convert a "BVectMask" into a platform-specific vector mask (either "NVectMask" | ||
| // or "PVectMask"). | ||
| class VectorLoadMaskNode : public VectorNode { |
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.
I'd love to rename this. Because it is (as you say in the comments) a conversion, and not a "load" (memory op).
What about VectorConvertBooleans2MaskNode.
And below, rename VectorStoreMaskNode to VectorConvertMask2BooleansNode.
You may have an even better idea.
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.
Yeah, I remember that @PaulSandoz gave a suggestion for the name before. I will take a consideration. Renaming of these two IRs is not an easy task that we need to go through all the code in mid-end, and backend of platforms that have supported Vector API. I'd like to leave it as a separate task with this PR. WDYT?
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 , do you have any insights on this? I’m wondering whether separating the renaming change into a different PR would be acceptable to you. Additionally, do you think it's better that we start a dedicated thread on the mailing list or github to discuss this further and gather more feedback from others?
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.
I'm fine with a separate RFE. Why not file an RFE, and then we can discuss on JIRA, and the PR that we will create from it? That will keep the conversation accessible to all and once the change is made people can find the conversation that led up to the change more easily :)
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.
Sounds good. I'v filed a JBS (https://bugs.openjdk.org/browse/JDK-8375509) to record and follow.
|
Hi @eme64 , I updated the vector nodes part with adding comments for more vector nodes. Would you mind taking another look? Thanks a lot! |
|
Thanks so much for your review @merykitty ! |
|
Hi @eme64 , regarding to the comments, could you please take another look and check whether it's clear enough? Thanks so much for any feedback. |
| // Load the IOTA constant vector containing sequential indices starting from 0 | ||
| // and incrementing by 1 up to "VLENGTH - 1". So far, the first input is an int | ||
| // constant 0. For example, a 128-bit vector with int (32-bit) elements produces | ||
| // a vector like "[0, 1, 2, 3]". |
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.
Are you saying that in1 has to be a constant with value zero? Actually, it seems the backend just ignores the input value... so why do we even have it?
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.
Yes, in1 is a constant with zero and it can be ignored in backend codegen. I'm unsure about the root cause why we still need it. It deserves an investigation. Maybe it's necessary for a floating node that has no control input for some phases? I'm not sure. When I tried to remove it , I met hotspot crashes when running jtreg tests:
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (jdk/src/hotspot/share/opto/node.hpp:418), pid=2345980, tid=2346012
# assert(i < _max) failed: oob: i=1, _max=1
The call stack is:
Stack: [0x0000e66182a7f000,0x0000e66182c7d000], sp=0x0000e66182c775d0, free space=2017k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x138a0ac] Node::in(unsigned int) const [clone .part.0]+0x2c (node.hpp:418)
V [libjvm.so+0x13a36b4] PhaseIdealLoop::get_early_ctrl(Node*)+0x400 (node.hpp:418)
V [libjvm.so+0x13a48e8] PhaseIdealLoop::build_loop_early(VectorSet&, Node_List&, Node_Stack&)+0x658 (loopnode.cpp:250)
V [libjvm.so+0x13b26e4] PhaseIdealLoop::build_and_optimize()+0x654 (loopnode.cpp:5134)
V [libjvm.so+0xa35ba0] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x360 (loopnode.hpp:1233)
jatin-bhateja
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 @XiaohongGong , looks good.
I have also created https://bugs.openjdk.org/browse/JDK-8375498 so that we enable dumping of VectorIR created though vector inline expanders similar to auto-vectorization.
|
Hi @eme64 , @jatin-bhateja , I'v updated a new commit to address the remaining comments. Could you please take another look? Thanks a lot! |
jatin-bhateja
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.
LGTM.
Best Regards,
Jatin
|
@XiaohongGong Thanks for putting the effort into better documentation, really much appreciated 😊 |
|
Thanks so much for your review @eme64 , @jatin-bhateja and @merykitty ! |
|
Going to push as commit 303de9a.
Your commit was automatically rebased without conflicts. |
|
@XiaohongGong Pushed as commit 303de9a. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The VectorMask implementation in Vector API involves complex interactions between types, nodes, and platform-specific
features, making the related code in HotSpot difficult to understand and review.
This patch adds comprehensive comments for vector mask related types, nodes, and methods in C2 to improve code clarity and
maintainability.
Note: This patch only adds comments; no functional changes are made.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/29130/head:pull/29130$ git checkout pull/29130Update a local copy of the PR:
$ git checkout pull/29130$ git pull https://git.openjdk.org/jdk.git pull/29130/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 29130View PR using the GUI difftool:
$ git pr show -t 29130Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/29130.diff
Using Webrev
Link to Webrev Comment