Skip to content

Commit ef5ad17

Browse files
authored
Update cl_ext_float_atomics patch (#314)
Guard atomic_double with cl_khr_int64_base_atomics and cl_khr_int64_extended_atomics.
1 parent 439a5c4 commit ef5ad17

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

patches/clang/0003-OpenCL-Support-cl_ext_float_atomics.patch

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
From d1b4758460cfd04d35ae332033a8d18614e6a7ff Mon Sep 17 00:00:00 2001
1+
From 85505bdb386a426310c1fb0a845780beeeec4353 Mon Sep 17 00:00:00 2001
22
From: haonanya <[email protected]>
3-
Date: Wed, 28 Jul 2021 14:20:08 +0800
3+
Date: Wed, 9 Feb 2022 09:16:35 +0800
44
Subject: [PATCH] Support cl_ext_float_atomics
55

66
This backports https://reviews.llvm.org/D106343 and https://reviews.llvm.org/D109740
77

88
Signed-off-by: haonanya <[email protected]>
99
---
1010
clang/lib/Headers/opencl-c-base.h | 19 ++
11-
clang/lib/Headers/opencl-c.h | 372 ++++++++++++++++++++++++++
11+
clang/lib/Headers/opencl-c.h | 378 ++++++++++++++++++++++++++
1212
clang/lib/Sema/Sema.cpp | 3 +
1313
clang/test/Headers/opencl-c-header.cl | 84 ++++++
14-
4 files changed, 478 insertions(+)
14+
4 files changed, 484 insertions(+)
1515

1616
diff --git a/clang/lib/Headers/opencl-c-base.h b/clang/lib/Headers/opencl-c-base.h
1717
index e8dcd70377e5..d94d64372dbb 100644
@@ -44,10 +44,10 @@ index e8dcd70377e5..d94d64372dbb 100644
4444
#endif // (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
4545

4646
diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
47-
index ab665628c8e1..63a5155fe221 100644
47+
index ab665628c8e1..584db7e81e04 100644
4848
--- a/clang/lib/Headers/opencl-c.h
4949
+++ b/clang/lib/Headers/opencl-c.h
50-
@@ -13531,6 +13531,378 @@ intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object, uint
50+
@@ -13531,6 +13531,384 @@ intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object, uint
5151
intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder, memory_scope scope);
5252
#endif
5353

@@ -217,6 +217,7 @@ index ab665628c8e1..63a5155fe221 100644
217217
+#endif // defined(__opencl_c_ext_fp32_global_atomic_min_max) && \
218218
+ defined(__opencl_c_ext_fp32_local_atomic_min_max)
219219
+
220+
+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
220221
+#if defined(__opencl_c_ext_fp64_global_atomic_min_max)
221222
+double __ovld atomic_fetch_min(volatile __global atomic_double *object,
222223
+ double operand);
@@ -267,6 +268,8 @@ index ab665628c8e1..63a5155fe221 100644
267268
+ memory_scope scope);
268269
+#endif // defined(__opencl_c_ext_fp64_global_atomic_min_max) && \
269270
+ defined(__opencl_c_ext_fp64_local_atomic_min_max)
271+
+#endif // defined(cl_khr_int64_base_atomics) &&
272+
+ // defined(cl_khr_int64_extended_atomics)
270273
+
271274
+#if defined(__opencl_c_ext_fp16_global_atomic_add)
272275
+half __ovld atomic_fetch_add(volatile __global atomic_half *object,
@@ -370,6 +373,7 @@ index ab665628c8e1..63a5155fe221 100644
370373
+#endif // defined(__opencl_c_ext_fp32_global_atomic_add) && \
371374
+ defined(__opencl_c_ext_fp32_local_atomic_add)
372375
+
376+
+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
373377
+#if defined(__opencl_c_ext_fp64_global_atomic_add)
374378
+double __ovld atomic_fetch_add(volatile __global atomic_double *object,
375379
+ double operand);
@@ -420,6 +424,8 @@ index ab665628c8e1..63a5155fe221 100644
420424
+ memory_scope scope);
421425
+#endif // defined(__opencl_c_ext_fp64_global_atomic_add) && \
422426
+ defined(__opencl_c_ext_fp64_local_atomic_add)
427+
+#endif // defined(cl_khr_int64_base_atomics) &&
428+
+ // defined(cl_khr_int64_extended_atomics)
423429
+
424430
+#endif // cl_ext_float_atomics
425431
+
@@ -543,5 +549,5 @@ index 13a3b62481ec..443f682c711a 100644
543549
#endif //(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
544550

545551
--
546-
2.17.1
552+
2.29.2
547553

0 commit comments

Comments
 (0)