Repository navigation
[LinalgExt] Add simple vectorization for map_scatter - #21090
Merged
Max191 merged 3 commits intoJun 23, 2025
Merged
Conversation
Max191
force-pushed
the
map-scatter-simple-vectorization
branch
from
June 16, 2025 15:54
ae583d0 to
7e69c57
Compare
Contributor
Author
|
Additional context for reviewers: #21116 has the remainder of the vector lowering for map_scatter. It is waiting on some upstream MLIR changes, so it is a draft for now. |
hanhanW
reviewed
Jun 18, 2025
|
|
||
| def VectorizeIREELinalgExtOpsPass : | ||
| InterfacePass<"iree-linalg-ext-vectorize-ops", "mlir::FunctionOpInterface"> { | ||
| let summary = "Decompose and lower linalg_ext ops into vector operations."; |
Contributor
There was a problem hiding this comment.
The pass does not decompose LinalgExt ops, right? Is it more like turning LinalgExt ops to have vector semantics?
Contributor
Author
There was a problem hiding this comment.
Yes, good catch, thanks!
Comment on lines
+27
to
+29
| if (isa<VectorType>(inputType)) { | ||
| return rewriter.notifyMatchFailure(mapScatterOp, | ||
| "map_scatter is already vectorized"); | ||
| } |
Contributor
There was a problem hiding this comment.
Maybe we want a isVectorized() method in MapScatter op?
Max191
force-pushed
the
map-scatter-simple-vectorization
branch
from
June 19, 2025 14:22
7e69c57 to
e7cb8a0
Compare
hanhanW
approved these changes
Jun 19, 2025
Signed-off-by: Max Dawkins <[email protected]>
Signed-off-by: Max Dawkins <[email protected]>
Signed-off-by: Max Dawkins <[email protected]>
Max191
force-pushed
the
map-scatter-simple-vectorization
branch
from
June 23, 2025 14:36
e7cb8a0 to
3c06001
Compare
AWoloszyn
pushed a commit
that referenced
this pull request
Dec 1, 2025
Allows vector types for the map_scatter input operand, and adds a trivial vectorization pass, which converts the input of map_scatter ops to vector operands with a vector.transfer_read. This vectorization lowering is not complete, because the map_scatter op in this form will not be able to lower into other operations. The final lowering will happen as a decomposition after the map_scatter op has been both vectorized and bufferized, and the map_scatter op will be decomposed into a vector.scatter op. The reason this decomposition will need to happen after bufferization, is that the vector.scatter op requires a memref base. The decomposition pattern of the vectorized map_scatter will come as a follow-up PR. Eventually, the vectorized map_scatter op could instead be decomposed into an `iree_vector_ext.transfer_scatter` op, but since the op does not exist yet, the current plan is to use `vector.scatter` first. --------- Signed-off-by: Max Dawkins <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows vector types for the map_scatter input operand, and adds a trivial vectorization pass, which converts the input of map_scatter ops to vector operands with a vector.transfer_read.
This vectorization lowering is not complete, because the map_scatter op in this form will not be able to lower into other operations. The final lowering will happen as a decomposition after the map_scatter op has been both vectorized and bufferized, and the map_scatter op will be decomposed into a vector.scatter op. The reason this decomposition will need to happen after bufferization, is that the vector.scatter op requires a memref base. The decomposition pattern of the vectorized map_scatter will come as a follow-up PR.
Eventually, the vectorized map_scatter op could instead be decomposed into an
iree_vector_ext.transfer_scatterop, but since the op does not exist yet, the current plan is to usevector.scatterfirst.