[clang] [CIR][AMDGPU] Implement the clang::atomic statement attribute (PR #225364)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 22 07:09:03 PDT 2026


================
@@ -1461,13 +1493,37 @@ mlir::LogicalResult CIRToLLVMAtomicFetchOpLowering::matchAndRewrite(
   }
 
   mlir::LLVM::AtomicOrdering llvmOrder = getLLVMMemOrder(op.getMemOrder());
-  llvm::StringRef llvmSyncScope = getLLVMSyncScope(op.getSyncScope());
+  llvm::StringRef llvmSyncScope = getLLVMSyncScope(op.getSyncScope(), op);
   mlir::LLVM::AtomicBinOp llvmBinOp =
       getLLVMAtomicBinOp(op.getBinop(), isInt, isSignedInt);
   auto rmwVal = mlir::LLVM::AtomicRMWOp::create(
       rewriter, op.getLoc(), llvmBinOp, adaptor.getPtr(), adaptor.getVal(),
       llvmOrder, llvmSyncScope, /*alignment=*/0, op.getIsVolatile());
 
+  // CIRGen decides the metadata for a C++/HIP atomic from the atomic options
+  // in effect, so those markers are simply carried across.
+  for (llvm::StringRef marker :
+       {"cir.amdgpu_no_fine_grained_memory", "cir.amdgpu_no_remote_memory",
----------------
skc7 wrote:

CIRDialect.td already exposes sibling `getAMDGPU*AttrName()` accessors, could we add these attrs there and reference those everywhere?

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


More information about the cfe-commits mailing list