|
| 1 | +From 781b00ae47ac0ea57b62164e57ff426f8121aa1d Mon Sep 17 00:00:00 2001 |
| 2 | +From: Wenju He < [email protected]> |
| 3 | +Date: Sat, 22 Nov 2025 01:58:02 -0800 |
| 4 | +Subject: [PATCH] [OpenCL] Add cl_khr_fp64 guard for atomic_double/double in |
| 5 | + cl_ext_float_atomics functions |
| 6 | + |
| 7 | +Fix downstream compile errors: |
| 8 | +error: unknown type name 'atomic_double' |
| 9 | +error: use of type 'double' requires cl_khr_fp64 support |
| 10 | +--- |
| 11 | + clang/lib/Headers/opencl-c.h | 4 ++++ |
| 12 | + 1 file changed, 4 insertions(+) |
| 13 | + |
| 14 | +diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h |
| 15 | +index f65b4b314cff..39f91c139496 100644 |
| 16 | +--- a/clang/lib/Headers/opencl-c.h |
| 17 | ++++ b/clang/lib/Headers/opencl-c.h |
| 18 | +@@ -13781,6 +13781,7 @@ float __ovld atomic_fetch_max_explicit(volatile atomic_float *, |
| 19 | + defined(__opencl_c_ext_fp32_local_atomic_min_max) |
| 20 | + |
| 21 | + #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) |
| 22 | ++#ifdef cl_khr_fp64 |
| 23 | + #if defined(__opencl_c_ext_fp64_global_atomic_min_max) |
| 24 | + double __ovld atomic_fetch_min(volatile __global atomic_double *, double); |
| 25 | + double __ovld atomic_fetch_max(volatile __global atomic_double *, double); |
| 26 | +@@ -13821,6 +13822,7 @@ double __ovld atomic_fetch_max_explicit(volatile atomic_double *, |
| 27 | + double, memory_order, memory_scope); |
| 28 | + #endif // defined(__opencl_c_ext_fp64_global_atomic_min_max) && \ |
| 29 | + defined(__opencl_c_ext_fp64_local_atomic_min_max) |
| 30 | ++#endif // cl_khr_fp64 |
| 31 | + #endif // defined(cl_khr_int64_base_atomics) && \ |
| 32 | + defined(cl_khr_int64_extended_atomics) |
| 33 | + |
| 34 | +@@ -13907,6 +13909,7 @@ float __ovld atomic_fetch_sub_explicit(volatile atomic_float *, |
| 35 | + defined(__opencl_c_ext_fp32_local_atomic_add) |
| 36 | + |
| 37 | + #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics) |
| 38 | ++#ifdef cl_khr_fp64 |
| 39 | + #if defined(__opencl_c_ext_fp64_global_atomic_add) |
| 40 | + double __ovld atomic_fetch_add(volatile __global atomic_double *, double); |
| 41 | + double __ovld atomic_fetch_sub(volatile __global atomic_double *, double); |
| 42 | +@@ -13947,6 +13950,7 @@ double __ovld atomic_fetch_sub_explicit(volatile atomic_double *, |
| 43 | + double, memory_order, memory_scope); |
| 44 | + #endif // defined(__opencl_c_ext_fp64_global_atomic_add) && \ |
| 45 | + defined(__opencl_c_ext_fp64_local_atomic_add) |
| 46 | ++#endif // cl_khr_fp64 |
| 47 | + #endif // defined(cl_khr_int64_base_atomics) && \ |
| 48 | + defined(cl_khr_int64_extended_atomics) |
| 49 | + |
| 50 | +-- |
| 51 | +2.39.1 |
| 52 | + |
0 commit comments