Skip to content

Commit c70c394

Browse files
jhuber6vikramRH
authored andcommitted
[Clang][AMDGPU] Stop defaulting to one-as for all atomic scopes (llvm#120095)
Summary: The documentation at https://llvm.org/docs/AMDGPUUsage.html#memory-scopes states that these 'one-as' modifiers are more specific versions of the scopes that only apply to a specific address space. This doesn't make sense for fences which have no associated address space to use, and it's a more restrictive version the normal scope. This should not tbe the default behavior, but it is currently emitted in all cases except for sequentially consistent.
1 parent 6958fc1 commit c70c394

File tree

4 files changed

+235
-229
lines changed

4 files changed

+235
-229
lines changed

clang/lib/CodeGen/Targets/AMDGPU.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,11 @@ AMDGPUTargetCodeGenInfo::getLLVMSyncScopeID(const LangOptions &LangOpts,
530530
break;
531531
}
532532

533-
if (Ordering != llvm::AtomicOrdering::SequentiallyConsistent) {
533+
// OpenCL assumes by default that atomic scopes are per-address space for
534+
// non-sequentially consistent operations.
535+
if (Scope >= SyncScope::OpenCLWorkGroup &&
536+
Scope <= SyncScope::OpenCLSubGroup &&
537+
Ordering != llvm::AtomicOrdering::SequentiallyConsistent) {
534538
if (!Name.empty())
535539
Name = Twine(Twine(Name) + Twine("-")).str();
536540

0 commit comments

Comments
 (0)