[llvm] [AMDGPU] Skip register uses in AMDGPUResourceUsageAnalysis (PR #133242)

Sebastian Neubauer via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 2 05:30:19 PDT 2025


================
@@ -990,7 +990,10 @@ void AMDGPUAsmPrinter::getSIProgramInfo(SIProgramInfo &ProgInfo,
   // dispatch registers are function args.
   unsigned WaveDispatchNumSGPR = 0, WaveDispatchNumVGPR = 0;
 
-  if (isShader(F.getCallingConv())) {
+  // Shaders that use the init.whole.wave intrinsic sometimes have VGPR
+  // arguments that are only added for the purpose of preserving their inactive
+  // lanes. Skip including them in the VGPR count.
+  if (isShader(F.getCallingConv()) && !MFI->hasInitWholeWave()) {
----------------
Flakebi wrote:

Why do we need to make this conditional on `hasInitWholeWave`?

I think ignoring implicit VGPRs should either apply to all shaders (i.e. hw entrypoints) and functions or – if it causes problems for shaders – apply to all (gpu-callable) functions, but not shaders/hw entrypoints.

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


More information about the llvm-commits mailing list