[llvm] [Docs][AMDGPU] availability/visibility in addrspace(3) (PR #212707)

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 07:24:03 PDT 2026


================
@@ -126,47 +126,80 @@ these necessary conditions, and hence they can be explained using the rules from
 either memory model. But the new intrinsics and metadata *opt out* of the LLVM
 memory model, and can only be explained using the AMDGPU memory model.
 
+### Store-Available and Load-Visible
+
 (amdgpu-store-available)=
 
-### store-available
+#### store-available
 
 ```llvm
- at llvm.amdgcn.av.global.store.b128(ptr, value, scope)
-store atomic [syncscope("<target-scope>")]
-atomicrmw    [syncscope("<target-scope>")]
-cmpxchg      [syncscope("<target-scope>")]
+ at llvm.amdgcn.av.global.store.b128(
+    ptr addrspace(1) %addr,
+    <4 x i32> %value,
+    metadata !scope)
 ```
 
 The `@llvm.amdgcn.av.global.store.b128` intrinsic performs a non-atomic
-*store-available* operation on `ptr` with scope `scope`.
+*store-available* operation on `%addr` with scope `!scope`.
+
+```llvm
+store atomic ..., [syncscope("<target-scope>")]
+atomicrmw    ..., [syncscope("<target-scope>")]
+cmpxchg      ..., [syncscope("<target-scope>")]
+```
 
 An atomic operation that results in a store operation is a *store-available*
 operation with scope `syncscope`.
 
+```llvm
+store ..., ptr addrspace(N) %addr
+```
+
+A `store` operation to `addrspace(3)` is always performed as a *store-available*
+operation with "workgroup" scope.
----------------
ssahasra wrote:

> A more invasive alternative would be to separate av scope instance from syncscope instance (and also scope inclusion according to either), so that "X and Y specify inclusive scopes." doesn't mean different things depending on the section in which the phrase is used (it would then be "X and Y specify inclusive syncscopes." or "X and Y specify inclusive availability/visibility scopes." or something like that).

We have never used the phrase "_specify_ inclusive scopes". We have always said "_have_ inclusive scopes". The proposed wording says that the store-available _is at workgroup scope_. So why should any of this be a problem? There _may_ be some ambiguity about syncscope v/s availability scope, but usually the use of _syncscope_ is pretty consistent.

We even have this sentence, clearly showing that there are different kinds of scope.

> An atomic operation that results in a store operation is a store-available operation with scope *syncscope*.

And we have this too:

> When an operation X specifies a scope S, it indicates the instance of S that contains X. This scope instance is also termed as X’s instance of scope S, or just X’s scope instance when S is implied by the context.

The scope instance of a *store-available* operation is different from the scope instance of a *store atomic* operation although they are performed by the same instruction. I don't really think we need anything more precise than this.

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


More information about the llvm-commits mailing list