CL: update CL headers to 3.0

This just updates the headers from Khronos.

Change the cl_mem initialisers, not sure what totally correct answer is.

Acked-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7468>
This commit is contained in:
Dave Airlie
2020-10-07 10:19:09 +10:00
parent 041e3147c0
commit 725df7c15d
7 changed files with 672 additions and 164 deletions

View File

@@ -1,29 +1,17 @@
/*******************************************************************************
* Copyright (c) 2008-2019 The Khronos Group Inc.
* Copyright (c) 2008-2020 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and/or associated documentation files (the
* "Materials"), to deal in the Materials without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Materials, and to
* permit persons to whom the Materials are furnished to do so, subject to
* the following conditions:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
* http://www.apache.org/licenses/LICENSE-2.0
*
* MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
* KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
* SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
* https://www.khronos.org/registry/
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
#ifndef __OPENCL_CL_H
@@ -50,6 +38,7 @@ typedef struct _cl_sampler * cl_sampler;
typedef cl_uint cl_bool; /* WARNING! Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */
typedef cl_ulong cl_bitfield;
typedef cl_ulong cl_properties;
typedef cl_bitfield cl_device_type;
typedef cl_uint cl_platform_info;
typedef cl_uint cl_device_info;
@@ -69,7 +58,7 @@ typedef cl_bitfield cl_device_affinity_domain;
typedef intptr_t cl_context_properties;
typedef cl_uint cl_context_info;
#ifdef CL_VERSION_2_0
typedef cl_bitfield cl_queue_properties;
typedef cl_properties cl_queue_properties;
#endif
typedef cl_uint cl_command_queue_info;
typedef cl_uint cl_channel_order;
@@ -116,9 +105,16 @@ typedef cl_uint cl_event_info;
typedef cl_uint cl_command_type;
typedef cl_uint cl_profiling_info;
#ifdef CL_VERSION_2_0
typedef cl_bitfield cl_sampler_properties;
typedef cl_properties cl_sampler_properties;
typedef cl_uint cl_kernel_exec_info;
#endif
#ifdef CL_VERSION_3_0
typedef cl_bitfield cl_device_atomic_capabilities;
typedef cl_bitfield cl_device_device_enqueue_capabilities;
typedef cl_uint cl_khronos_vendor_id;
typedef cl_properties cl_mem_properties;
typedef cl_uint cl_version;
#endif
typedef struct _cl_image_format {
cl_channel_order image_channel_order;
@@ -138,23 +134,29 @@ typedef struct _cl_image_desc {
cl_uint num_mip_levels;
cl_uint num_samples;
#ifdef CL_VERSION_2_0
#ifdef __GNUC__
__extension__ /* Prevents warnings about anonymous union in -pedantic builds */
#endif
#if __CL_HAS_ANON_STRUCT__
#ifdef _MSC_VER
#if _MSC_VER >= 1500
#pragma warning( push )
#pragma warning( disable : 4201 ) /* Prevents warning about nameless struct/union in /W4 /Za builds */
#endif
#endif
__CL_ANON_STRUCT__
union {
#endif
#endif
cl_mem buffer;
#ifdef CL_VERSION_2_0
#if __CL_HAS_ANON_STRUCT__
cl_mem mem_object;
};
#ifdef _MSC_VER
#if _MSC_VER >= 1500
#pragma warning( pop )
#endif
#endif
#endif
#endif
} cl_image_desc;
#endif
@@ -168,6 +170,17 @@ typedef struct _cl_buffer_region {
#endif
#ifdef CL_VERSION_3_0
#define CL_NAME_VERSION_MAX_NAME_SIZE 64
typedef struct _cl_name_version {
cl_version version;
char name[CL_NAME_VERSION_MAX_NAME_SIZE];
} cl_name_version;
#endif
/******************************************************************************/
/* Error Codes */
@@ -266,6 +279,10 @@ typedef struct _cl_buffer_region {
#ifdef CL_VERSION_2_1
#define CL_PLATFORM_HOST_TIMER_RESOLUTION 0x0905
#endif
#ifdef CL_VERSION_3_0
#define CL_PLATFORM_NUMERIC_VERSION 0x0906
#define CL_PLATFORM_EXTENSIONS_WITH_VERSION 0x0907
#endif
/* cl_device_type - bitfield */
#define CL_DEVICE_TYPE_DEFAULT (1 << 0)
@@ -385,6 +402,24 @@ typedef struct _cl_buffer_region {
#define CL_DEVICE_MAX_NUM_SUB_GROUPS 0x105C
#define CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS 0x105D
#endif
#ifdef CL_VERSION_3_0
#define CL_DEVICE_NUMERIC_VERSION 0x105E
#define CL_DEVICE_EXTENSIONS_WITH_VERSION 0x1060
#define CL_DEVICE_ILS_WITH_VERSION 0x1061
#define CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION 0x1062
#define CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES 0x1063
#define CL_DEVICE_ATOMIC_FENCE_CAPABILITIES 0x1064
#define CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT 0x1065
#define CL_DEVICE_OPENCL_C_ALL_VERSIONS 0x1066
#define CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_MULTIPLE 0x1067
#define CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT 0x1068
#define CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT 0x1069
/* 0x106A to 0x106E - Reserved for upcoming KHR extension */
#define CL_DEVICE_OPENCL_C_FEATURES 0x106F
#define CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES 0x1070
#define CL_DEVICE_PIPE_SUPPORT 0x1071
#define CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED 0x1072
#endif
/* cl_device_fp_config - bitfield */
#define CL_FP_DENORM (1 << 0)
@@ -478,6 +513,9 @@ typedef struct _cl_buffer_region {
#ifdef CL_VERSION_2_1
#define CL_QUEUE_DEVICE_DEFAULT 0x1095
#endif
#ifdef CL_VERSION_3_0
#define CL_QUEUE_PROPERTIES_ARRAY 0x1098
#endif
/* cl_mem_flags and cl_svm_mem_flags - bitfield */
#define CL_MEM_READ_WRITE (1 << 0)
@@ -586,6 +624,9 @@ typedef struct _cl_buffer_region {
#ifdef CL_VERSION_2_0
#define CL_MEM_USES_SVM_POINTER 0x1109
#endif
#ifdef CL_VERSION_3_0
#define CL_MEM_PROPERTIES 0x110A
#endif
/* cl_image_info */
#define CL_IMAGE_FORMAT 0x1110
@@ -602,12 +643,14 @@ typedef struct _cl_buffer_region {
#define CL_IMAGE_NUM_SAMPLES 0x111A
#endif
#ifdef CL_VERSION_2_0
/* cl_pipe_info */
#ifdef CL_VERSION_2_0
#define CL_PIPE_PACKET_SIZE 0x1120
#define CL_PIPE_MAX_PACKETS 0x1121
#endif
#ifdef CL_VERSION_3_0
#define CL_PIPE_PROPERTIES 0x1122
#endif
/* cl_addressing_mode */
@@ -637,6 +680,9 @@ typedef struct _cl_buffer_region {
#define CL_SAMPLER_LOD_MIN 0x1156
#define CL_SAMPLER_LOD_MAX 0x1157
#endif
#ifdef CL_VERSION_3_0
#define CL_SAMPLER_PROPERTIES 0x1158
#endif
/* cl_map_flags - bitfield */
#define CL_MAP_READ (1 << 0)
@@ -701,10 +747,6 @@ typedef struct _cl_buffer_region {
#ifdef CL_VERSION_1_2
#define CL_KERNEL_ATTRIBUTES 0x1195
#endif
#ifdef CL_VERSION_2_1
#define CL_KERNEL_MAX_NUM_SUB_GROUPS 0x11B9
#define CL_KERNEL_COMPILE_NUM_SUB_GROUPS 0x11BA
#endif
#ifdef CL_VERSION_1_2
@@ -766,6 +808,8 @@ typedef struct _cl_buffer_region {
#define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE 0x2033
#define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE 0x2034
#define CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT 0x11B8
#define CL_KERNEL_MAX_NUM_SUB_GROUPS 0x11B9
#define CL_KERNEL_COMPILE_NUM_SUB_GROUPS 0x11BA
#endif
@@ -823,6 +867,9 @@ typedef struct _cl_buffer_region {
#define CL_COMMAND_SVM_MAP 0x120C
#define CL_COMMAND_SVM_UNMAP 0x120D
#endif
#ifdef CL_VERSION_3_0
#define CL_COMMAND_SVM_MIGRATE_MEM 0x120E
#endif
/* command execution status */
#define CL_COMPLETE 0x0
@@ -830,11 +877,9 @@ typedef struct _cl_buffer_region {
#define CL_SUBMITTED 0x2
#define CL_QUEUED 0x3
#ifdef CL_VERSION_1_1
/* cl_buffer_create_type */
#ifdef CL_VERSION_1_1
#define CL_BUFFER_CREATE_TYPE_REGION 0x1220
#endif
/* cl_profiling_info */
@@ -846,6 +891,53 @@ typedef struct _cl_buffer_region {
#define CL_PROFILING_COMMAND_COMPLETE 0x1284
#endif
/* cl_device_atomic_capabilities - bitfield */
#ifdef CL_VERSION_3_0
#define CL_DEVICE_ATOMIC_ORDER_RELAXED (1 << 0)
#define CL_DEVICE_ATOMIC_ORDER_ACQ_REL (1 << 1)
#define CL_DEVICE_ATOMIC_ORDER_SEQ_CST (1 << 2)
#define CL_DEVICE_ATOMIC_SCOPE_WORK_ITEM (1 << 3)
#define CL_DEVICE_ATOMIC_SCOPE_WORK_GROUP (1 << 4)
#define CL_DEVICE_ATOMIC_SCOPE_DEVICE (1 << 5)
#define CL_DEVICE_ATOMIC_SCOPE_ALL_DEVICES (1 << 6)
#endif
/* cl_device_device_enqueue_capabilities - bitfield */
#ifdef CL_VERSION_3_0
#define CL_DEVICE_QUEUE_SUPPORTED (1 << 0)
#define CL_DEVICE_QUEUE_REPLACEABLE_DEFAULT (1 << 1)
#endif
/* cl_khronos_vendor_id */
#define CL_KHRONOS_VENDOR_ID_CODEPLAY 0x10004
#ifdef CL_VERSION_3_0
/* cl_version */
#define CL_VERSION_MAJOR_BITS (10)
#define CL_VERSION_MINOR_BITS (10)
#define CL_VERSION_PATCH_BITS (12)
#define CL_VERSION_MAJOR_MASK ((1 << CL_VERSION_MAJOR_BITS) - 1)
#define CL_VERSION_MINOR_MASK ((1 << CL_VERSION_MINOR_BITS) - 1)
#define CL_VERSION_PATCH_MASK ((1 << CL_VERSION_PATCH_BITS) - 1)
#define CL_VERSION_MAJOR(version) \
((version) >> (CL_VERSION_MINOR_BITS + CL_VERSION_PATCH_BITS))
#define CL_VERSION_MINOR(version) \
(((version) >> CL_VERSION_PATCH_BITS) & CL_VERSION_MINOR_MASK)
#define CL_VERSION_PATCH(version) ((version) & CL_VERSION_PATCH_MASK)
#define CL_MAKE_VERSION(major, minor, patch) \
((((major) & CL_VERSION_MAJOR_MASK) \
<< (CL_VERSION_MINOR_BITS + CL_VERSION_PATCH_BITS)) | \
(((minor) & CL_VERSION_MINOR_MASK) << CL_VERSION_PATCH_BITS) | \
((patch) & CL_VERSION_PATCH_MASK))
#endif
/********************************************************************************************************/
/* Platform API */
@@ -946,6 +1038,16 @@ clGetContextInfo(cl_context context,
void * param_value,
size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
#ifdef CL_VERSION_3_0
extern CL_API_ENTRY cl_int CL_API_CALL
clSetContextDestructorCallback(cl_context context,
void (CL_CALLBACK* pfn_notify)(cl_context context,
void* user_data),
void* user_data) CL_API_SUFFIX__VERSION_3_0;
#endif
/* Command Queue APIs */
#ifdef CL_VERSION_2_0
@@ -1014,6 +1116,27 @@ clCreatePipe(cl_context context,
#endif
#ifdef CL_VERSION_3_0
extern CL_API_ENTRY cl_mem CL_API_CALL
clCreateBufferWithProperties(cl_context context,
const cl_mem_properties * properties,
cl_mem_flags flags,
size_t size,
void * host_ptr,
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_3_0;
extern CL_API_ENTRY cl_mem CL_API_CALL
clCreateImageWithProperties(cl_context context,
const cl_mem_properties * properties,
cl_mem_flags flags,
const cl_image_format * image_format,
const cl_image_desc * image_desc,
void * host_ptr,
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_3_0;
#endif
extern CL_API_ENTRY cl_int CL_API_CALL
clRetainMemObject(cl_mem memobj) CL_API_SUFFIX__VERSION_1_0;
@@ -1186,11 +1309,11 @@ clLinkProgram(cl_context context,
#ifdef CL_VERSION_2_2
extern CL_API_ENTRY cl_int CL_API_CALL
extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_2_2_DEPRECATED cl_int CL_API_CALL
clSetProgramReleaseCallback(cl_program program,
void (CL_CALLBACK * pfn_notify)(cl_program program,
void * user_data),
void * user_data) CL_API_SUFFIX__VERSION_2_2;
void * user_data) CL_EXT_SUFFIX__VERSION_2_2_DEPRECATED;
extern CL_API_ENTRY cl_int CL_API_CALL
clSetProgramSpecializationConstant(cl_program program,