[llvm] [AMDGPU] Include unused preload kernarg in KD total SGPR count (PR #104743)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 07:18:24 PDT 2024


================
@@ -900,6 +900,14 @@ void AMDGPUAsmPrinter::getSIProgramInfo(SIProgramInfo &ProgInfo,
 
     ProgInfo.NumVGPR = AMDGPUMCExpr::createTotalNumVGPR(
         ProgInfo.NumAccVGPR, ProgInfo.NumArchVGPR, Ctx);
+  } else if (isKernel(F.getCallingConv()) && MFI->getNumKernargPreloadedSGPRs()) {
+    // Consider cases where the total number of UserSGPRs with trailing
+    // allocated preload SGPRs, is greater than the number of explicitly
+    // referenced SGPRs.
+    const MCExpr *MaxUserSGPRs = MCBinaryExpr::createAdd(
+        CreateExpr(MFI->getNumUserSGPRs()), ExtraSGPRs, Ctx);
----------------
arsenm wrote:

I would expect this to be already added to MFI->getNumUserSGPRs. I.e. handle this during the calling convention lowering, not code emission 

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


More information about the llvm-commits mailing list