Skip to content

Commit 1e348e6

Browse files
svenvhtstellar
authored andcommitted
[OpenCL] Guard atomic_double with cl_khr_int64_*
It is necessary to guard atomic_double type according to https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_C.html#_footnotedef_54. Platform that disable cl_khr_int64_base_atomics and cl_khr_int64_extended_atomics will have compiling errors even if atomic_double is not used. Patch by Haonan Yang. Differential Revision: https://reviews.llvm.org/D119398 (cherry picked from commit 477bc8e)
1 parent 880717c commit 1e348e6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

clang/lib/Headers/opencl-c.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13832,6 +13832,7 @@ float __ovld atomic_fetch_max_explicit(volatile atomic_float *object,
1383213832
#endif // defined(__opencl_c_ext_fp32_global_atomic_min_max) && \
1383313833
defined(__opencl_c_ext_fp32_local_atomic_min_max)
1383413834

13835+
#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
1383513836
#if defined(__opencl_c_ext_fp64_global_atomic_min_max)
1383613837
double __ovld atomic_fetch_min(volatile __global atomic_double *object,
1383713838
double operand);
@@ -13882,6 +13883,8 @@ double __ovld atomic_fetch_max_explicit(volatile atomic_double *object,
1388213883
memory_scope scope);
1388313884
#endif // defined(__opencl_c_ext_fp64_global_atomic_min_max) && \
1388413885
defined(__opencl_c_ext_fp64_local_atomic_min_max)
13886+
#endif // defined(cl_khr_int64_base_atomics) && \
13887+
defined(cl_khr_int64_extended_atomics)
1388513888

1388613889
#if defined(__opencl_c_ext_fp16_global_atomic_add)
1388713890
half __ovld atomic_fetch_add(volatile __global atomic_half *object,
@@ -13985,6 +13988,7 @@ float __ovld atomic_fetch_sub_explicit(volatile atomic_float *object,
1398513988
#endif // defined(__opencl_c_ext_fp32_global_atomic_add) && \
1398613989
defined(__opencl_c_ext_fp32_local_atomic_add)
1398713990

13991+
#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
1398813992
#if defined(__opencl_c_ext_fp64_global_atomic_add)
1398913993
double __ovld atomic_fetch_add(volatile __global atomic_double *object,
1399013994
double operand);
@@ -14035,6 +14039,8 @@ double __ovld atomic_fetch_sub_explicit(volatile atomic_double *object,
1403514039
memory_scope scope);
1403614040
#endif // defined(__opencl_c_ext_fp64_global_atomic_add) && \
1403714041
defined(__opencl_c_ext_fp64_local_atomic_add)
14042+
#endif // defined(cl_khr_int64_base_atomics) && \
14043+
defined(cl_khr_int64_extended_atomics)
1403814044

1403914045
#endif // cl_ext_float_atomics
1404014046

0 commit comments

Comments
 (0)