@@ -1189,15 +1189,19 @@ The AMDGPU backend implements some target extension types.
11891189Named Barriers
11901190~~~~~~~~~~~~~~
11911191
1192- Named barriers are represented as memory objects of type
1193- ``target("amdgcn.named.barrier", 0)``. They are allocated as global variables
1194- in the LDS address space. They do not occupy regular LDS memory, but their
1195- lifetime and allocation granularity matches that of global variables in LDS.
1192+ Named barriers are fixed function hardware barrier objects that are available
1193+ in gfx12.5+ in addition to the traditional default barriers.
11961194
1197- The following types built from named barriers are supported in global variables,
1198- defined recursively:
1195+ In LLVM IR, named barriers are represented by global variables of type
1196+ ``target("amdgcn.named.barrier", 0)`` in the LDS address space. Named barrier
1197+ global variables do not occupy actual LDS memory, but their lifetime and
1198+ allocation scope matches that of global variables in LDS. Programs in LLVM IR
1199+ refer to named barriers using pointers.
11991200
1200- * a standalone ``target("amdgcn.named.barrier", 0)``
1201+ The following named barrier types are supported in global variables, defined
1202+ recursively:
1203+
1204+ * a single, standalone ``target("amdgcn.named.barrier", 0)``
12011205* an array of supported types
12021206* a struct containing a single element of supported type
12031207
@@ -1207,15 +1211,12 @@ defined recursively:
12071211 @foo = addrspace(3) global [2 x target("amdgcn.named.barrier", 0)] undef
12081212 @baz = addrspace(3) global { target("amdgcn.named.barrier", 0) } undef
12091213
1210- Barrier types may not be used in ``alloca`` .
1214+ .. .
12111215
1212- The integral representation of a pointer to a valid named barrier is in the
1213- range ``0x0080'0010`` to ``0x0080'0100`` (inclusive). The representation is
1214- formed by the expression ``0x0080'0000 | (id << 4)``, where ``id`` is the
1215- hardware barrier ID. The integral representation of the null named barrier is
1216- ``0x0080'0000``.
1216+ %foo.i = getelementptr [2 x target("amdgcn.named.barrier", 0)], ptr addrspace(3) @foo, i32 0, i32 %i
1217+ call void @llvm.amdgcn.s.barrier.signal.var(ptr addrspace(3) %foo.i, i32 0)
12171218
1218- It is not legal to attempt to form a pointer to any non-named barrier objects .
1219+ Named barrier types may not be used in ``alloca`` .
12191220
12201221It is undefined behavior to use a pointer to any part of a named barrier object
12211222as the pointer operand of a regular memory access instruction or intrinsic.
@@ -6721,11 +6722,10 @@ Named barriers may be signaled by the intrinsics:
67216722
67226723.. code-block:: llvm
67236724
6724- declare void @llvm.amdgcn.s.barrier.signal(i32 %barrier_hw_id)
67256725 declare void @llvm.amdgcn.s.barrier.signal.var(ptr addrspace(3) %barrier_ptr, i32 %member_count)
67266726
6727- If the second form is used and ``member_count`` is non-zero, the operation is
6728- an *initializing* signal, else it is *non*-initializing.
6727+ If ``member_count`` is non-zero, the operation is an *initializing* signal,
6728+ else it is *non*-initializing.
67296729
67306730Named barriers may be initialized explicitly using:
67316731
0 commit comments