Skip to content

Commit ba8755d

Browse files
jhuber6paulhuggett
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 a3a14a5 commit ba8755d

File tree

5 files changed

+269
-261
lines changed

5 files changed

+269
-261
lines changed

clang/lib/CodeGen/Targets/AMDGPU.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,11 @@ AMDGPUTargetCodeGenInfo::getLLVMSyncScopeID(const LangOptions &LangOpts,
537537
break;
538538
}
539539

540-
if (Ordering != llvm::AtomicOrdering::SequentiallyConsistent) {
540+
// OpenCL assumes by default that atomic scopes are per-address space for
541+
// non-sequentially consistent operations.
542+
if (Scope >= SyncScope::OpenCLWorkGroup &&
543+
Scope <= SyncScope::OpenCLSubGroup &&
544+
Ordering != llvm::AtomicOrdering::SequentiallyConsistent) {
541545
if (!Name.empty())
542546
Name = Twine(Twine(Name) + Twine("-")).str();
543547

0 commit comments

Comments
 (0)