Description

  • All operations on atomic types must be performed using the built-in atomic functions. C11 and C++11 support operators on atomic types. OpenCL C does not support operators with atomic types. Using atomic types with operators should result in a compilation error.

  • The atomic_bool, atomic_char, atomic_uchar, atomic_short, atomic_ushort, atomic_intmax_t and atomic_uintmax_t types are not supported by OpenCL C.

  • OpenCL C 2.0 requires that the built-in atomic functions on atomic types are lock-free. In OpenCL C 3.0 or newer, built-in atomic functions on atomic types may be lock-free.

  • The _Atomic type specifier and _Atomic type qualifier are not supported by OpenCL C.

  • The behavior of atomic operations where pointer arguments to the atomic functions refers to an atomic type in the private address space is undefined.

  • Using memory_order_acquire with any built-in atomic function except atomic_work_item_fence requires support for OpenCL C 2.0, or OpenCL C 3.0 or newer and the __opencl_c_atomic_order_acq_rel feature.

  • Using memory_order_release with any built-in atomic function except atomic_work_item_fence requires support for OpenCL C 2.0, or OpenCL C 3.0 or newer and the __opencl_c_atomic_order_acq_rel feature.

  • Using memory_order_acq_rel with any built-in atomic function except atomic_work_item_fence requires support for OpenCL C 2.0, or OpenCL C 3.0 or newer and the __opencl_c_atomic_order_acq_rel feature.

  • Using memory_order_seq_cst with any built-in atomic function requires support for OpenCL C 2.0, or OpenCL C 3.0 or newer and the __opencl_c_atomic_order_seq_cst feature.

  • Using memory_scope_sub_group with any built-in atomic function requires support for OpenCL C 3.0 or newer and the __opencl_c_subgroups feature.

  • Using memory_scope_device requires support for OpenCL C 2.0, or OpenCL C 3.0 or newer and the __opencl_c_atomic_scope_device feature.

  • Using memory_scope_all_svm_devices requires support for OpenCL C 2.0, or OpenCL C 3.0 or newer and the __opencl_c_atomic_scope_all_devices feature.

  • Using memory_scope_all_devices requires support for OpenCL C 3.0 or newer and the __opencl_c_atomic_scope_all_devices feature.

See Also

Document Notes

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.

Copyright 2014-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0