Description
The following table describes built-in functions to synchronize the work-items in a work-group.
| Function | Description |
|---|---|
void barrier( For OpenCL C 2.0 or newer, as an alias for barrier: void work_group_barrier( void work_group_barrier( |
For these functions, if any work-item in a work-group encounters a barrier, the barrier must be encountered by all work-items in the work-group before any are allowed to continue execution beyond the barrier. If the barrier is inside a conditional statement, then all work-items in the work-group must enter the conditional if any work-item in the work-group enters the conditional statement and executes the barrier. If the barrier is inside a loop, then all work-items in the work-group must execute the barrier on each iteration of the loop if any work-item executes the barrier on that iteration. The barrier and work_group_barrier functions can specify which
memory operations become visible to the appropriate memory scope
identified by scope [1].
The flags argument specifies the memory address spaces.
This is a bitfield and can be set to 0 or a combination of the
following values OR’ed together.
When these flags are OR’ed together the barrier acts as a
combined barrier for all address spaces specified by the flags
ordering memory accesses both within and across the specified address
spaces.
For barrier and the work_group_barrier variant that does not take a
memory scope, the scope is The values of flags and scope must be the same for all work-items in the work-group. |
Document Notes
For more information, see the OpenCL C Specification
This page is extracted from the OpenCL C Specification. Fixes and changes should be made to the Specification, not directly.