table of contents
other versions
other sections
BARRIER(3clc) | OpenCL Manual | BARRIER(3clc) |
NAME¶
barrier - All work-items in a work-group executing the kernel on a processor must execute this function before any are allowed to continue execution beyond the barrier.¶
void
barrier(cl_mem_fence_flags flags);
DESCRIPTION¶
All work-items in a work-group executing the kernel on a processor must execute this function before any are allowed to continue execution beyond the barrier. This function must be encountered by all work-items in a work-group executing the kernel. If barrier is inside a conditional statement, then all work-items must enter the conditional if any work-item enters the conditional statement and executes the barrier. If barrier is inside a loop, all work-items must execute the barrier for each iteration of the loop before any are allowed to continue execution beyond the barrier. The barrier function also queues a memory fence (reads and writes) to ensure correct ordering of memory operations to local or global memory. The flags argument specifies the memory address space and can be set to a combination of the following literal values. CLK_LOCAL_MEM_FENCE - The barrier function will either flush any variables stored in local memory or queue a memory fence to ensure correct ordering of memory operations to local memory. CLK_GLOBAL_MEM_FENCE - The barrier function will queue a memory fence to ensure correct ordering of memory operations to global memory. This can be useful when work-items, for example, write to buffer or image objects and then want to read the updated data.SPECIFICATION¶
OpenCL Specification[1]AUTHORS¶
The Khronos GroupCOPYRIGHT¶
Copyright © 2007-2011 The Khronos Group Inc.NOTES¶
- 1.
- OpenCL Specification
page 274, section 6.12.8 - Synchronization
Functions
06/18/2014 | The Khronos Group |