Skip to content

Commit 9cfd7d7

Browse files
authored
Add missing __opencl_c_atomic_scope_device guards (#775)
The OpenCL 3.0 specification states that: functions that do not have memory_scope argument have the same semantics as the corresponding functions with the memory_scope argument set to memory_scope_device. and that memory_scope_device requires: [...] OpenCL C 3.0 or newer and the __opencl_c_atomic_scope_device feature. The fix for issue #357 added the `__opencl_c_atomic_scope_device` feature macro to most atomic builtin functions that do not take a scope argument, but not for the scope-less overloads of atomic_compare_exchange_strong/weak_explicit.
1 parent 3f1f3e2 commit 9cfd7d7

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

OpenCL_C.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7079,7 +7079,8 @@ bool atomic_compare_exchange_strong(
70797079
volatile A *object,
70807080
C *expected, C desired)
70817081

7082-
// Requires OpenCL C 3.0 or newer.
7082+
// Requires OpenCL C 3.0 or newer and the __opencl_c_atomic_scope_device
7083+
// feature.
70837084
bool atomic_compare_exchange_strong_explicit(
70847085
volatile __global A *object,
70857086
__global C *expected,
@@ -7117,8 +7118,9 @@ bool atomic_compare_exchange_strong_explicit(
71177118
memory_order success,
71187119
memory_order failure)
71197120

7120-
// Requires OpenCL C 2.0, or OpenCL C 3.0 or newer and the
7121-
// opencl_c_generic_address_space feature.
7121+
// Requires OpenCL C 2.0, or OpenCL C 3.0 or newer and both the
7122+
// __opencl_c_generic_address_space and
7123+
// __opencl_c_atomic_scope_device features.
71227124
bool atomic_compare_exchange_strong_explicit(
71237125
volatile A *object,
71247126
C *expected,
@@ -7208,7 +7210,8 @@ bool atomic_compare_exchange_weak(
72087210
volatile A *object,
72097211
C *expected, C desired)
72107212

7211-
// Requires OpenCL C 3.0 or newer.
7213+
// Requires OpenCL C 3.0 or newer and the __opencl_c_atomic_scope_device
7214+
// feature.
72127215
bool atomic_compare_exchange_weak_explicit(
72137216
volatile __global A *object,
72147217
__global C *expected,
@@ -7246,8 +7249,9 @@ bool atomic_compare_exchange_weak_explicit(
72467249
memory_order success,
72477250
memory_order failure)
72487251

7249-
// Requires OpenCL C 2.0, or OpenCL C 3.0 or newer and the
7250-
// opencl_c_generic_address_space feature.
7252+
// Requires OpenCL C 2.0, or OpenCL C 3.0 or newer and both the
7253+
// __opencl_c_generic_address_space and
7254+
// __opencl_c_atomic_scope_device features.
72517255
bool atomic_compare_exchange_weak_explicit(
72527256
volatile A *object,
72537257
C *expected,

0 commit comments

Comments
 (0)