[llvm] AMDGPU: Track AGPR pressure (PR #150288)

Christudasan Devadasan via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 18:19:56 PDT 2026


================
@@ -1497,6 +1494,22 @@ unsigned getMaxNumVGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU,
   return std::min(MaxNumVGPRs, AddressableNumVGPRs);
 }
 
+unsigned getMaxNumAGPRs(const MCSubtargetInfo *STI, unsigned int WavesPerEU) {
+  if (!STI->getFeatureBits().test(FeatureMAIInsts))
+    return 0;
+
+  assert(WavesPerEU != 0);
+
+  assert(!STI->getFeatureBits().test(FeatureDynamicVGPR));
+
+  unsigned MaxNumAGPRs =
+      alignTo(getTotalNumVGPRs(STI) / WavesPerEU, getVGPRAllocGranule(STI, 0));
+  unsigned AddressableNumAGPRs = getAddressableNumArchVGPRs(STI);
----------------
cdevadas wrote:

Do you mean to use `getAddressableNumAGPRs` here, the one you introduced in this patch?

https://github.com/llvm/llvm-project/pull/150288


More information about the llvm-commits mailing list