[clang] [llvm] [AMDGPU] Add OpenCL-specific fence address space masks (PR #78572)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 01:39:55 PDT 2024


================
@@ -18319,6 +18320,26 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
   return nullptr;
 }
 
+void CodeGenFunction::AddAMDGCNAddressSpaceMMRA(llvm::Instruction *Inst,
+                                                llvm::Value *ASMask) {
+  constexpr const char *Tag = "opencl-fence-mem";
+
+  uint64_t Mask = cast<llvm::ConstantInt>(ASMask)->getZExtValue();
+  if (Mask == 0)
+    return;
+
+  // 3 bits can be set: local, global, image in that order.
+  LLVMContext &Ctx = Inst->getContext();
+  SmallVector<MMRAMetadata::TagT, 3> MMRAs;
+  if (Mask & (1 << 0))
----------------
Pierre-vh wrote:

@arsenm Do you mean just having a space-separate list of address spaces such as `"image local"`?
If that's acceptable then it definitely works for me too

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


More information about the llvm-commits mailing list