diff --git a/llvm/docs/AMDGPUMemoryModel.md b/llvm/docs/AMDGPUMemoryModel.md index 90ada309913c6..f6618d91fc931 100644 --- a/llvm/docs/AMDGPUMemoryModel.md +++ b/llvm/docs/AMDGPUMemoryModel.md @@ -210,6 +210,31 @@ side-effects are made available at "workgroup" scope. In other words, the scope for atomicity is not always the same as the scope for availability/visibility. ``` +### volatile Accesses + +```llvm +store volatile ..., ptr addrspace(N) %addr +%value = load volatile ..., ptr addrspace(N) %addr +``` + +A non-atomic `volatile` access results in a *store-available* or *load-visible* +operation with the widest scope supported by its address space: + +- "system" scope for `addrspace(1)` (global) and `addrspace(0)` (generic), and +- "workgroup" scope for `addrspace(3)` (local), since local memory is not + observable beyond its workgroup. + +A `volatile` atomic access is not widened in this way. Its availability and +visibility remain limited to its `syncscope`, as described for atomic accesses +above. + +```{note} +The availability and visibility of volatile accesses is specific to AMDGPU, and +orthogonal to the {ref}`base semantics defined in LLVM IR`. This fully +specifies the behavior that the {ref}`LLVM memory model` otherwise +leaves target-dependent for `volatile` accesses. +``` + (amdgpu-av-metadata)= ### !"amdgcn-av" metadata