[PATCH] D108392: [OpenCL] Fix parsing of opencl-c.h in CL 3.0 with device-scope atomics enabled
Kévin Petit via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 19 10:32:29 PDT 2021
kpet created this revision.
kpet added a reviewer: Anastasia.
Herald added subscribers: ldrumm, jfb, kristof.beyls, yaxunl.
kpet requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Also declare and test the __opencl_c_atomic_scope_device and
__opencl_c_atomic_scope_all_devices features. The header is testing for them
but they were never defined by Clang.
With the new features declared, test/Headers/opencl-c-header.cl does
exercise the declaration this change fixes.
Signed-off-by: Kevin Petit <kevin.petit at arm.com>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D108392
Files:
clang/include/clang/Basic/OpenCLExtensions.def
clang/lib/Headers/opencl-c.h
clang/test/SemaOpenCL/features.cl
Index: clang/test/SemaOpenCL/features.cl
===================================================================
--- clang/test/SemaOpenCL/features.cl
+++ clang/test/SemaOpenCL/features.cl
@@ -24,6 +24,8 @@
// FEATURES: #define __opencl_c_3d_image_writes 1
// FEATURES: #define __opencl_c_atomic_order_acq_rel 1
// FEATURES: #define __opencl_c_atomic_order_seq_cst 1
+// FEATURES: #define __opencl_c_atomic_scope_all_devices 1
+// FEATURES: #define __opencl_c_atomic_scope_device 1
// FEATURES: #define __opencl_c_device_enqueue 1
// FEATURES: #define __opencl_c_fp64 1
// FEATURES: #define __opencl_c_generic_address_space 1
@@ -38,6 +40,8 @@
// NO-FEATURES-NOT: __opencl_c_3d_image_writes
// NO-FEATURES-NOT: __opencl_c_atomic_order_acq_rel
// NO-FEATURES-NOT: __opencl_c_atomic_order_seq_cst
+// NO-FEATURES-NOT: __opencl_c_atomic_scope_all_devices
+// NO-FEATURES-NOT: __opencl_c_atomic_scope_device
// NO-FEATURES-NOT: __opencl_c_device_enqueue
// NO-FEATURES-NOT: __opencl_c_fp64
// NO-FEATURES-NOT: __opencl_c_generic_address_space
Index: clang/lib/Headers/opencl-c.h
===================================================================
--- clang/lib/Headers/opencl-c.h
+++ clang/lib/Headers/opencl-c.h
@@ -13378,7 +13378,7 @@
int __ovld atomic_fetch_xor(volatile __global atomic_int *object, int operand);
int __ovld atomic_fetch_xor(volatile __local atomic_int *object, int operand);
uint __ovld atomic_fetch_xor(volatile __global atomic_uint *object, uint operand);
-uint __ovld atomic_fetch_xor(volatile __local atomic_uint *object, uint operand);i
+uint __ovld atomic_fetch_xor(volatile __local atomic_uint *object, uint operand);
int __ovld atomic_fetch_and(volatile __global atomic_int *object, int operand);
int __ovld atomic_fetch_and(volatile __local atomic_int *object, int operand);
uint __ovld atomic_fetch_and(volatile __global atomic_uint *object, uint operand);
Index: clang/include/clang/Basic/OpenCLExtensions.def
===================================================================
--- clang/include/clang/Basic/OpenCLExtensions.def
+++ clang/include/clang/Basic/OpenCLExtensions.def
@@ -110,6 +110,8 @@
OPENCL_OPTIONALCOREFEATURE(__opencl_c_generic_address_space, false, 300, OCL_C_30)
OPENCL_OPTIONALCOREFEATURE(__opencl_c_atomic_order_acq_rel, false, 300, OCL_C_30)
OPENCL_OPTIONALCOREFEATURE(__opencl_c_atomic_order_seq_cst, false, 300, OCL_C_30)
+OPENCL_OPTIONALCOREFEATURE(__opencl_c_atomic_scope_device, false, 300, OCL_C_30)
+OPENCL_OPTIONALCOREFEATURE(__opencl_c_atomic_scope_all_devices, false, 300, OCL_C_30)
OPENCL_OPTIONALCOREFEATURE(__opencl_c_subgroups, false, 300, OCL_C_30)
OPENCL_OPTIONALCOREFEATURE(__opencl_c_3d_image_writes, false, 300, OCL_C_30)
OPENCL_OPTIONALCOREFEATURE(__opencl_c_device_enqueue, false, 300, OCL_C_30)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108392.367545.patch
Type: text/x-patch
Size: 2788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210819/fb144de9/attachment-0001.bin>
More information about the cfe-commits
mailing list