[llvm] [AMDGPU] Use wavefront scope for single-wave workgroup synchronization (PR #187673)
Fabian Ritter via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 1 06:30:37 PDT 2026
================
@@ -165,6 +166,19 @@ class SIMemOpInfo final {
// AGENT scope as a conservatively correct alternative.
if (this->Scope == SIAtomicScope::CLUSTER && !ST.hasClusters())
this->Scope = SIAtomicScope::AGENT;
+
+ // When max flat work-group size is at most the wavefront size, the
+ // work-group fits in a single wave, so LLVM workgroup scope matches
+ // wavefront scope. Demote workgroup → wavefront here for fences and for
+ // atomics with ordering stronger than monotonic.
+ if (ScopeDemotionFn && this->Scope == SIAtomicScope::WORKGROUP &&
+ (llvm::isStrongerThan(this->Ordering, AtomicOrdering::Monotonic) ||
----------------
ritter-x2a wrote:
Is there a reason why we can't/shouldn't do this for `Monotonic` as well? (and also `Unordered`, although I'm not sure if anyone uses that with our backend)
https://github.com/llvm/llvm-project/pull/187673
More information about the llvm-commits
mailing list