-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8338023: Support two vector selectFrom API #20508
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
Changes from 1 commit
45bfe6c
82c0b0a
055fb22
e24632c
d7ad688
6cb1a46
408a869
8d71f17
d3ee310
1c00f41
7c80bfc
d72c82e
2953004
31a5864
42ca80c
7327736
130fa3e
6215ab9
1cca8e2
79ee29c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2100,7 +2100,9 @@ Node* SelectFromTwoVectorNode::Ideal(PhaseGVN* phase, bool can_reshape) { | |||||
| // (VectorRearrange SRC1, INDEX) | ||||||
| // (VectorRearrange SRC2, NORM_INDEX) | ||||||
| // MASK) | ||||||
| // | ||||||
| // This shall prevent an intrinsification failure and associated argument | ||||||
| // boxing penalties. | ||||||
|
|
||||||
| auto lane_count_type = [&]() { | ||||||
| switch(elem_bt) { | ||||||
| case T_BYTE: | ||||||
|
|
@@ -2177,6 +2179,10 @@ Node* VectorRearrangeNode::Ideal(PhaseGVN* phase, bool can_reshape) { | |||||
| default: return elem_bt; | ||||||
| } | ||||||
| }; | ||||||
| // Targets emulating unsupported permutation for certain vector types | ||||||
| // may need to message the indexes to match the users intent. | ||||||
|
||||||
| // may need to message the indexes to match the users intent. | |
| // may need to massage the indexes to match the users intent. |
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.
This optimization for now seems quite specific to your SelectFromTwoVectorNode::Ideal lowering code. Can this conversion not be done there already?
What is the semantics of VectorRearrangeNode? Should its shuffle vector always be bytes, and we now violated that "for a quick second"? Or is it going to be generally the idea to create all sorts of shuffle types and then fix that up? But then why do we need the vector_indexes_needs_massaging?
Can you help me understand the concept/strategy behind this?
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.
Ok, variable index permutation instruction on every target expects shape conformance b/w data vector and permute index vector. Rearrange expects indices to be passed through shuffle, idealization routines automatically injects a VectorLoadShuffle after loading indexes held in shuffle's backing storage i.e. a byte array.
In all the cases apart from byte vector permute , VectorLoadShuffle expands the index byte lanes to match the data vector lane. So we always end up emitting a lane expansion instruction before permute instruction (scenario 1). Apart from usual expansions VectorLoadShuffle may also do additional magic for some targets where it may need to prune / massage the index vector if target does not support destination vector type (scenario 2).
For our case, new selectFrom accepts the indices though vectors which save redundant expansions, but to leverage existing backend support for scenario 2 we do target specific pruning
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 quick comment about how the mask is computed could be nice.
MASK = INDEX < num_elemThere 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.
@jatin-bhateja very nice, thanks!