[llvm] [AMDGPU][Doc] Move barrier documentation to a separate document (PR #194569)

Fabian Ritter via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 23:41:46 PDT 2026


================
@@ -0,0 +1,431 @@
+.. _amdgpu-execution-synchronization:
+
+================================
+AMDGPU Execution Synchronization
+================================
+
+.. contents::
+   :local:
+
+.. _amdgpu-execution-synchronization-barriers:
+
+This document covers different ways of synchronizing execution of threads on AMD GPUs.
+
+.. note::
+
+  This document is not exhaustive. There may be more ways of synchronizing execution
+  that are not covered by this document.
+
+Barriers
+========
+
+This section covers execution synchronization using barrier-style primitives.
+
+.. _amdgpu-execution-synchronization-barriers-execution-model:
+
+Execution Model
+---------------
+
+This section contains a formal execution model that can be used to model the behavior of
+barriers on AMDGPU targets.
+
+.. note::
+
+  The barrier execution model is experimental and subject to change.
+
+Threads can synchronize execution by performing barrier operations on barrier *objects* as described below:
+
+* Each barrier *object* has the following state:
+
+  * An unsigned positive integer *expected count*: counts the number of *arrive* operations
+    expected for this barrier *object*.
+  * An unsigned non-negative integer *arrive count*: counts the number of *arrive* operations
+    already performed on this barrier *object*.
+
+      * The initial value of *arrive count* is zero.
+      * When an operation causes *arrive count* to be equal to *expected count*, the barrier is completed,
+        and the *arrive count* is reset to zero.
+
+* Barrier *objects* exist within a *scope* (see :ref:`amdgpu-amdhsa-llvm-sync-scopes-table`),
+  and each instance of a barrier *object* can only be accessed by threads in the *scope* where
----------------
ritter-x2a wrote:

I know this is wording that was not newly introduced in this PR, but I just noticed it here: Wouldn't "threads in the *scope instance*" rather than "threads in the *scope*" be the more accurate term here? (Especially since PR #191246 aims to clearer define this distinction.)

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


More information about the llvm-commits mailing list