1
- From 8f96458a1de6a0abe505b5046e67c013944ceefe Mon Sep 17 00:00:00 2001
1
+ From d25354346c7302b8c9a26a39eae7474311dec7ea Mon Sep 17 00:00:00 2001
2
2
From: haonanya <
[email protected] >
3
- Date: Fri, 13 Aug 2021 09:47:24 +0800
3
+ Date: Wed, 9 Feb 2022 09:05:23 +0800
4
4
Subject: [PATCH] support cl_ext_float_atomics
5
5
6
6
This backports https://reviews.llvm.org/D106343 and https://reviews.llvm.org/D109740
7
7
8
8
Signed-off-by: haonanya <
[email protected] >
9
9
---
10
10
clang/lib/Headers/opencl-c-base.h | 22 ++
11
- clang/lib/Headers/opencl-c.h | 372 ++++++++++++++++++++++++++
11
+ clang/lib/Headers/opencl-c.h | 378 ++++++++++++++++++++++++++
12
12
clang/lib/Sema/Sema.cpp | 3 +
13
- clang/test/Headers/opencl-c-header.cl | 97 +++++++
14
- 4 files changed, 494 insertions(+)
13
+ clang/test/Headers/opencl-c-header.cl | 96 +++++++
14
+ 4 files changed, 499 insertions(+)
15
15
16
16
diff --git a/clang/lib/Headers/opencl-c-base.h b/clang/lib/Headers/opencl-c-base.h
17
17
index 0b27e4010eae..5ed94e1b486b 100644
@@ -47,10 +47,10 @@ index 0b27e4010eae..5ed94e1b486b 100644
47
47
#ifndef __opencl_c_int64
48
48
#define __opencl_c_int64 1
49
49
diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
50
- index 4eea04ef062b..a5bbedc4ecc5 100644
50
+ index 4eea04ef062b..d36231ae33b6 100644
51
51
--- a/clang/lib/Headers/opencl-c.h
52
52
+++ 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(
54
54
// defined(cl_khr_int64_extended_atomics)
55
55
#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
56
56
@@ -220,6 +220,7 @@ index 4eea04ef062b..a5bbedc4ecc5 100644
220
220
+ #endif // defined(__opencl_c_ext_fp32_global_atomic_min_max) && \
221
221
+ defined(__opencl_c_ext_fp32_local_atomic_min_max)
222
222
+
223
+ + #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
223
224
+ #if defined(__opencl_c_ext_fp64_global_atomic_min_max)
224
225
+ double __ovld atomic_fetch_min(volatile __global atomic_double *object,
225
226
+ double operand);
@@ -270,6 +271,8 @@ index 4eea04ef062b..a5bbedc4ecc5 100644
270
271
+ memory_scope scope);
271
272
+ #endif // defined(__opencl_c_ext_fp64_global_atomic_min_max) && \
272
273
+ defined(__opencl_c_ext_fp64_local_atomic_min_max)
274
+ + #endif // defined(cl_khr_int64_base_atomics) &&
275
+ + // defined(cl_khr_int64_extended_atomics)
273
276
+
274
277
+ #if defined(__opencl_c_ext_fp16_global_atomic_add)
275
278
+ half __ovld atomic_fetch_add(volatile __global atomic_half *object,
@@ -373,6 +376,7 @@ index 4eea04ef062b..a5bbedc4ecc5 100644
373
376
+ #endif // defined(__opencl_c_ext_fp32_global_atomic_add) && \
374
377
+ defined(__opencl_c_ext_fp32_local_atomic_add)
375
378
+
379
+ + #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
376
380
+ #if defined(__opencl_c_ext_fp64_global_atomic_add)
377
381
+ double __ovld atomic_fetch_add(volatile __global atomic_double *object,
378
382
+ double operand);
@@ -423,6 +427,8 @@ index 4eea04ef062b..a5bbedc4ecc5 100644
423
427
+ memory_scope scope);
424
428
+ #endif // defined(__opencl_c_ext_fp64_global_atomic_add) && \
425
429
+ defined(__opencl_c_ext_fp64_local_atomic_add)
430
+ + #endif // defined(cl_khr_int64_base_atomics) &&
431
+ + // defined(cl_khr_int64_extended_atomics)
426
432
+
427
433
+ #endif // cl_ext_float_atomics
428
434
+
@@ -444,10 +450,10 @@ index f5d193c86f87..92b9f8e16e9a 100644
444
450
Context.getAtomicType(Context.FloatTy));
445
451
auto AtomicDoubleT = Context.getAtomicType(Context.DoubleTy);
446
452
diff --git a/clang/test/Headers/opencl-c-header.cl b/clang/test/Headers/opencl-c-header.cl
447
- index 2716076acdcf..ab25574eec8e 100644
453
+ index 2716076acdcf..7f720cf28142 100644
448
454
--- a/clang/test/Headers/opencl-c-header.cl
449
455
+++ b/clang/test/Headers/opencl-c-header.cl
450
- @@ -98,3 +98,100 @@ global atomic_int z = ATOMIC_VAR_INIT(99);
456
+ @@ -98,3 +98,99 @@ global atomic_int z = ATOMIC_VAR_INIT(99);
451
457
#pragma OPENCL EXTENSION cl_intel_planar_yuv : enable
452
458
453
459
// CHECK-MOD: Reading modules
@@ -547,7 +553,6 @@ index 2716076acdcf..ab25574eec8e 100644
547
553
+ #endif //(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
548
554
+
549
555
+ #endif // defined(__SPIR__)
550
- +
551
556
- -
552
- 2.17.1
557
+ 2.29.2
553
558
0 commit comments