[llvm] [AMDGPU] Move SGPR Count Queries into TargetParser (PR #209848)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 15 13:53:39 PDT 2026


================
@@ -1257,33 +1257,20 @@ unsigned getWavesPerWorkGroup(const MCSubtargetInfo &STI,
 }
 
 unsigned getSGPRAllocGranule(const MCSubtargetInfo &STI) {
-  IsaVersion Version = getIsaVersion(STI.getCPU());
-  if (Version.Major >= 10)
-    return getAddressableNumSGPRs(STI);
-  if (Version.Major >= 8)
-    return 16;
-  return 8;
+  return AMDGPU::getSGPRAllocGranule(
+      AMDGPU::getSubArch(AMDGPU::parseArchAMDGCN(STI.getCPU())));
 }
 
 unsigned getSGPREncodingGranule(const MCSubtargetInfo &STI) { return 8; }
 
 unsigned getTotalNumSGPRs(const MCSubtargetInfo &STI) {
----------------
arsenm wrote:

Moving to TargetParser should obsolete the AMDGPUBaseInfo functions, not update them. That said, at this moment it's premature to solely have the SubArchType entry points. The migration is "complete" after #206482.

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


More information about the llvm-commits mailing list