atomic_work_item_fence functions.
void atomic_work_item_fence(cl_mem_fence_flags flags,
memory_order order,
memory_scope scope)
flags
-
Must be set to
CLK_GLOBAL_MEM_FENCE
,CLK_LOCAL_MEM_FENCE
,CLK_IMAGE_MEM_FENCE
or a combination of these values ORed together; otherwise the behavior is undefined. The behavior of callingatomic_work_item_fence
withCLK_IMAGE_MEM_FENCE
ORed together with eitherCLK_GLOBAL_MEM_FENCE
orCLK_LOCAL_MEM_FENCE
is equivalent to callingatomic_work_item_fence
individually forCLK_IMAGE_MEM_FENCE
and the other flags. Passing bothCLK_GLOBAL_MEM_FENCE
andCLK_LOCAL_MEM_FENCE
toatomic_work_item_fence
will synchronize memory operations to both local and global memory through some shared atomic action, as described in section 3.3.6.2 of the OpenCL API specficiation. order
scope
-
== Description
Depending on the value of order, this operation:
-
has no effects, if
order
==memory_order_relaxed
. -
is an acquire fence, if
order
==memory_order_acquire
. -
is a release fence, if
order
==memory_order_release
. -
is both an acquire fence and a release fence, if
order
==memory_order_acq_rel
. -
is a sequentially consistent acquire and release fence, if
order
==memory_order_seq_cst
.
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 workitem on subsequent reads to that image by that work-item.