[llvm] [AMDGPU] Ignore inactive VGPRs in .vgpr_count (PR #144855)
Diana Picus via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 26 00:50:47 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) {
----------------
rovka 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?
> Although here I don't understand why you're going out of your way to exclude kernels. The same reasoning should apply when using preloaded arguments
Graphics and kernels handle hardware-initialized registers a bit differently. For graphics, we're putting them as arguments to the IR functions, and for compute we track them in `SIMachineFunctionInfo` instead. We do handle the preloaded arguments in the same place in AMDGPUAsmPrinter, just on the else branch of where this helper is used.
https://github.com/llvm/llvm-project/pull/144855
More information about the llvm-commits
mailing list