[llvm] [AMDGPU][LDS] Fix dynamic LDS interaction with "amdgpu-no-lds-kernel-id" (PR #107092)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 3 22:23:01 PDT 2024


Juan Manuel Martinez =?utf-8?q?CaamaƱo?= <juamarti at amd.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/107092 at github.com>


================
@@ -1010,20 +1010,23 @@ class AMDGPULowerModuleLDS {
           M, TableLookupVariablesOrdered, OrderedKernels, KernelToReplacement);
       replaceUsesInInstructionsWithTableLookup(M, TableLookupVariablesOrdered,
                                                LookupTable);
-
-      // Strip amdgpu-no-lds-kernel-id from all functions reachable from the
-      // kernel. We may have inferred this wasn't used prior to the pass.
-      //
-      // TODO: We could filter out subgraphs that do not access LDS globals.
-      for (Function *F : KernelsThatAllocateTableLDS)
-        removeFnAttrFromReachable(CG, F, {"amdgpu-no-lds-kernel-id"});
     }
 
     DenseMap<Function *, GlobalVariable *> KernelToCreatedDynamicLDS =
         lowerDynamicLDSVariables(M, LDSUsesInfo,
                                  KernelsThatIndirectlyAllocateDynamicLDS,
                                  DynamicVariables, OrderedKernels);
 
+    // Strip amdgpu-no-lds-kernel-id from all functions reachable from the
+    // kernel. We may have inferred this wasn't used prior to the pass.
+    // TODO: We could filter out subgraphs that do not access LDS globals.
+    for (auto *KernelSet : {&KernelsThatIndirectlyAllocateDynamicLDS,
+                            &KernelsThatAllocateTableLDS})
+      for (Function *F : *KernelSet) {
+        removeFnAttrFromReachable(CG, F, {"amdgpu-no-lds-kernel-id"});
+        errs() << "bug code triggered!\n";
----------------
arsenm wrote:

Leftover debug printing 

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


More information about the llvm-commits mailing list