9. Synchronization#
9.1. barrier.workgroup#
Synchronize work-items within the same work-group.
Syntax:
barrier.workgroup
PISA Notes
introduced in PISA version 0.1
requires PISA target 100 or compatible
Notes:
All work-items in a work-group must execute this instruction before any are allowed to continue execution past it. Specifically,
If the barrier is inside a conditional statement, all work-items must take that branch if any work-item executes the barrier.
If the barrier is inside a loop, all work-items must execute the barrier on every iteration.
A work-item that has already exited the kernel via a return instruction is not required to reach the barrier.
If the above conditions are not satisfied, the behavior is undefined.
Examples:
// barrier across work-items in the work-group
barrier.workgroup;
9.2. fence#
Wait for previous memory accesses to become observable in the specified scope.
Fence on shared or generic address space:
fence<.addrspace><.memorder>.memscope .addrspace = { .shared, .generic } .memorder = { .acquire, .release, .acq_rel, .seq_cst } .memscope = { .workgroup, .gpu }
PISA Notes
introduced in PISA version 0.1
requires PISA target 100 or compatible
Fence on global address space:
fence.addrspace<.memorder>.memscope .addrspace = { .global } .memorder = { .acquire, .release, .acq_rel, .seq_cst } .memscope = { .workgroup, .gpu, .system }
PISA Notes
introduced in PISA version 0.1
requires PISA target 100 or compatible
Sub-group fence:
fence.memscope .memscope = { .subgroup }
PISA Notes
introduced in PISA version 0.1
requires PISA target 100 or compatible
Notes:
A fence instruction guarantees that all prior memory accesses (loads, stores, and atomics) to the specified address space by this work-item are observable for the set of work-items in the specified memory scope. For generic address space, the fence operation will apply to both shared and global memory accesses. Together with other synchronization instructions, they can be used to establish the ordering of relaxed memory operations in different work-items.
Examples:
// memory fence at work-group scope
fence.workgroup;
// memory fence at gpu scope with acquire memory ordering
fence.acquire.gpu;