[clang] 1854db7 - opencl-c.h: add 3.0 optional extension support for a few more bits
Dave Airlie via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 6 16:25:39 PDT 2021
Author: Dave Airlie
Date: 2021-08-07T09:25:00+10:00
New Revision: 1854db74c549d952c0282096be1bb93d5d64f81b
URL: https://github.com/llvm/llvm-project/commit/1854db74c549d952c0282096be1bb93d5d64f81b
DIFF: https://github.com/llvm/llvm-project/commit/1854db74c549d952c0282096be1bb93d5d64f81b.diff
LOG: opencl-c.h: add 3.0 optional extension support for a few more bits
These 3 are fairly simple, pipes, workgroups and subgroups.
Reviewed By: Anastasia
Differential Revision: https://reviews.llvm.org/D105858
Added:
Modified:
clang/lib/Headers/opencl-c-base.h
clang/lib/Headers/opencl-c.h
Removed:
################################################################################
diff --git a/clang/lib/Headers/opencl-c-base.h b/clang/lib/Headers/opencl-c-base.h
index a9b2364e7457..ff8b776d03bb 100644
--- a/clang/lib/Headers/opencl-c-base.h
+++ b/clang/lib/Headers/opencl-c-base.h
@@ -333,7 +333,13 @@ typedef enum memory_scope {
memory_scope_all_devices = memory_scope_all_svm_devices,
#endif // __OPENCL_C_VERSION__ >= CL_VERSION_3_0
#endif // defined(__opencl_c_atomic_scope_all_devices)
-#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups)
+/**
+ * Subgroups have
diff erent requirements on forward progress, so just test
+ * all the relevant macros.
+ * CL 3.0 sub-groups "they are not guaranteed to make independent forward progress"
+ * KHR subgroups "Subgroups within a workgroup are independent, make forward progress with respect to each other"
+ */
+#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups) || defined(__opencl_c_subgroups)
memory_scope_sub_group = __OPENCL_MEMORY_SCOPE_SUB_GROUP
#endif
} memory_scope;
diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
index e348a092f092..501126bf13ec 100644
--- a/clang/lib/Headers/opencl-c.h
+++ b/clang/lib/Headers/opencl-c.h
@@ -16011,7 +16011,7 @@ int __ovld get_image_num_samples(read_write image2d_array_msaa_depth_t image);
// OpenCL v2.0 s6.13.15 - Work-group Functions
-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
+#if defined(__opencl_c_work_group_collective_functions)
int __ovld __conv work_group_all(int predicate);
int __ovld __conv work_group_any(int predicate);
@@ -16109,12 +16109,12 @@ double __ovld __conv work_group_scan_inclusive_min(double x);
double __ovld __conv work_group_scan_inclusive_max(double x);
#endif //cl_khr_fp64
-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
+#endif //defined(__opencl_c_work_group_collective_functions)
// OpenCL v2.0 s6.13.16 - Pipe Functions
-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
+#if defined(__opencl_c_pipes)
bool __ovld is_valid_reserve_id(reserve_id_t reserve_id);
-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
+#endif //defined(__opencl_c_pipes)
// OpenCL v2.0 s6.13.17 - Enqueue Kernels
@@ -16151,7 +16151,7 @@ queue_t __ovld get_default_queue(void);
// OpenCL Extension v2.0 s9.17 - Sub-groups
-#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups)
+#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups) || defined(__opencl_c_subgroups)
// Shared Sub Group Functions
uint __ovld get_sub_group_size(void);
uint __ovld get_max_sub_group_size(void);
@@ -16250,7 +16250,7 @@ double __ovld __conv sub_group_scan_inclusive_min(double x);
double __ovld __conv sub_group_scan_inclusive_max(double x);
#endif //cl_khr_fp64
-#endif //cl_khr_subgroups cl_intel_subgroups
+#endif //cl_khr_subgroups cl_intel_subgroups __opencl_c_subgroups
#if defined(cl_khr_subgroup_extended_types)
char __ovld __conv sub_group_broadcast( char value, uint index );
More information about the cfe-commits
mailing list