[GPU] Make GPUVectorAlloc allocate shared memory based on layout analysis#23631
Merged
Groverkss merged 2 commits intoiree-org:mainfrom Mar 4, 2026
Merged
Conversation
Groverkss
commented
Mar 3, 2026
compiler/src/iree/compiler/Codegen/Common/GPU/GPUVectorAlloc.cpp
Outdated
Show resolved
Hide resolved
krzysz00
approved these changes
Mar 3, 2026
Contributor
krzysz00
left a comment
There was a problem hiding this comment.
I've got some high-level questions, but don't see any problems here as it stands.
compiler/src/iree/compiler/Codegen/Common/GPU/GPUVectorAlloc.cpp
Outdated
Show resolved
Hide resolved
|
|
||
| // Synchronize after the write to shared memory before we read from it. | ||
| auto synced = | ||
| IREE::GPU::ValueBarrierOp::create(builder, op->getLoc(), *ret); |
Contributor
There was a problem hiding this comment.
@qedawkins Is this the sort of thing that would justify memory spaces on value barrier, or will that get handled by the tensor getting the workgroup address space during bufferization?
compiler/src/iree/compiler/Codegen/Common/GPU/GPUVectorAlloc.cpp
Outdated
Show resolved
Hide resolved
sommerlukas
approved these changes
Mar 3, 2026
Contributor
sommerlukas
left a comment
There was a problem hiding this comment.
LGTM, just minor stuff.
compiler/src/iree/compiler/Codegen/Common/GPU/GPUVectorAlloc.cpp
Outdated
Show resolved
Hide resolved
compiler/src/iree/compiler/Codegen/Common/GPU/GPUVectorAlloc.cpp
Outdated
Show resolved
Hide resolved
Groverkss
added a commit
that referenced
this pull request
Mar 4, 2026
After #23631 we will be using the analysis to determine conflicts, which allows us to undo a bunch of hacks we did earlier to not have conflicts between the chained mma in attention. This patch simply sets the intrinsic to be col major in KernelConfig and rest of the pipeline automatically picks up if there needs to be a intermediate conflict using shared memory or not.
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.
Before this patch, we were doing in hack in layout configuration where we checked if there would be a layout conflict and try to promote the operand for attention. This hack was fragile as well as doesn't really scale beyond simple stuff.
This patch runs vector layout analysis to check if there would be any conflicts and uses shared memory to allocate shared memory for them.
Also removes some dead code from the alloc pass.