@@ -1180,6 +1180,51 @@ is conservatively correct for OpenCL.
11801180 other operations within the same address space.
11811181 ======================= ===================================================
11821182
1183+ Target Types
1184+ ------------
1185+
1186+ The AMDGPU backend implements some target extension types.
1187+
1188+ .. _amdgpu-types-named-barriers:
1189+
1190+ Named Barriers
1191+ ~~~~~~~~~~~~~~
1192+
1193+ Named barriers are fixed function hardware barrier objects that are available
1194+ in gfx12.5+ in addition to the traditional default barriers.
1195+
1196+ In LLVM IR, named barriers are represented by global variables of type
1197+ ``target("amdgcn.named.barrier", 0)`` in the LDS address space. Named barrier
1198+ global variables do not occupy actual LDS memory, but their lifetime and
1199+ allocation scope matches that of global variables in LDS. Programs in LLVM IR
1200+ refer to named barriers using pointers.
1201+
1202+ The following named barrier types are supported in global variables, defined
1203+ recursively:
1204+
1205+ * a single, standalone ``target("amdgcn.named.barrier", 0)``
1206+ * an array of supported types
1207+ * a struct containing a single element of supported type
1208+
1209+ .. code-block:: llvm
1210+
1211+ @bar = addrspace(3) global target("amdgcn.named.barrier", 0) undef
1212+ @foo = addrspace(3) global [2 x target("amdgcn.named.barrier", 0)] undef
1213+ @baz = addrspace(3) global { target("amdgcn.named.barrier", 0) } undef
1214+
1215+ ...
1216+
1217+ %foo.i = getelementptr [2 x target("amdgcn.named.barrier", 0)], ptr addrspace(3) @foo, i32 0, i32 %i
1218+ call void @llvm.amdgcn.s.barrier.signal.var(ptr addrspace(3) %foo.i, i32 0)
1219+
1220+ Named barrier types may not be used in ``alloca``.
1221+
1222+ Named barriers do not have an underlying byte representation.
1223+ It is undefined behavior to use a pointer to any part of a named barrier object
1224+ as the pointer operand of a regular memory access instruction or intrinsic.
1225+ Pointers to named barrier objects are intended to be used with dedicated
1226+ intrinsics. Reading from or writing to such pointers is undefined behavior.
1227+
11831228LLVM IR Intrinsics
11841229------------------
11851230
0 commit comments