[llvm] [AMDGPU] Ignore inactive VGPRs in .vgpr_count (PR #144855)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 1 19:56:37 PDT 2025
================
@@ -1351,6 +1351,28 @@ constexpr bool isEntryFunctionCC(CallingConv::ID CC) {
}
}
+// Shaders that are 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.
+LLVM_READNONE
+constexpr bool shouldReportUnusedFuncArgs(CallingConv::ID CC) {
----------------
arsenm wrote:
> Can you suggest a better name? This is mostly just an implementation detail. Maybe it shouldn't be in `AMDGPUBaseInfo` in the first place. Should I just move it to `AMDGPUAsmPrinter`.cpp?
>
Just handle all entry points. I don't see any sensible reason why this would exclude compute entry points.
> Graphics and kernels handle hardware-initialized registers a bit differently. For graphics, we're putting them as arguments to the IR functions
I think you misunderstand. Compute know has a preloading kernel argument optimization, where the values appear in the IR kernel argument list exactly the same way as graphics. There is no fundamental difference here, it's programming the same registers even if that weren't the case.
https://github.com/llvm/llvm-project/pull/144855
More information about the llvm-commits
mailing list