[llvm] [AMDGPU] Optimize block count calculations to the new ABI (PR #174112)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 1 00:32:36 PST 2026
================
@@ -322,6 +327,54 @@ static bool processUse(CallInst *CI, bool IsV5OrAbove) {
}
}
+ // Upgrade the old method of calculating the block size using the grid size.
+ // We pattern match any case where the implicit argument group size is the
+ // divisor to a dispatch packet grid size read of the same dimension.
+ if (IsV5OrAbove) {
+ for (int I = 0; I < 3; I++) {
+ Value *GroupSize = GroupSizes[I];
+ if (!GroupSize)
+ continue;
+
+ for (User *U : GroupSize->users()) {
+ Instruction *Inst = cast<Instruction>(U);
+ if (isa<ZExtInst>(Inst))
+ Inst = dyn_cast<Instruction>(*Inst->user_begin());
----------------
arsenm wrote:
Broken if there are no uses. Need a negative test with no use
https://github.com/llvm/llvm-project/pull/174112
More information about the llvm-commits
mailing list