atomic_work_item_fence functions.

void atomic_work_item_fence ( cl_mem_fence_flags flags,
  memory_order order,
  memory_scope scope)



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 calling atomic_work_item_fence with CLK_GLOBAL_MEM_FENCE, CLK_LOCAL_MEM_FENCE or CLK_IMAGE_MEM_FENCE ORed together is equivalent to calling atomic_work_item_fence individually for each of the fence values set in flags.



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.


OpenCL Specification

Also see

Atomic Functions

Copyright © 2007-2013 The Khronos Group Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.