[clang] [llvm] [SPIRV][HLSL] Fix Vulkan-invalid SPIR-V for Interlocked* on groupshared/UAV memory (PR #212663)
Farzon Lotfi via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 30 10:04:11 PDT 2026
================
@@ -310,6 +310,16 @@ static Value *handleElementwiseF32ToF16(CodeGenFunction &CGF,
llvm_unreachable("Intrinsic F32ToF16 not supported by target architecture");
}
+// Pick the atomic memory scope for an HLSL Interlocked* op by destination:
+// Workgroup for groupshared, Device otherwise (Vulkan forbids CrossDevice).
+static llvm::SyncScope::ID GetInterlockedScope(CodeGenFunction &CGF,
+ const LValue &DestLV) {
+ StringRef ScopeName = DestLV.getAddressSpace() == LangAS::hlsl_groupshared
+ ? "workgroup"
+ : "device";
----------------
farzonl wrote:
Hmm there is a bit of an established pattern to do stuff like this in `clang/lib/CodeGen/Targets/SPIR.cpp`. If this is SPIRV specfic should it really live here?
https://github.com/llvm/llvm-project/pull/212663
More information about the cfe-commits
mailing list