[PATCH] D108392: [OpenCL] Fix parsing of opencl-c.h in CL 3.0 with device-scope atomics enabled

2021-11-04 Thread Anton Zabaznov via Phabricator via cfe-commits
azabaznov added inline comments.



Comment at: clang/include/clang/Basic/OpenCLExtensions.def:114
+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)

Oops, sorry I missed that. @Anastasia, I think this one is header only. We 
discussed that here: https://reviews.llvm.org/D103241. We should either extend 
//-cl-ext// for unknown features (finally) or use it //as 
-D__opencl_c_atomic_scope_all_devices //


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108392/new/

https://reviews.llvm.org/D108392

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108392: [OpenCL] Fix parsing of opencl-c.h in CL 3.0 with device-scope atomics enabled

2021-11-04 Thread Kévin Petit via Phabricator via cfe-commits
kpet added inline comments.



Comment at: clang/lib/Headers/opencl-c.h:13381
 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
 int __ovld atomic_fetch_and(volatile __global atomic_int *object, int operand);

Anastasia wrote:
> This is a fairly trivial fix. You can just commit it straight away if you 
> like. :)
I've committed the fix alone as b8b6a5bc86f570a6fb94b88b8c9d634c3af71eca.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108392/new/

https://reviews.llvm.org/D108392

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108392: [OpenCL] Fix parsing of opencl-c.h in CL 3.0 with device-scope atomics enabled

2021-08-25 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a subscriber: azabaznov.
Anastasia added inline comments.



Comment at: clang/include/clang/Basic/OpenCLExtensions.def:113
 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)

Do we need to add anything to clang for those features? If not they should just 
go into the headers, see guidelines 
https://clang.llvm.org/docs/OpenCLSupport.html#implementation-guidelines

CC @azabaznov 



Comment at: clang/lib/Headers/opencl-c.h:13381
 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
 int __ovld atomic_fetch_and(volatile __global atomic_int *object, int operand);

This is a fairly trivial fix. You can just commit it straight away if you like. 
:)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108392/new/

https://reviews.llvm.org/D108392

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108392: [OpenCL] Fix parsing of opencl-c.h in CL 3.0 with device-scope atomics enabled

2021-08-19 Thread Kévin Petit via Phabricator via cfe-commits
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 


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)


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