[llvm] AMDGPU: Preliminary documentation for named barriers (PR #165502)

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 30 07:34:26 PDT 2025


================
@@ -1179,6 +1179,53 @@ is conservatively correct for OpenCL.
                              other operations within the same address space.
      ======================= ===================================================
 
+Target Types
+------------
+
+The AMDGPU backend implements some target extension types.
+
+.. _amdgpu-types-named-barriers:
+
+Named Barriers
+~~~~~~~~~~~~~~
+
+Named barriers are represented as memory objects of type
+``target("amdgcn.named.barrier", 0)``. They are allocated as global variables
+in the LDS address space. They do not occupy regular LDS memory, but their
+lifetime and allocation granularity matches that of global variables in LDS.
+
+The following types built from named barriers are supported in global variables,
+defined recursively:
+
+* a standalone ``target("amdgcn.named.barrier", 0)``
+* an array of supported types
+* a struct containing a single element of supported type
+
+.. code-block:: llvm
+
+      @bar = addrspace(3) global target("amdgcn.named.barrier", 0) undef
+      @foo = addrspace(3) global [2 x target("amdgcn.named.barrier", 0)] undef
+      @baz = addrspace(3) global { target("amdgcn.named.barrier", 0) } undef
+
+Barrier types may not be used in ``alloca``.
+
+The integral representation of a pointer to a valid named barrier is in the
----------------
nhaehnle wrote:

It occurred to me that the bit representation of the pointers matters if a user wants to interop between compiled code and handwritten assembly using function calls, which is also part of the justification for documenting the function call ABI in this document.

But I already removed it from this PR and I'm not going to insist that we add it back.

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


More information about the llvm-commits mailing list