-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8370666: VectorAPI: Add clear comments for vector mask 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
base: master
Are you sure you want to change the base?
Conversation
|
👋 Welcome back xgong! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
@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. |
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 :)
| // is set for the masked version. Meanwhile, there is an additional mask input for | ||
| // the masked nodes. | ||
| // | ||
| // For example, "AddVBNode" might have two versions: |
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.
Might?
| // For example, "AddVBNode" might have two versions: | |
| // For example: |
| // - Returns "TypeVectMask" for platforms that support the predicate feature and | ||
| // it is implemented properly in the backend, allowing the vector mask to be | ||
| // stored in a predicate/mask register. | ||
| // - Returns a normal vector type (i.e. TypeVectA ~ TypeVectZ) otherwise, where | ||
| // the vector mask is stored in a vector register. |
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.
The first case is PVectMask, and the second NVectMask, right?
| public: | ||
| VectorRearrangeNode(Node* vec1, Node* shuffle) | ||
| : VectorNode(vec1, shuffle, vec1->bottom_type()->is_vect()) { | ||
| // assert(mask->is_VectorMask(), "VectorBlendNode requires that third argument be a mask"); |
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 add a comment for Rearrange as well?
|
|
||
|
|
||
| // Select elements from two source vectors based on the wrapped indexes held in | ||
| // the first vector. |
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 improve the documentation a little? Also: "first vector" might be understood to refer to src1, but that's not the case, right?
You could base the description on selectFrom:
https://download.java.net/java/early_access/jdk26/docs/api/jdk.incubator.vector/jdk/incubator/vector/FloatVector.html#selectFrom(jdk.incubator.vector.Vector,jdk.incubator.vector.Vector)
| // The target may not directly support the rearrange operation for an element type. | ||
| // In those cases, we can transform the rearrange into a different element type. |
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 specify a bit more about the inputs and outputs, and what exactly the transformation does?
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.
Is this a memory instruction? Because it is called Load. If not: can we rename it?
| // 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.
| }; | ||
|
|
||
| //-------------------------- Vector mask broadcast ----------------------------------- | ||
| //-------------------------- Vector mask broadcast ------------------------------ |
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.
A nit that has been bothering me for a while:
I would just remove all the "title lines" with the ------.
They don't really add anything. And they are currently inconsistent in this file anyway.
Some are a more of a description like here. Some repeat the node name. And in some cases they are missing anyway.
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
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