[llvm] [AMDGPU] Remove the AnnotateKernelFeatures pass (PR #130198)

Jun Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 26 12:32:29 PDT 2025


================
@@ -629,12 +623,16 @@ GCNUserSGPRUsageInfo::GCNUserSGPRUsageInfo(const Function &F,
       DispatchID = true;
   }
 
-  // TODO: This could be refined a lot. The attribute is a poor way of
-  // detecting calls or stack objects that may require it before argument
-  // lowering.
+  const bool IsNoFlatScratchInitSet =
+      F.hasFnAttribute("amdgpu-no-flat-scratch-init");
+
   if (ST.hasFlatAddressSpace() && AMDGPU::isEntryFunctionCC(CC) &&
       (IsAmdHsaOrMesa || ST.enableFlatScratch()) &&
-      (HasCalls || HasStackObjects || ST.enableFlatScratch()) &&
+      // The line below: If enableFlatScratch() is true, whether
+      // no-flat-scratch-init is set is not important. If enableFlatScratch()
+      // is false, FlatScratchInit cannot be true for graphics CC.
+      (ST.enableFlatScratch() ||
----------------
jwanggit86 wrote:

> I mean inline in the expression (and swap the order, CC check first). Also "cannot be true", rephrase are something about the graphics shaders not having the input

What does "not having the input" mean?

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


More information about the llvm-commits mailing list