The following fence operations are supported.
void atomic_work_item_fence(cl_mem_fence_flags flags,
// Older syntax memory fences are equivalent to atomic_work_item_fence with the
// same flags parameter, memory_scope_work_group scope, and ordering as follows:
void mem_fence(cl_mem_fence_flags flags) // memory_order_acq_rel
void read_mem_fence(cl_mem_fence_flags flags) // memory_order_acquire
void write_mem_fence(cl_mem_fence_flags flags) // memory_order_release
flags must be set to
CLK_IMAGE_MEM_FENCE or a combination of these values ORed together;
otherwise the behavior is undefined.
The behavior of calling
ORed together with either
equivalent to calling
atomic_work_item_fence individually for
CLK_IMAGE_MEM_FENCE and the other flags.
atomic_work_item_fence will synchronize memory operations to both
global memory through some shared atomic action, as described in
section 220.127.116.11 of the OpenCL Specification.
Depending on the value of order, this operation:
has no effects, if order ==
is an acquire fence, if order ==
is a release fence, if order ==
is both an acquire fence and a release fence, if order ==
is a sequentially consistent acquire and release fence, if order ==
For images declared with the
read_write qualifier, the
atomic_work_item_fence must be called to make sure that writes to the
image by a work-item become visible to that work-item on subsequent reads to
that image by that work-item.
|The use of memory order and scope enumerations must respect the restrictions section below.
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.