[llvm] [AMDGPU] Ignore inactive VGPRs in .vgpr_count (PR #144855)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 06:58:20 PDT 2025


================
@@ -991,7 +991,13 @@ void AMDGPUAsmPrinter::getSIProgramInfo(SIProgramInfo &ProgInfo,
   // dispatch registers are function args.
   unsigned WaveDispatchNumSGPR = 0, WaveDispatchNumVGPR = 0;
 
-  if (isShader(F.getCallingConv())) {
+  // Entry functions need to count input arguments even if they're not used
+  // (i.e. not reported by AMDGPUResourceUsageAnalysis). Other functions can
+  // skip including them. This is especially important for shaders that use the
+  // init.whole.wave intrinsic, since they sometimes have VGPR arguments that
+  // are only added for the purpose of preserving their inactive lanes and
+  // should not be included in the vgpr-count.
+  if (isShader(F.getCallingConv()) && isEntryFunctionCC(F.getCallingConv())) {
----------------
arsenm wrote:

Can you fuse these into one function, I don't want to have to do the intersection to figure out the list of CCs this applies to 

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


More information about the llvm-commits mailing list