I'm reading through the OpenCL 2.0 Specification because I'd like to learn more about synchronization methods. More specifically I'm currently reading through section 3.3.5 Memory model: Overview of Atomic and Fence operations, where I currently struggle to understand fences.
I'll quote the relevant bits with my questions:
The OpenCL 2.0 specification defines a number of synchronization operations that are used to define memory order constraints in a program. They play a special role in controlling how memory operations in one unit of execution (such as work-items or, when using SVM a host thread) are made visible to another. There are two types of synchronization operations in OpenCL; atomic operations and fence.
This is clear... it's just defining the synchronization mechanism provided by OpenCL.
Atomic operations are indivisible.They either occur completely or not at all. These operations are used to order memory operations between units of execution and hence they are parameterized with the memory_order and memory_scope parameters defined by the OpenCL memory consistency model.The atomic operations for the OpenCL C kernel programming language are similar to the corresponding operations defined by the C11 standard.
This is clear, it's just defining what an Atomic operation is, namely an operation which is fully executed or not executed at all per cycle.
The OpenCL 2.0 atomic operations apply to variables of an atomic type (a subset of those in the C11 standard) including atomic versions of the int, uint, long, ulong, float, double, half, intptr_t, uintptr_t, size_t, and ptrdiff_t types. However, support for some of these atomic types depends on support for the corresponding regular types.
So it sounds to me that in order to execute an atomic operation we need a variable, and therefore a memory address. The following is the bit that confused me
An atomic operation on one or more memory locations is either an acquire operation, a release operation, or both an acquire and release operation. An atomic operation without an associated memory location is a fence and can be either an acquire fence, a release fence, or both an acquire and release fence. In addition, there are relaxed atomic operations, which do not have synchronization properties, and atomic read-modify-write operations, which have special characteristics. [C11 standard, Section 5.1.2.4, paragraph 5, modified]
In this last paragraph there's the specific bit
... An atomic operation without an associated memory location is a fence ...
But how is this possible since any atomic is applied to certain variables?