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

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 00:16:42 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:

Agreed, but not sure where they should go to be meaningful. Any ideas?
Maybe `TargetParser` could have a list of MMRA-related values (tag prefix/suffixes, mask values for builtins, etc.) ?


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


More information about the llvm-commits mailing list