[llvm] [AMDGPU] Fix hidden kernarg preload count inconsistency (PR #116759)

Austin Kerbow via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 11:59:05 PST 2024


================
@@ -143,17 +143,17 @@ class PreloadKernelArgInfo {
   // Returns the maximum number of user SGPRs that we have available to preload
   // arguments.
   void setInitialFreeUserSGPRsCount() {
-    const unsigned MaxUserSGPRs = ST.getMaxNumUserSGPRs();
     GCNUserSGPRUsageInfo UserSGPRInfo(F, ST);
-
-    NumFreeUserSGPRs = MaxUserSGPRs - UserSGPRInfo.getNumUsedUserSGPRs();
+    NumFreeUserSGPRs =
+        UserSGPRInfo.getNumFreeUserSGPRs() - 1 /* Synthetic SGPRs*/;
----------------
kerbowa wrote:

We call `LDSKernelId` a synthetic SGPR which is allocated after normal user SGPRs but before system SGPRs. I just realized this doesn't actually matter for kernels since it should never be used there.

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


More information about the llvm-commits mailing list