[Mlir-commits] [mlir] [llvm][mlir] Atomic Control Options Support (PR #140932)

Tobias Gysi llvmlistbot at llvm.org
Wed May 21 12:03:56 PDT 2025


================
@@ -2179,6 +2185,19 @@ def LLVM_AtomicRMWOp : LLVM_MemAccessOpBase<"atomicrmw", [
         convertAtomicBinOpToLLVM($bin_op), $ptr, $val, llvm::MaybeAlign(),
         convertAtomicOrderingToLLVM($ordering));
     $res = inst;
+    auto &llvmContext = inst->getContext();
+    if($amdgpu_ignore_denormal_mode) {
+      llvm::MDNode *metadata = llvm::MDNode::get(llvmContext, std::nullopt);
+      inst->setMetadata((llvmContext).getMDKindID("amdgpu.ignore.denormal.mode"), metadata);
+    }
+    if($amdgpu_no_fine_grained_memory) {
+      llvm::MDNode *metadata = llvm::MDNode::get(llvmContext, std::nullopt);
+      inst->setMetadata(llvmContext.getMDKindID("amdgpu.no.fine.grained.memory"), metadata);
+    }
+    if($amdgpu_no_remote_memory) {
----------------
gysit wrote:

Can you update the mlirBuilder below? It is used by the import of LLVM IR into MLIR LLVM dialect and we try to keep the two paths consistent.

A test for the import could be added in:
`llvm-project/mlir/test/Target/LLVMIR/Import/instructions.ll`
Or also in a separate file if you prefer.


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


More information about the Mlir-commits mailing list