[Mlir-commits] [mlir] [mlir][AMDGPU] Use LDS-only MMRA fences for lds_barrier (PR #157919)

Jakub Kuderski llvmlistbot at llvm.org
Fri Sep 12 07:17:38 PDT 2025


================
@@ -543,7 +543,15 @@ struct LDSBarrierOpLowering : public ConvertOpToLLVMPattern<LDSBarrierOp> {
 
     Attribute mmra =
         rewriter.getAttr<LLVM::MMRATagAttr>("amdgpu-synchronize-as", "local");
-    StringRef scope = "workgroup-one-as";
+    // Note: while there *is* a workgroup-one-as scope, this, when combined with
+    // the MMRA, will lead to the fence having no effect. This is because
+    // the codepaths for an atomic load or store will observe that a
+    // one-address-space atomic to LDS requires no synchronization because
+    // operations on LDS are totally ordered with respect to each other,
+    // and so will not emit the correct waitcnt operations that these fences
+    // are intended to produce. Therefore, we use a broader type of fence
+    // and rely on the MMRA to relax it to the semantics we want.
----------------
kuhar wrote:

Can you reflow this? In vscode, the command for this is called 'Rewrap Comment / Text'

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


More information about the Mlir-commits mailing list