Skip to content

Update cl_ext_float_atomics patch #313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions patches/clang/0005-OpenCL-support-cl_ext_float_atomics.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From 389fc0f80da472af9746d3b34e77ad8c7ee2f70e Mon Sep 17 00:00:00 2001
From 675413e70657ab393a097c70fd7f2b4423d2983b Mon Sep 17 00:00:00 2001
From: haonanya <[email protected]>
Date: Fri, 13 Aug 2021 10:00:02 +0800
Date: Wed, 9 Feb 2022 08:53:06 +0800
Subject: [PATCH] support cl_ext_float_atomics

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

Signed-off-by: haonanya <[email protected]>
---
clang/lib/Headers/opencl-c-base.h | 22 ++
clang/lib/Headers/opencl-c.h | 372 ++++++++++++++++++++++++++
clang/lib/Headers/opencl-c.h | 378 ++++++++++++++++++++++++++
clang/lib/Sema/Sema.cpp | 3 +
clang/test/Headers/opencl-c-header.cl | 96 +++++++
4 files changed, 493 insertions(+)
4 files changed, 499 insertions(+)

diff --git a/clang/lib/Headers/opencl-c-base.h b/clang/lib/Headers/opencl-c-base.h
index 2cc688ccc3da..18d367de68ec 100644
Expand Down Expand Up @@ -47,10 +47,10 @@ index 2cc688ccc3da..18d367de68ec 100644
#ifndef __opencl_c_int64
#define __opencl_c_int64 1
diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
index d8173f0aa843..be39b1ca8c78 100644
index d8173f0aa843..efeaea950715 100644
--- a/clang/lib/Headers/opencl-c.h
+++ b/clang/lib/Headers/opencl-c.h
@@ -14354,6 +14354,378 @@ intptr_t __ovld atomic_fetch_max_explicit(
@@ -14354,6 +14354,384 @@ intptr_t __ovld atomic_fetch_max_explicit(
// defined(cl_khr_int64_extended_atomics)
#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)

Expand Down Expand Up @@ -220,6 +220,7 @@ index d8173f0aa843..be39b1ca8c78 100644
+#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);
Expand Down Expand Up @@ -270,6 +271,8 @@ index d8173f0aa843..be39b1ca8c78 100644
+ 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,
Expand Down Expand Up @@ -373,6 +376,7 @@ index d8173f0aa843..be39b1ca8c78 100644
+#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);
Expand Down Expand Up @@ -423,6 +427,8 @@ index d8173f0aa843..be39b1ca8c78 100644
+ 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
+
Expand Down Expand Up @@ -548,5 +554,5 @@ index 2716076acdcf..7f720cf28142 100644
+
+#endif // defined(__SPIR__)
--
2.17.1
2.29.2