1- From f07af425fd98841a63e000cd3449a29a4e233ca2 Mon Sep 17 00:00:00 2001
1+ From 13a6dfb3c7f2badbb19cab2d9c4542cab59d9c7c Mon Sep 17 00:00:00 2001
22From: Anton Zabaznov <
[email protected] >
33Date: Tue, 22 Sep 2020 19:03:50 +0300
44Subject: [PATCH] OpenCL 3.0 support
@@ -21,7 +21,7 @@ Subject: [PATCH] OpenCL 3.0 support
2121 clang/lib/CodeGen/CodeGenFunction.cpp | 6 +-
2222 clang/lib/Frontend/CompilerInvocation.cpp | 22 +-
2323 clang/lib/Frontend/InitPreprocessor.cpp | 7 +-
24- clang/lib/Headers/opencl-c-base.h | 15 +-
24+ clang/lib/Headers/opencl-c-base.h | 76 +-
2525 clang/lib/Headers/opencl-c.h | 3215 ++++++++++++++---
2626 clang/lib/Parse/ParseDecl.cpp | 12 +-
2727 clang/lib/Parse/ParsePragma.cpp | 10 +-
@@ -73,7 +73,7 @@ Subject: [PATCH] OpenCL 3.0 support
7373 .../SemaOpenCL/invalid-pipe-builtin-cl2.0.cl | 1 +
7474 clang/test/SemaOpenCL/storageclass-cl20.cl | 1 +
7575 .../TableGen/ClangOpenCLBuiltinEmitter.cpp | 35 +-
76- 69 files changed, 3695 insertions(+), 738 deletions(-)
76+ 69 files changed, 3756 insertions(+), 738 deletions(-)
7777 create mode 100644 clang/test/CodeGenOpenCL/generic-address-space-feature.cl
7878 create mode 100644 clang/test/Sema/feature-extensions-simult-support.cl
7979 create mode 100644 clang/test/Sema/features-ignore-pragma.cl
@@ -825,19 +825,87 @@ index 6eef1e2376f..276c47f2410 100644
825825 #include "clang/Basic/OpenCLExtensions.def"
826826
827827diff --git a/clang/lib/Headers/opencl-c-base.h b/clang/lib/Headers/opencl-c-base.h
828- index 430e07d36f6..972fc7f4575 100644
828+ index 430e07d36f6..b10c6ece744 100644
829829--- a/clang/lib/Headers/opencl-c-base.h
830830+++ b/clang/lib/Headers/opencl-c-base.h
831- @@ -115,7 +115,7 @@ typedef half half4 __attribute__((ext_vector_type(4)));
831+ @@ -9,6 +9,62 @@
832+ #ifndef _OPENCL_BASE_H_
833+ #define _OPENCL_BASE_H_
834+
835+ + // Add predefined macros to build headers with standalone executable
836+ + #ifndef CL_VERSION_3_0
837+ + #define CL_VERSION_3_0 300
838+ + #endif
839+ + #ifndef __OPENCL_MEMORY_SCOPE_ALL_DEVICES
840+ + #define __OPENCL_MEMORY_SCOPE_ALL_DEVICES 5
841+ + #endif
842+ +
843+ + // Define features for 2.0 for header backward compatibility
844+ + #ifndef __opencl_c_int64
845+ + #define __opencl_c_int64 1
846+ + #endif
847+ + #if __OPENCL_C_VERSION__ != CL_VERSION_3_0
848+ + #ifndef __opencl_c_images
849+ + #define __opencl_c_images 1
850+ + #endif
851+ + #endif
852+ + #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
853+ + #ifndef __opencl_c_pipes
854+ + #define __opencl_c_pipes 1
855+ + #endif
856+ + #ifndef __opencl_c_generic_address_space
857+ + #define __opencl_c_generic_address_space 1
858+ + #endif
859+ + #ifndef __opencl_c_work_group_collective_functions
860+ + #define __opencl_c_work_group_collective_functions 1
861+ + #endif
862+ + #ifndef __opencl_c_atomic_order_acq_rel
863+ + #define __opencl_c_atomic_order_acq_rel 1
864+ + #endif
865+ + #ifndef __opencl_c_atomic_order_seq_cst
866+ + #define __opencl_c_atomic_order_seq_cst 1
867+ + #endif
868+ + #ifndef __opencl_c_atomic_scope_device
869+ + #define __opencl_c_atomic_scope_device 1
870+ + #endif
871+ + #ifndef __opencl_c_atomic_scope_all_devices
872+ + #define __opencl_c_atomic_scope_all_devices 1
873+ + #endif
874+ + #ifndef __opencl_c_subgroups
875+ + #define __opencl_c_subgroups 1
876+ + #endif
877+ + #ifndef __opencl_c_3d_image_writes
878+ + #define __opencl_c_3d_image_writes 1
879+ + #endif
880+ + #ifndef __opencl_c_device_enqueue
881+ + #define __opencl_c_device_enqueue 1
882+ + #endif
883+ + #ifndef __opencl_c_read_write_images
884+ + #define __opencl_c_read_write_images 1
885+ + #endif
886+ + #ifndef __opencl_c_program_scope_global_variables
887+ + #define __opencl_c_program_scope_global_variables 1
888+ + #endif
889+ + #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
890+ +
891+ // built-in scalar data types:
892+
893+ /**
894+ @@ -115,7 +171,12 @@ typedef half half4 __attribute__((ext_vector_type(4)));
832895 typedef half half8 __attribute__((ext_vector_type(8)));
833896 typedef half half16 __attribute__((ext_vector_type(16)));
834897 #endif
835898- #ifdef cl_khr_fp64
836899+ #if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
900+ +
901+ + #ifndef __opencl_c_fp64
902+ + #define __opencl_c_fp64 1
903+ + #endif
904+ +
837905 #if __OPENCL_C_VERSION__ < CL_VERSION_1_2
838906 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
839907 #endif
840- @@ -281,9 +281 ,15 @@ typedef uint cl_mem_fence_flags;
908+ @@ -281,9 +342 ,15 @@ typedef uint cl_mem_fence_flags;
841909 typedef enum memory_scope {
842910 memory_scope_work_item = __OPENCL_MEMORY_SCOPE_WORK_ITEM,
843911 memory_scope_work_group = __OPENCL_MEMORY_SCOPE_WORK_GROUP,
@@ -854,7 +922,7 @@ index 430e07d36f6..972fc7f4575 100644
854922 memory_scope_sub_group = __OPENCL_MEMORY_SCOPE_SUB_GROUP
855923 #endif
856924 } memory_scope;
857- @@ -301,13 +307 ,14 @@ typedef enum memory_scope {
925+ @@ -301,13 +368 ,14 @@ typedef enum memory_scope {
858926 #define ATOMIC_FLAG_INIT 0
859927
860928 // enum values aligned with what clang uses in EmitAtomicExpr()
0 commit comments