Repository navigation
Conversation
Signed-off-by: Eric Feng <[email protected]>
Signed-off-by: Eric Feng <[email protected]>
Signed-off-by: Eric Feng <[email protected]>
kuhar
reviewed
Jul 25, 2025
| // also within hardware limitations. | ||
| const int64_t maxWorkgroupSize = 1024; | ||
| ArrayRef<int32_t> maxWgSizes = wgp.getMaxWorkgroupSizes(); | ||
| int64_t maxWorkgroupSize = *std::max_element(maxWgSizes.begin(), maxWgSizes.end()); |
Owner
There was a problem hiding this comment.
I think there's an llvm:: wrapper for this in STLExtras.h
Comment on lines
+878
to
+879
| IREE::GPU::TargetChipAttr chip = target.getChip(); | ||
| int numComputeUnits = chip ? chip.getWgpCount() : 256; |
Owner
There was a problem hiding this comment.
This should probably be a helper function that we put in some utils header
Comment on lines
+881
to
+883
| // If there is enough work to saturate all CUs * 2, use single subgroup per workgroup | ||
| if (parallelSize && *parallelSize > numComputeUnits * 2) | ||
| maxWorkgroupSize = target.getPreferredSubgroupSize(); |
Owner
There was a problem hiding this comment.
We may need an additional target device field for simds_per_cu
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.
Prioritize distributing to just a single subgroup along the reduction dimension when the problem size is large enough for us to saturate all CUs. Default to prior behavior when parallel dimensions are small (I use 2 * number of CUs here conservatively which aligned with Prashant's comment, but not sure if this is correct). This avoids needing to write/read to shared memory for a cross-group reduction. More details to come with examples and performance differences.
When only an architecture is specified and not a specific device, default to using the most conservative number of CUs within that generation.