================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to