Skip to content

Commit 4732753

Browse files
committed
Remove the memory model section for now
commit-id:aaa9593d
1 parent 43377d8 commit 4732753

File tree

1 file changed

+0
-134
lines changed

1 file changed

+0
-134
lines changed

llvm/docs/AMDGPUUsage.rst

Lines changed: 0 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,9 +1224,6 @@ as the pointer operand of a regular memory access instruction or intrinsic.
12241224
Pointers to named barrier objects are intended to be used with dedicated
12251225
intrinsics.
12261226

1227-
We expand on the semantics of named barriers in
1228-
:ref:`the memory model section <amdgpu-memory-model-named-barriers>`.
1229-
12301227

12311228
LLVM IR Intrinsics
12321229
------------------
@@ -6670,137 +6667,6 @@ Multiple tags can be used at the same time to synchronize with more than one add
66706667
better code optimization, at the cost of synchronizing additional address
66716668
spaces.
66726669

6673-
.. _amdgpu-memory-model-barriers:
6674-
6675-
Hardware Barriers
6676-
+++++++++++++++++
6677-
6678-
.. note::
6679-
6680-
This section is preliminary. The semantics described here are intended to be
6681-
formalized properly in the future.
6682-
6683-
Hardware barriers synchronize execution between concurrently running waves using
6684-
fixed function hardware. Intuitively, a set of waves are "members" of a barrier.
6685-
Waves *signal* the barrier and later *wait* for it. Execution only proceeds past
6686-
the *wait* once all member waves have *signaled* the barrier.
6687-
6688-
Formally, barriers affect semantics in exactly two ways. First, they affect
6689-
forward progress. Waiting on a barrier that never completes (is not signaled
6690-
sufficiently) prevents forward progress and therefore, given the assumption of
6691-
forward progress, is undefined behavior. Second, barrier operations can pair
6692-
with fences to contribute *synchronizes-with* relations in the memory model.
6693-
6694-
Roughly speaking:
6695-
6696-
- Release fences pair with barrier signal operations that are later in program
6697-
order
6698-
- Barrier wait operations pair with acquire fences that are later in program
6699-
order
6700-
- If a barrier signal operation contributes to allowing a wait operation to
6701-
complete, then the corresponding paired fences can synchronize-with each
6702-
other (given compatible sync scopes and memory model relaxation annotations)
6703-
6704-
Default Barriers
6705-
################
6706-
6707-
There is a default workgroup barrier and a default cluster barrier. All waves
6708-
of a workgroup and cluster are members of the same default workgroup and
6709-
cluster barriers, respectively.
6710-
6711-
.. _amdgpu-memory-model-named-barriers:
6712-
6713-
Named Barriers
6714-
##############
6715-
6716-
All named barrier operations must occur in wave-uniform control flow. All
6717-
arguments of named barrier intrinsics must be wave-uniform.
6718-
6719-
Named barriers are allocated as global variables of
6720-
:ref:`a target extension type <amdgpu-types-named-barriers>`.
6721-
6722-
Named barriers may be signaled by the intrinsics:
6723-
6724-
.. code-block:: llvm
6725-
6726-
declare void @llvm.amdgcn.s.barrier.signal.var(ptr addrspace(3) %barrier_ptr, i32 %member_count)
6727-
6728-
If ``member_count`` is non-zero, the operation is an *initializing* signal,
6729-
else it is *non*-initializing.
6730-
6731-
Named barriers may be initialized explicitly using:
6732-
6733-
.. code-block:: llvm
6734-
6735-
declare void @llvm.amdgcn.s.barrier.init(ptr addrspace(3) %barrier_ptr, i32 %member_count)
6736-
6737-
It is possible to "leave" a named barrier. This decrements the named barrier's
6738-
member count and completes the barrier if all other members have signaled it:
6739-
6740-
.. code-block:: llvm
6741-
6742-
declare void @llvm.amdgcn.s.barrier.leave(i32 %barrier_type)
6743-
6744-
``barrier_type`` must be set to ``1``.
6745-
6746-
Note that leaving a named barrier is not exactly the opposite of joining a
6747-
barrier (for example, joining a barrier does not change its member count).
6748-
6749-
Leaving implicitly *joins* (see below) a null named barrier.
6750-
6751-
Signal, leave, and initializing operations on the same named barrier must obey
6752-
certain ordering constraints:
6753-
6754-
* Non-initializing signals must be ordered after some initializing signal or an
6755-
explicit initializing operation.
6756-
* Explicit initializing operations must not race signal or leave operations.
6757-
* Initializing signal operations must not race leave operations.
6758-
* Initializing signal operations with contradicting member counts must not race
6759-
each other.
6760-
6761-
The details of how these orders can be established and races prevented are tbd.
6762-
Using a default workgroup or cluster barrier in the natural way is guaranteed to
6763-
be sufficient.
6764-
6765-
In order to wait for a named barrier, a wave must first *join* the named barrier
6766-
using:
6767-
6768-
.. code-block:: llvm
6769-
6770-
declare void @llvm.amdgcn.s.barrier.join(ptr addrspace(3) %barrier_ptr)
6771-
6772-
The named barrier may then be waited for using:
6773-
6774-
.. code-block:: llvm
6775-
6776-
declare void @llvm.amdgcn.s.barrier.wait(i32 %barrier_type)
6777-
6778-
... with ``barrier_type`` set to ``1``.
6779-
6780-
Signal, leave, join, and wait operations must obey certain ordering constraints.
6781-
The details are tbd. Satisfying the following rules is guaranteed to be
6782-
sufficient:
6783-
6784-
* Signal or wait for a named barrier only if it is the most recent to have been
6785-
joined in program order.
6786-
* Signal or leave a named barrier only if the number of prior signaling
6787-
operations on that named barrier since the most recent join in program order
6788-
is equal to the number of prior wait operations on that named barrier since
6789-
the most recent join in program order.
6790-
* Wait for a named barrier only if the number of prior signaling operations on
6791-
that named barrier since the most recent join in program order is one larger
6792-
than the number of prior wait operations on that named barrier since the most
6793-
recent join in program order.
6794-
* Do not signal a named barrier or wait for it in program order after leaving it.
6795-
6796-
Additionally, use signal, leave, and wait operations on a named barrier from a
6797-
consistent associated set of waves that is determined at initialization time and
6798-
whose initial size is the member count used at initialization. The set of waves
6799-
may shrink with leave operations. Operations on a named barrier object with
6800-
conflicting sets of waves must not race. The details of this rule and how an
6801-
ordering can be established to prevent a race is tbd. Using a default workgroup
6802-
or cluster barrier in the natural way is guaranteed to be sufficient.
6803-
68046670
.. _amdgpu-amdhsa-memory-model-gfx6-gfx9:
68056671

68066672
Memory Model GFX6-GFX9

0 commit comments

Comments
 (0)