Skip to content

Commit 518d7f4

Browse files
authored
Update cl_ext_float_atomics patch (#313)
Guard atomic_double with cl_khr_int64_base_atomics and cl_khr_int64_extended_atomics.
1 parent 68f866a commit 518d7f4

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

patches/clang/0005-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 389fc0f80da472af9746d3b34e77ad8c7ee2f70e Mon Sep 17 00:00:00 2001
1+
From 675413e70657ab393a097c70fd7f2b4423d2983b Mon Sep 17 00:00:00 2001
22
From: haonanya <[email protected]>
3-
Date: Fri, 13 Aug 2021 10:00:02 +0800
3+
Date: Wed, 9 Feb 2022 08:53:06 +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 | 22 ++
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 | 96 +++++++
14-
4 files changed, 493 insertions(+)
14+
4 files changed, 499 insertions(+)
1515

1616
diff --git a/clang/lib/Headers/opencl-c-base.h b/clang/lib/Headers/opencl-c-base.h
1717
index 2cc688ccc3da..18d367de68ec 100644
@@ -47,10 +47,10 @@ index 2cc688ccc3da..18d367de68ec 100644
4747
#ifndef __opencl_c_int64
4848
#define __opencl_c_int64 1
4949
diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
50-
index d8173f0aa843..be39b1ca8c78 100644
50+
index d8173f0aa843..efeaea950715 100644
5151
--- a/clang/lib/Headers/opencl-c.h
5252
+++ b/clang/lib/Headers/opencl-c.h
53-
@@ -14354,6 +14354,378 @@ intptr_t __ovld atomic_fetch_max_explicit(
53+
@@ -14354,6 +14354,384 @@ intptr_t __ovld atomic_fetch_max_explicit(
5454
// defined(cl_khr_int64_extended_atomics)
5555
#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5656

@@ -220,6 +220,7 @@ index d8173f0aa843..be39b1ca8c78 100644
220220
+#endif // defined(__opencl_c_ext_fp32_global_atomic_min_max) && \
221221
+ defined(__opencl_c_ext_fp32_local_atomic_min_max)
222222
+
223+
+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
223224
+#if defined(__opencl_c_ext_fp64_global_atomic_min_max)
224225
+double __ovld atomic_fetch_min(volatile __global atomic_double *object,
225226
+ double operand);
@@ -270,6 +271,8 @@ index d8173f0aa843..be39b1ca8c78 100644
270271
+ memory_scope scope);
271272
+#endif // defined(__opencl_c_ext_fp64_global_atomic_min_max) && \
272273
+ defined(__opencl_c_ext_fp64_local_atomic_min_max)
274+
+#endif // defined(cl_khr_int64_base_atomics) &&
275+
+ // defined(cl_khr_int64_extended_atomics)
273276
+
274277
+#if defined(__opencl_c_ext_fp16_global_atomic_add)
275278
+half __ovld atomic_fetch_add(volatile __global atomic_half *object,
@@ -373,6 +376,7 @@ index d8173f0aa843..be39b1ca8c78 100644
373376
+#endif // defined(__opencl_c_ext_fp32_global_atomic_add) && \
374377
+ defined(__opencl_c_ext_fp32_local_atomic_add)
375378
+
379+
+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
376380
+#if defined(__opencl_c_ext_fp64_global_atomic_add)
377381
+double __ovld atomic_fetch_add(volatile __global atomic_double *object,
378382
+ double operand);
@@ -423,6 +427,8 @@ index d8173f0aa843..be39b1ca8c78 100644
423427
+ memory_scope scope);
424428
+#endif // defined(__opencl_c_ext_fp64_global_atomic_add) && \
425429
+ defined(__opencl_c_ext_fp64_local_atomic_add)
430+
+#endif // defined(cl_khr_int64_base_atomics) &&
431+
+ // defined(cl_khr_int64_extended_atomics)
426432
+
427433
+#endif // cl_ext_float_atomics
428434
+
@@ -548,5 +554,5 @@ index 2716076acdcf..7f720cf28142 100644
548554
+
549555
+#endif // defined(__SPIR__)
550556
--
551-
2.17.1
557+
2.29.2
552558

0 commit comments

Comments
 (0)