[clang] [Clang][AMDGPU] Stop defaulting to `one-as` for all atomic scopes (PR #120095)

Dhruva Chakrabarti via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 16 17:32:31 PST 2024


================
@@ -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 &&
----------------
dhruvachak wrote:

Can you explain which scopes will generate the one-as versions with this change? I don't know which ones are in that range: agent, workgroup, wavefront, singlethread are the possible candidates. 

I also don't understand why the one-as should be generated for a specific range of scopes. How do we know that will not lead to mis-compilation?

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


More information about the cfe-commits mailing list