void __ovld atomic_work_item_fence(cl_mem_fence_flags flags, memory_order order, memory_scope scope);
// atomic_fetch()
+// OpenCL v2.0 s6.13.11.7.5:
+// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument can be ptrdiff_t.
+#if defined(__opencl_c_atomic_order_seq_cst) && defined(__opencl_c_atomic_scope_device)
int __ovld atomic_fetch_add(volatile atomic_int *object, int operand);
uint __ovld atomic_fetch_add(volatile atomic_uint *object, uint operand);
int __ovld atomic_fetch_sub(volatile atomic_int *object, int operand);
ulong __ovld atomic_fetch_min(volatile atomic_ulong *object, ulong operand);
long __ovld atomic_fetch_max(volatile atomic_long *object, long operand);
ulong __ovld atomic_fetch_max(volatile atomic_ulong *object, ulong operand);
-#endif //defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-
-// OpenCL v2.0 s6.13.11.7.5:
-// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument can be ptrdiff_t.
-
-#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t *object, ptrdiff_t operand);
uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t *object, ptrdiff_t operand);
+#endif //defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
#endif
+#if defined(__opencl_c_atomic_scope_device)
int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand, memory_order order);
uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object, uint operand, memory_order order);
int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand, memory_order order);
ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
long __ovld atomic_fetch_max_explicit(volatile atomic_long *object, long operand, memory_order order);
ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
-#endif //defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order);
uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order);
+#endif //defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
#endif
int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
// atomic_store()
+#if defined(__opencl_c_atomic_order_seq_cst) && defined(__opencl_c_atomic_scope_device)
void __ovld atomic_store(volatile atomic_int *object, int desired);
void __ovld atomic_store(volatile atomic_uint *object, uint desired);
void __ovld atomic_store(volatile atomic_float *object, float desired);
void __ovld atomic_store(volatile atomic_long *object, long desired);
void __ovld atomic_store(volatile atomic_ulong *object, ulong desired);
#endif
+#endif
+#if defined(__opencl_c_atomic_scope_device)
void __ovld atomic_store_explicit(volatile atomic_int *object, int desired, memory_order order);
void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired, memory_order order);
void __ovld atomic_store_explicit(volatile atomic_float *object, float desired, memory_order order);
void __ovld atomic_store_explicit(volatile atomic_long *object, long desired, memory_order order);
void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired, memory_order order);
#endif
+#endif
void __ovld atomic_store_explicit(volatile atomic_int *object, int desired, memory_order order, memory_scope scope);
void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired, memory_order order, memory_scope scope);
#endif
// atomic_load()
-
+#if defined(__opencl_c_atomic_order_seq_cst) && defined(__opencl_c_atomic_scope_device)
int __ovld atomic_load(volatile atomic_int *object);
uint __ovld atomic_load(volatile atomic_uint *object);
float __ovld atomic_load(volatile atomic_float *object);
long __ovld atomic_load(volatile atomic_long *object);
ulong __ovld atomic_load(volatile atomic_ulong *object);
#endif
+#endif
+#if defined(__opencl_c_atomic_scope_device)
int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order);
uint __ovld atomic_load_explicit(volatile atomic_uint *object, memory_order order);
float __ovld atomic_load_explicit(volatile atomic_float *object, memory_order order);
long __ovld atomic_load_explicit(volatile atomic_long *object, memory_order order);
ulong __ovld atomic_load_explicit(volatile atomic_ulong *object, memory_order order);
#endif
+#endif
int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order, memory_scope scope);
uint __ovld atomic_load_explicit(volatile atomic_uint *object, memory_order order, memory_scope scope);
// atomic_exchange()
+#if defined(__opencl_c_atomic_order_seq_cst) && defined(__opencl_c_atomic_scope_device)
int __ovld atomic_exchange(volatile atomic_int *object, int desired);
uint __ovld atomic_exchange(volatile atomic_uint *object, uint desired);
float __ovld atomic_exchange(volatile atomic_float *object, float desired);
long __ovld atomic_exchange(volatile atomic_long *object, long desired);
ulong __ovld atomic_exchange(volatile atomic_ulong *object, ulong desired);
#endif
+#endif
+#if defined(__opencl_c_atomic_scope_device)
int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired, memory_order order);
uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired, memory_order order);
float __ovld atomic_exchange_explicit(volatile atomic_float *object, float desired, memory_order order);
long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired, memory_order order);
ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object, ulong desired, memory_order order);
#endif
+#endif
int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired, memory_order order, memory_scope scope);
uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired, memory_order order, memory_scope scope);
#endif
// atomic_compare_exchange_strong() and atomic_compare_exchange_weak()
-
+#if defined(__opencl_c_atomic_order_seq_cst) && defined(__opencl_c_atomic_scope_device)
bool __ovld atomic_compare_exchange_strong(volatile atomic_int *object, int *expected, int desired);
bool __ovld atomic_compare_exchange_strong(volatile atomic_uint *object, uint *expected, uint desired);
bool __ovld atomic_compare_exchange_weak(volatile atomic_int *object, int *expected, int desired);
bool __ovld atomic_compare_exchange_strong(volatile atomic_ulong *object, ulong *expected, ulong desired);
bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong *object, ulong *expected, ulong desired);
#endif
+#endif
bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object, int *expected,
int desired, memory_order success, memory_order failure);
#endif
// atomic_flag_test_and_set() and atomic_flag_clear()
-
+#if defined(__opencl_c_atomic_order_seq_cst) && defined(__opencl_c_atomic_scope_device)
bool __ovld atomic_flag_test_and_set(volatile atomic_flag *object);
void __ovld atomic_flag_clear(volatile atomic_flag *object);
+#endif
+#if defined(__opencl_c_atomic_scope_device)
bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object, memory_order order);
void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object, memory_order order);
+#endif
bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object, memory_order order, memory_scope scope);
void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object, memory_order order, memory_scope scope);