[llvm] [AMDGPU][DOCS] add async ops supported by asyncmark on GFX12 onwards (PR #200374)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 29 03:54:26 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Sameer Sahasrabuddhe (ssahasra)
<details>
<summary>Changes</summary>
Also clean up the text a bit.
---
Full diff: https://github.com/llvm/llvm-project/pull/200374.diff
2 Files Affected:
- (modified) llvm/docs/AMDGPUAsyncOperations.rst (+33-29)
- (modified) llvm/docs/AMDGPUUsage.rst (+2)
``````````diff
diff --git a/llvm/docs/AMDGPUAsyncOperations.rst b/llvm/docs/AMDGPUAsyncOperations.rst
index a55b4d94a5e7a..a51fe4ebb7e97 100644
--- a/llvm/docs/AMDGPUAsyncOperations.rst
+++ b/llvm/docs/AMDGPUAsyncOperations.rst
@@ -12,9 +12,9 @@ Introduction
Asynchronous operations are memory transfers (usually between the global memory
and LDS) that are completed independently at an unspecified scope. A thread that
-requests one or more asynchronous transfers can use *async marks* to track
-their completion. The thread waits for each mark to be *completed*, which
-indicates that requests initiated in program order before this mark have also
+requests one or more asynchronous transfers can use *asyncmarks* to track
+their completion. The thread waits for each asyncmark to be *completed*, which
+indicates that requests initiated in *program-order* before this asyncmark have also
completed.
Operations
@@ -23,12 +23,18 @@ Operations
Memory Accesses
---------------
-LDS DMA Operations
-^^^^^^^^^^^^^^^^^^
+The following instructions request asynchronous transfer of data between global
+memory and LDS memory.
+
+.. note::
+
+ These listings are *merely representative*. The actual function signatures
+ and supported architectures are documented in the :ref:`amdgpu-usage-guide`.
+
+**GFX9 Async Instructions (LDS DMA)**
.. code-block:: llvm
- ; "Legacy" LDS DMA operations
void @llvm.amdgcn.load.async.to.lds(ptr %src, ptr %dst)
void @llvm.amdgcn.global.load.async.lds(ptr %src, ptr %dst)
void @llvm.amdgcn.raw.buffer.load.async.lds(ptr %src, ptr %dst)
@@ -36,44 +42,42 @@ LDS DMA Operations
void @llvm.amdgcn.struct.buffer.load.async.lds(ptr %src, ptr %dst)
void @llvm.amdgcn.struct.ptr.buffer.load.async.lds(ptr %src, ptr %dst)
-Request an async operation that copies the specified number of bytes from the
-global/buffer pointer ``%src`` to the LDS pointer ``%dst``.
+**GFX12 Async Instructions**
-.. note::
+.. code-block:: llvm
- The above listing is *merely representative*. The actual function signatures
- are identical to their non-async variants, and supported only on the
- corresponding architectures (GFX9 and GFX10).
+ void @llvm.amdgcn.global.load.async.to.lds.type(ptr %dst, ptr %src)
+ void @llvm.amdgcn.global.store.async.from.lds.type(ptr %dst, ptr %src)
+ void @llvm.amdgcn.cluster.load.async.to.lds.type(ptr %dst, ptr %src)
-Async Mark Operations
+Asyncmark Operations
---------------------
-An *async mark* in the abstract machine tracks all the async operations that
-are program ordered before that mark. A mark M is said to be *completed*
-only when all async operations program ordered before M are reported by the
+An *asyncmark* in the abstract machine tracks all the async operations that
+are *program-ordered* before that asyncmark. An asyncmark M is said to be *completed*
+only when all async operations *program-ordered* before M are reported by the
implementation as having finished, and it is said to be *outstanding* otherwise.
Thus we have the following sufficient condition:
- An async operation X is *completed* at a program point P if there exists a
- mark M such that X is program ordered before M, M is program ordered before
+ An async operation X is *completed* at a program point P if there exists an
+ asyncmark M such that X is *program-ordered* before M, M is *program-ordered* before
P, and M is completed. X is said to be *outstanding* at P otherwise.
-The abstract machine maintains a sequence of *async marks* during the
-execution of a function body, which excludes any marks produced by calls to
+The abstract machine maintains a sequence of asyncmarks during the
+execution of a function body, which excludes any asyncmarks produced by calls to
other functions encountered in the currently executing function.
-
``@llvm.amdgcn.asyncmark()``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-When executed, inserts an async mark in the sequence associated with the
+When executed, inserts an asyncmark in the sequence associated with the
currently executing function body.
``@llvm.amdgcn.wait.asyncmark(i16 %N)``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Waits until there are at most N outstanding marks in the sequence associated
+Waits until there are at most N outstanding asyncmarks in the sequence associated
with the currently executing function body.
Memory Consistency Model
@@ -181,7 +185,7 @@ Ordinary function call
// third block
asyncmark();
- wait.asyncmark(1); // will wait for at least the second block, possibly including bar()
+ wait.asyncmark(1); // wait for the second block
wait.asyncmark(0); // will wait for third block, including bar()
}
@@ -193,13 +197,13 @@ Implementation notes
Optimization
------------
-The implementation may eliminate async mark/wait intrinsics in the following cases:
+The implementation may eliminate asyncmark/wait intrinsics in the following cases:
1. An ``asyncmark`` operation which is not included in the wait count of a later
wait operation in the current function. In particular, an ``asyncmark`` which
is not post-dominated by any ``wait.asyncmark``.
2. A ``wait.asyncmark`` whose wait count is more than the outstanding async
- marks at that point. In particular, a ``wait.asyncmark`` that is not
+ asyncmarks at that point. In particular, a ``wait.asyncmark`` that is not
dominated by any ``asyncmark``.
In general, at a function call, if the caller uses sufficient waits to track
@@ -219,7 +223,7 @@ correctness. But inlining such a call may result in redundant waits.
wait.asyncmark(1);
}
-Before inlining, the ``wait.asyncmark`` waits for mark B to be completed.
+Before inlining, the ``wait.asyncmark`` waits for asyncmark B to be completed.
.. code-block:: c++
@@ -233,6 +237,6 @@ Before inlining, the ``wait.asyncmark`` waits for mark B to be completed.
wait.asyncmark(1);
}
-After inlining, the asyncmark-wait now waits for mark C to complete, which is
-longer than necessary. Ideally, the optimizer should have eliminated mark A in
+After inlining, the ``wait.asyncmark`` now waits for asyncmark C to complete, which is
+longer than necessary. Ideally, the optimizer should have eliminated asyncmark A in
the body of foo() itself.
diff --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst
index 9027120d1d4ae..c78e623c9211a 100644
--- a/llvm/docs/AMDGPUUsage.rst
+++ b/llvm/docs/AMDGPUUsage.rst
@@ -1,3 +1,5 @@
+.. _amdgpu-usage-guide:
+
=============================
User Guide for AMDGPU Backend
=============================
``````````
</details>
https://github.com/llvm/llvm-project/pull/200374
More information about the llvm-commits
mailing list