[llvm] [RFC][AMDGPU] Add vulkan:private/nonprivate MMRAs support (PR #78573)

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 06:41:08 PDT 2024


================
@@ -2670,12 +2754,25 @@ bool SIMemoryLegalizer::expandAtomicCmpxchgOrRmw(const SIMemOpInfo &MOI,
   return Changed;
 }
 
+static bool isModuleUsingVulkanMM(MachineFunction &MF) {
+  Module *M = MF.getFunction().getParent();
+  if (auto *MD = mdconst::extract_or_null<ConstantInt>(
+          M->getModuleFlag("amdgpu.vulkan.memory-model")))
+    return MD->getZExtValue() == 1;
+  return false;
+}
+
----------------
ssahasra wrote:

It's actually not that bad. `VulkanMemoryModel` is a "capability" that must be declared by a SPIRV module if it uses the `NonPrivatePointer` feature. It is reasonable for the compiler to translate this to a module flag in LLVM IR.

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


More information about the llvm-commits mailing list