[clang] [llvm] [SPIRV][RFC] Rework / extend support for memory scopes (PR #106429)
Dmitry Sidorov via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 11 09:00:27 PDT 2024
================
@@ -251,6 +251,24 @@ SPIRV::MemorySemantics::MemorySemantics getMemSemantics(AtomicOrdering Ord) {
llvm_unreachable(nullptr);
}
+SPIRV::Scope::Scope getMemScope(const LLVMContext &Ctx, SyncScope::ID ID) {
+ SmallVector<StringRef> SSNs;
+ Ctx.getSyncScopeNames(SSNs);
+
+ StringRef MemScope = SSNs[ID];
+ if (MemScope.empty() || MemScope == "all_svm_devices")
----------------
MrSidims wrote:
I personally prefer to keep an explicit check for whatever default string we have. It should be easier (and hence more error-prone) to reuse names from https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_scope_id instead of thinking about, what is LLVM's default and how it maps on SPIR-V scopes.
https://github.com/llvm/llvm-project/pull/106429
More information about the cfe-commits
mailing list