[clang] [Clang][AMDGPU] Stop defaulting to `one-as` for all atomic scopes (PR #120095)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 3 13:45:05 PST 2025
================
@@ -537,7 +537,11 @@ AMDGPUTargetCodeGenInfo::getLLVMSyncScopeID(const LangOptions &LangOpts,
break;
}
- if (Ordering != llvm::AtomicOrdering::SequentiallyConsistent) {
+ // OpenCL assumes by default that atomic scopes are per-address space for
+ // non-sequentially consistent operations.
+ if (Scope >= SyncScope::OpenCLWorkGroup &&
----------------
jhuber6 wrote:
Currently each implementation of this "atomic scope" thing uses a different set of enums. The code is simply checking if it's inside the range of enums that the OpenCL implementation uses so that it will have the modified behavior if the user wants the OpenCL flavor. This makes sense to me because currently all targets are emitting these weaker atomics which are not correct in all cases the user would expect atomics to work outside of what the OpenCL standard specifies. So if users want the OpenCL rules they should use the OpenCL flavor builtins. I.e. `__opencl_atomic` vs. `__atomic` or `__scoped_atomic` or `__hip_atomic`.
https://github.com/llvm/llvm-project/pull/120095
More information about the cfe-commits
mailing list