Skip to content

Commit 6d131d0

Browse files
committed
header changes for OpenCL 3.1
1 parent e551385 commit 6d131d0

6 files changed

Lines changed: 97 additions & 11 deletions

File tree

CL/cl.h

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ typedef cl_uint cl_khronos_vendor_id;
121121
typedef cl_properties cl_mem_properties;
122122
#endif
123123
typedef cl_uint cl_version;
124+
#ifdef CL_VERSION_3_1
125+
typedef cl_bitfield cl_device_integer_dot_product_capabilities;
126+
#endif
124127

125128
typedef struct _cl_image_format {
126129
cl_channel_order image_channel_order;
@@ -171,6 +174,19 @@ typedef struct _cl_name_version {
171174

172175
#endif
173176

177+
#ifdef CL_VERSION_3_1
178+
179+
typedef struct _cl_device_integer_dot_product_acceleration_properties {
180+
cl_bool signed_accelerated;
181+
cl_bool unsigned_accelerated;
182+
cl_bool mixed_signedness_accelerated;
183+
cl_bool accumulating_saturating_signed_accelerated;
184+
cl_bool accumulating_saturating_unsigned_accelerated;
185+
cl_bool accumulating_saturating_mixed_signedness_accelerated;
186+
} cl_device_integer_dot_product_acceleration_properties;
187+
188+
#endif
189+
174190
/******************************************************************************/
175191

176192
/* Error Codes */
@@ -290,7 +306,10 @@ typedef struct _cl_name_version {
290306
#define CL_DEVICE_MAX_COMPUTE_UNITS 0x1002
291307
#define CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS 0x1003
292308
#define CL_DEVICE_MAX_WORK_GROUP_SIZE 0x1004
293-
#define CL_DEVICE_MAX_WORK_ITEM_SIZES 0x1005
309+
#define CL_DEVICE_MAX_WORK_ITEM_SIZES 0x1005 /* deprecated */
310+
#ifdef CL_VERSION_3_1
311+
#define CL_DEVICE_MAX_WORK_GROUP_SIZES 0x1005
312+
#endif
294313
#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR 0x1006
295314
#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT 0x1007
296315
#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT 0x1008
@@ -344,7 +363,7 @@ typedef struct _cl_name_version {
344363
/* 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG which is already defined in "cl_ext.h" */
345364
#ifdef CL_VERSION_1_1
346365
#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF 0x1034
347-
#define CL_DEVICE_HOST_UNIFIED_MEMORY 0x1035 /* deprecated */
366+
#define CL_DEVICE_HOST_UNIFIED_MEMORY 0x1035
348367
#define CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR 0x1036
349368
#define CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT 0x1037
350369
#define CL_DEVICE_NATIVE_VECTOR_WIDTH_INT 0x1038
@@ -404,12 +423,28 @@ typedef struct _cl_name_version {
404423
#define CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_MULTIPLE 0x1067
405424
#define CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT 0x1068
406425
#define CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT 0x1069
407-
/* 0x106A to 0x106E - Reserved for upcoming KHR extension */
426+
#endif
427+
#ifdef CL_VERSION_3_1
428+
#define CL_DEVICE_UUID 0x106A
429+
#define CL_DRIVER_UUID 0x106B
430+
#define CL_DEVICE_LUID_VALID 0x106C
431+
#define CL_DEVICE_LUID 0x106D
432+
#define CL_DEVICE_NODE_MASK 0x106E
433+
#endif
434+
#ifdef CL_VERSION_3_0
408435
#define CL_DEVICE_OPENCL_C_FEATURES 0x106F
409436
#define CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES 0x1070
410437
#define CL_DEVICE_PIPE_SUPPORT 0x1071
411438
#define CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED 0x1072
412439
#endif
440+
#ifdef CL_VERSION_3_1
441+
#define CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIES 0x1073
442+
#define CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT 0x1074
443+
#define CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_4x8BIT_PACKED 0x1075
444+
#define CL_DEVICE_SPIRV_EXTENDED_INSTRUCTION_SETS 0x12B9
445+
#define CL_DEVICE_SPIRV_EXTENSIONS 0x12BA
446+
#define CL_DEVICE_SPIRV_CAPABILITIES 0x12BB
447+
#endif
413448

414449
/* cl_device_fp_config - bitfield */
415450
#define CL_FP_DENORM (1 << 0)
@@ -918,6 +953,18 @@ typedef struct _cl_name_version {
918953
(((minor) & CL_VERSION_MINOR_MASK) << CL_VERSION_PATCH_BITS) | \
919954
((patch) & CL_VERSION_PATCH_MASK))
920955

956+
#ifdef CL_VERSION_3_1
957+
958+
/* Size Constants */
959+
#define CL_UUID_SIZE 16
960+
#define CL_LUID_SIZE 8
961+
962+
/* cl_device_integer_dot_product_capabilities - bitfield */
963+
#define CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED (1 << 0)
964+
#define CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT (1 << 1)
965+
966+
#endif
967+
921968
/********************************************************************************************************/
922969

923970
/* CL_NO_PROTOTYPES implies CL_NO_CORE_PROTOTYPES: */
@@ -1812,6 +1859,18 @@ clEnqueueSVMMigrateMem(cl_command_queue command_queue,
18121859

18131860
#endif
18141861

1862+
#ifdef CL_VERSION_3_1
1863+
1864+
extern CL_API_ENTRY cl_int CL_API_CALL
1865+
clGetKernelSuggestedLocalWorkSize(cl_command_queue command_queue,
1866+
cl_kernel kernel,
1867+
cl_uint work_dim,
1868+
const size_t * global_work_offset,
1869+
const size_t * global_work_size,
1870+
size_t * suggested_local_work_size) CL_API_SUFFIX__VERSION_3_1;
1871+
1872+
#endif
1873+
18151874
#ifdef CL_VERSION_1_2
18161875

18171876
/* Extension function access

CL/cl_function_types.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,4 +1181,19 @@ clCreateImageWithProperties_fn CL_API_SUFFIX__VERSION_3_0;
11811181

11821182
#endif /* CL_VERSION_3_0 */
11831183

1184+
#ifdef CL_VERSION_3_1
1185+
1186+
typedef cl_int CL_API_CALL clGetKernelSuggestedLocalWorkSize_t(
1187+
cl_command_queue command_queue,
1188+
cl_kernel kernel,
1189+
cl_uint work_dim,
1190+
const size_t* global_work_offset,
1191+
const size_t* global_work_size,
1192+
size_t* suggested_local_work_size) CL_API_SUFFIX__VERSION_3_1;
1193+
1194+
typedef clGetKernelSuggestedLocalWorkSize_t *
1195+
clGetKernelSuggestedLocalWorkSize_fn CL_API_SUFFIX__VERSION_3_1;
1196+
1197+
#endif /* CL_VERSION_3_1 */
1198+
11841199
#endif /* OPENCL_CL_FUNCTION_TYPES_H_ */

CL/cl_icd.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,13 @@ typedef struct _cl_icd_dispatch {
329329
void *clSetContextDestructorCallback;
330330
#endif
331331

332+
/* OpenCL 3.1 */
333+
#ifdef CL_VERSION_3_1
334+
clGetKernelSuggestedLocalWorkSize_t *clGetKernelSuggestedLocalWorkSize;
335+
#else
336+
void *clGetKernelSuggestedLocalWorkSize;
337+
#endif
338+
332339
} cl_icd_dispatch;
333340

334341
#ifdef __cplusplus

CL/cl_platform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ extern "C" {
6767
#define CL_API_SUFFIX__VERSION_2_1 CL_API_SUFFIX_COMMON
6868
#define CL_API_SUFFIX__VERSION_2_2 CL_API_SUFFIX_COMMON
6969
#define CL_API_SUFFIX__VERSION_3_0 CL_API_SUFFIX_COMMON
70+
#define CL_API_SUFFIX__VERSION_3_1 CL_API_SUFFIX_COMMON
7071
#define CL_API_SUFFIX__EXPERIMENTAL CL_API_SUFFIX_COMMON
7172

7273

CL/cl_version.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,27 @@
1919

2020
/* Detect which version to target */
2121
#if !defined(CL_TARGET_OPENCL_VERSION)
22-
#pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)")
23-
#define CL_TARGET_OPENCL_VERSION 300
22+
#pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 310 (OpenCL 3.1)")
23+
#define CL_TARGET_OPENCL_VERSION 310
2424
#endif
2525
#if CL_TARGET_OPENCL_VERSION != 100 && \
2626
CL_TARGET_OPENCL_VERSION != 110 && \
2727
CL_TARGET_OPENCL_VERSION != 120 && \
2828
CL_TARGET_OPENCL_VERSION != 200 && \
2929
CL_TARGET_OPENCL_VERSION != 210 && \
3030
CL_TARGET_OPENCL_VERSION != 220 && \
31-
CL_TARGET_OPENCL_VERSION != 300
32-
#pragma message("cl_version: CL_TARGET_OPENCL_VERSION is not a valid value (100, 110, 120, 200, 210, 220, 300). Defaulting to 300 (OpenCL 3.0)")
31+
CL_TARGET_OPENCL_VERSION != 300 && \
32+
CL_TARGET_OPENCL_VERSION != 310
33+
#pragma message("cl_version: CL_TARGET_OPENCL_VERSION is not a valid value (100, 110, 120, 200, 210, 220, 300, 310). Defaulting to 310 (OpenCL 3.1)")
3334
#undef CL_TARGET_OPENCL_VERSION
34-
#define CL_TARGET_OPENCL_VERSION 300
35+
#define CL_TARGET_OPENCL_VERSION 310
3536
#endif
3637

3738

3839
/* OpenCL Version */
40+
#if CL_TARGET_OPENCL_VERSION >= 310 && !defined(CL_VERSION_3_1)
41+
#define CL_VERSION_3_1 1
42+
#endif
3943
#if CL_TARGET_OPENCL_VERSION >= 300 && !defined(CL_VERSION_3_0)
4044
#define CL_VERSION_3_0 1
4145
#endif

tests/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ function(add_header_test NAME SOURCE)
3333
set(SOURCE_PATH "../${SOURCE}")
3434
set(LANG c)
3535
endif()
36-
foreach(VERSION 100 110 120 200 210 220 300)
36+
foreach(VERSION 100 110 120 200 210 220 300 310)
3737
foreach(OPTION "" CL_ENABLE_BETA_EXTENSIONS)
3838
if(OPTION STREQUAL "")
3939
# The empty string means we're not setting any special option.
4040
set(UNDERSCORE_OPTION "${OPTION}")
4141
set(DEFINE_OPTION "")
42-
elseif(VERSION EQUAL 300)
43-
# Only test special options for OpenCL 3.0.
42+
elseif(VERSION GREATER_EQUAL 300)
43+
# Only test special options for OpenCL 3.0 and newer.
4444
set(UNDERSCORE_OPTION "_${OPTION}")
4545
set(DEFINE_OPTION "-D${OPTION}")
4646
else()

0 commit comments

Comments
 (0)