Author: Sven van Haastregt Date: 2022-02-16T23:30:17-08:00 New Revision: 1e348e6042fcec068dfb56c65339a5a60033d3bd
URL: https://github.com/llvm/llvm-project/commit/1e348e6042fcec068dfb56c65339a5a60033d3bd DIFF: https://github.com/llvm/llvm-project/commit/1e348e6042fcec068dfb56c65339a5a60033d3bd.diff LOG: [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 477bc8e8b9311fdac4c360b1fe7d29d0d10aac6c) Added: Modified: clang/lib/Headers/opencl-c.h Removed: ################################################################################ diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h index 059a2ec2371bd..c7bb77716ac4b 100644 --- a/clang/lib/Headers/opencl-c.h +++ b/clang/lib/Headers/opencl-c.h @@ -13832,6 +13832,7 @@ float __ovld atomic_fetch_max_explicit(volatile atomic_float *object, #endif // defined(__opencl_c_ext_fp32_global_atomic_min_max) && \ defined(__opencl_c_ext_fp32_local_atomic_min_max) +#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) #if defined(__opencl_c_ext_fp64_global_atomic_min_max) double __ovld atomic_fetch_min(volatile __global atomic_double *object, double operand); @@ -13882,6 +13883,8 @@ double __ovld atomic_fetch_max_explicit(volatile atomic_double *object, memory_scope scope); #endif // defined(__opencl_c_ext_fp64_global_atomic_min_max) && \ defined(__opencl_c_ext_fp64_local_atomic_min_max) +#endif // defined(cl_khr_int64_base_atomics) && \ + defined(cl_khr_int64_extended_atomics) #if defined(__opencl_c_ext_fp16_global_atomic_add) half __ovld atomic_fetch_add(volatile __global atomic_half *object, @@ -13985,6 +13988,7 @@ float __ovld atomic_fetch_sub_explicit(volatile atomic_float *object, #endif // defined(__opencl_c_ext_fp32_global_atomic_add) && \ defined(__opencl_c_ext_fp32_local_atomic_add) +#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) #if defined(__opencl_c_ext_fp64_global_atomic_add) double __ovld atomic_fetch_add(volatile __global atomic_double *object, double operand); @@ -14035,6 +14039,8 @@ double __ovld atomic_fetch_sub_explicit(volatile atomic_double *object, memory_scope scope); #endif // defined(__opencl_c_ext_fp64_global_atomic_add) && \ defined(__opencl_c_ext_fp64_local_atomic_add) +#endif // defined(cl_khr_int64_base_atomics) && \ + defined(cl_khr_int64_extended_atomics) #endif // cl_ext_float_atomics _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits