kernel.barrier
← kernel dialect
Synchronize invocations in an explicit execution scope and fence a named memory space with a required ordering. Workgroup-memory barriers synchronize either the current subgroup or workgroup with acquire-release ordering. Global-memory barriers synchronize the current workgroup with acquire, release, or acquire-release ordering. Async-copy completion is modeled by kernel.async.wait; use kernel.barrier only when invocations must rendezvous before consuming shared or global memory.
Operation contract
| Property |
Value |
| Semantic phase |
— |
| Traits |
MemoryFence, Convergent |
| Target contracts |
kernel.synchronization |
Signature
| Kind |
Name |
Type |
Cardinality |
Description |
| Attribute |
memory_space |
enum MemorySpace |
required |
Memory space whose accesses are fenced by the barrier. |
| Attribute |
ordering |
enum AtomicOrdering |
required |
Memory ordering applied to fenced accesses. |
| Attribute |
scope |
enum AtomicScope |
required |
Execution scope synchronized by the barrier. |
Examples
kernel.barrier<workgroup> scope(subgroup) ordering(acq_rel)
kernel.barrier<workgroup> scope(workgroup) ordering(acq_rel)
kernel.barrier<global> scope(workgroup) ordering(release)
kernel.barrier<global> scope(workgroup) ordering(acquire)