From f25543115c604622d448ac0f0f85f4f4333aac15 Mon Sep 17 00:00:00 2001 From: Brice Videau Date: Sat, 15 May 2021 02:20:02 -0500 Subject: [PATCH 1/4] Prototype header only dlopened OpenCL library. --- CL/cl.h | 4 + CL/cl_api_ptrs.h | 1137 ++++++++++++++++++++++++++++++ CL/cl_icd.h | 778 +------------------- CL/cl_load.h | 1600 ++++++++++++++++++++++++++++++++++++++++++ CL/opencl.h | 1 + CL/opencl_load.h | 100 +++ CL/opencl_load_lib.h | 1157 ++++++++++++++++++++++++++++++ 7 files changed, 4009 insertions(+), 768 deletions(-) create mode 100644 CL/cl_api_ptrs.h create mode 100644 CL/cl_load.h create mode 100644 CL/opencl_load.h create mode 100644 CL/opencl_load_lib.h diff --git a/CL/cl.h b/CL/cl.h index 0018a0f4..5cd8f9b3 100644 --- a/CL/cl.h +++ b/CL/cl.h @@ -942,6 +942,8 @@ typedef struct _cl_name_version { /********************************************************************************************************/ +#ifndef OPENCL_LOAD + /* Platform API */ extern CL_API_ENTRY cl_int CL_API_CALL clGetPlatformIDs(cl_uint num_entries, @@ -1922,6 +1924,8 @@ clEnqueueTask(cl_command_queue command_queue, const cl_event * event_wait_list, cl_event * event) CL_API_SUFFIX__VERSION_1_2_DEPRECATED; +#endif /* !OPENCL_LOAD */ + #ifdef __cplusplus } #endif diff --git a/CL/cl_api_ptrs.h b/CL/cl_api_ptrs.h new file mode 100644 index 00000000..c1f15b30 --- /dev/null +++ b/CL/cl_api_ptrs.h @@ -0,0 +1,1137 @@ +/******************************************************************************* + * Copyright (c) 2008-2020 The Khronos Group Inc. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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_API_PTRS_H_ +#define OPENCL_CL_API_PTRS_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Platform API */ + +typedef cl_int (CL_API_CALL *cl_api_clGetPlatformIDs)( + cl_uint num_entries, + cl_platform_id *platforms, + cl_uint *num_platforms) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clGetPlatformInfo)( + cl_platform_id platform, + cl_platform_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +/* Device APIs */ + +typedef cl_int (CL_API_CALL *cl_api_clGetDeviceIDs)( + cl_platform_id platform, + cl_device_type device_type, + cl_uint num_entries, + cl_device_id *devices, + cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clGetDeviceInfo)( + cl_device_id device, + cl_device_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +typedef cl_int (CL_API_CALL *cl_api_clCreateSubDevices)( + cl_device_id in_device, + const cl_device_partition_property *partition_properties, + cl_uint num_entries, + cl_device_id *out_devices, + cl_uint *num_devices); + +typedef cl_int (CL_API_CALL *cl_api_clRetainDevice)( + cl_device_id device) CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int (CL_API_CALL *cl_api_clReleaseDevice)( + cl_device_id device) CL_API_SUFFIX__VERSION_1_2; + +#else + +typedef void *cl_api_clCreateSubDevices; +typedef void *cl_api_clRetainDevice; +typedef void *cl_api_clReleaseDevice; + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_1 + +typedef cl_int (CL_API_CALL *cl_api_clSetDefaultDeviceCommandQueue)( + cl_context context, + cl_device_id device, + cl_command_queue command_queue) CL_API_SUFFIX__VERSION_2_1; + +typedef cl_int (CL_API_CALL *cl_api_clGetDeviceAndHostTimer)( + cl_device_id device, + cl_ulong *device_timestamp, + cl_ulong *host_timestamp) CL_API_SUFFIX__VERSION_2_1; + +typedef cl_int (CL_API_CALL *cl_api_clGetHostTimer)( + cl_device_id device, + cl_ulong *host_timestamp) CL_API_SUFFIX__VERSION_2_1; + +#else + +typedef void *cl_api_clSetDefaultDeviceCommandQueue; +typedef void *cl_api_clGetDeviceAndHostTimer; +typedef void *cl_api_clGetHostTimer; + +#endif /*CL_VERSION_2_1 */ + +/* Context APIs */ + +typedef cl_context (CL_API_CALL *cl_api_clCreateContext)( + const cl_context_properties *properties, + cl_uint num_devices, + const cl_device_id *devices, + void (CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *), + void *user_data, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_context (CL_API_CALL *cl_api_clCreateContextFromType)( + const cl_context_properties *properties, + cl_device_type device_type, + void (CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *), + void *user_data, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clRetainContext)( + cl_context context) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clReleaseContext)( + cl_context context) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clGetContextInfo)( + cl_context context, + cl_context_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_3_0 + +typedef cl_int (CL_API_CALL* cl_api_clSetContextDestructorCallback)( + cl_context context, + void (CL_CALLBACK *pfn_notify)(cl_context context, void* user_data), + void *user_data) CL_API_SUFFIX__VERSION_3_0; + +#else + +typedef void *cl_api_clSetContextDestructorCallback; + +#endif /* CL_VERSION_3 */ + +/* Command Queue APIs */ + +#ifdef CL_VERSION_2_0 + +typedef +cl_command_queue(CL_API_CALL *cl_api_clCreateCommandQueueWithProperties)( + cl_context context, + cl_device_id device, + const cl_queue_properties *properties, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_2_0; + +#else + +typedef void *cl_api_clCreateCommandQueueWithProperties; + +#endif /* CL_VERSION_2_0 */ + +typedef cl_int(CL_API_CALL *cl_api_clRetainCommandQueue)( + cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int(CL_API_CALL *cl_api_clReleaseCommandQueue)( + cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clGetCommandQueueInfo)( + cl_command_queue command_queue, + cl_command_queue_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +/* Memory Object APIs */ + +typedef cl_mem (CL_API_CALL *cl_api_clCreateBuffer)( + cl_context context, + cl_mem_flags flags, + size_t size, + void *host_ptr, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_1 + +typedef cl_mem (CL_API_CALL *cl_api_clCreateSubBuffer)( + cl_mem buffer, + cl_mem_flags flags, + cl_buffer_create_type buffer_create_type, + const void *buffer_create_info, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_1; + +#else + +typedef void *cl_api_clCreateSubBuffer; + +#endif /* CL_VERSION_1_1 */ + +#ifdef CL_VERSION_1_2 + +typedef cl_mem (CL_API_CALL *cl_api_clCreateImage)( + cl_context context, + 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_1_2; + +#else + +typedef void *cl_api_clCreateImage; + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_0 + +typedef cl_mem (CL_API_CALL *cl_api_clCreatePipe)( + cl_context context, + cl_mem_flags flags, + cl_uint pipe_packet_size, + cl_uint pipe_max_packets, + const cl_pipe_properties *properties, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_2_0; + +#else + +typedef void *cl_api_clCreatePipe; + +#endif /* CL_VERSION_2_0 */ + +#ifdef CL_VERSION_3_0 + +typedef cl_mem (CL_API_CALL *cl_api_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; + +typedef cl_mem (CL_API_CALL *cl_api_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; + +#else + +typedef void *cl_api_clCreateBufferWithProperties; +typedef void *cl_api_clCreateImageWithProperties; + +#endif /* CL_VERSION_3_0 */ + +typedef cl_int (CL_API_CALL *cl_api_clRetainMemObject)( + cl_mem memobj) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clReleaseMemObject)( + cl_mem memobj) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clGetSupportedImageFormats)( + cl_context context, + cl_mem_flags flags, + cl_mem_object_type image_type, + cl_uint num_entries, + cl_image_format *image_formats, + cl_uint *num_image_formats) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clGetMemObjectInfo)( + cl_mem memobj, + cl_mem_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clGetImageInfo)( + cl_mem image, + cl_image_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_2_0 + +typedef cl_int (CL_API_CALL *cl_api_clGetPipeInfo)( + cl_mem pipe, + cl_pipe_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_2_0; + +#else + +typedef void *cl_api_clGetPipeInfo; + +#endif /* CL_VERSION_2_0 */ + +#ifdef CL_VERSION_1_1 + +typedef cl_int (CL_API_CALL *cl_api_clSetMemObjectDestructorCallback)( + cl_mem memobj, + void (CL_CALLBACK *pfn_notify)(cl_mem memobj, + void *user_data), + void *user_data) CL_API_SUFFIX__VERSION_1_1; + +#else + +typedef void *cl_api_clSetMemObjectDestructorCallback; + +#endif /* CL_VERSION_1_1 */ + +/* SVM Allocation APIs */ + +#ifdef CL_VERSION_2_0 + +typedef void * (CL_API_CALL *cl_api_clSVMAlloc)( + cl_context context, + cl_svm_mem_flags flags, + size_t size, + unsigned int alignment) CL_API_SUFFIX__VERSION_2_0; + +typedef void (CL_API_CALL *cl_api_clSVMFree)( + cl_context context, + void *svm_pointer) CL_API_SUFFIX__VERSION_2_0; + +#else + +typedef void *cl_api_clSVMAlloc; +typedef void *cl_api_clSVMFree; + +#endif /* CL_VERSION_2_0 */ + +/* Sampler APIs */ + +#ifdef CL_VERSION_2_0 + +typedef cl_sampler (CL_API_CALL *cl_api_clCreateSamplerWithProperties)( + cl_context context, + const cl_sampler_properties *sampler_properties, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_2_0; + +#else + +typedef void *cl_api_clCreateSamplerWithProperties; + +#endif /* CL_VERSION_2_0 */ + +typedef cl_int (CL_API_CALL *cl_api_clRetainSampler)( + cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clReleaseSampler)( + cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int(CL_API_CALL *cl_api_clGetSamplerInfo)( + cl_sampler sampler, + cl_sampler_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +/* Program Object APIs */ + +typedef cl_program(CL_API_CALL *cl_api_clCreateProgramWithSource)( + cl_context context, + cl_uint count, + const char **strings, + const size_t *lengths, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_program(CL_API_CALL *cl_api_clCreateProgramWithBinary)( + cl_context context, + cl_uint num_devices, + const cl_device_id *device_list, + const size_t *lengths, + const unsigned char **binaries, + cl_int *binary_status, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +typedef +cl_program(CL_API_CALL *cl_api_clCreateProgramWithBuiltInKernels)( + cl_context context, + cl_uint num_devices, + const cl_device_id *device_list, + const char *kernel_names, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +#else + +typedef void *cl_api_clCreateProgramWithBuiltInKernels; + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_1 + +typedef cl_program(CL_API_CALL *cl_api_clCreateProgramWithIL)( + cl_context context, + const void *il, + size_t length, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_2_1; + +#else + +typedef void *cl_api_clCreateProgramWithIL; + +#endif /* CL_VERSION_2_1 */ + +typedef cl_int (CL_API_CALL *cl_api_clRetainProgram)( + cl_program program) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clReleaseProgram)( + cl_program program) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clBuildProgram)( + cl_program program, + cl_uint num_devices, + const cl_device_id *device_list, + const char *options, + void (CL_CALLBACK *pfn_notify)(cl_program program, void *user_data), + void *user_data) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +typedef cl_int (CL_API_CALL *cl_api_clCompileProgram)( + cl_program program, + cl_uint num_devices, + const cl_device_id *device_list, + const char *options, + cl_uint num_input_headers, + const cl_program *input_headers, + const char **header_include_names, + void (CL_CALLBACK *pfn_notify)(cl_program program, void *user_data), + void *user_data) CL_API_SUFFIX__VERSION_1_2; + +typedef cl_program (CL_API_CALL *cl_api_clLinkProgram)( + cl_context context, + cl_uint num_devices, + const cl_device_id *device_list, + const char *options, + cl_uint num_input_programs, + const cl_program *input_programs, + void (CL_CALLBACK *pfn_notify)(cl_program program, void *user_data), + void *user_data, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +#else + +typedef void *cl_api_clCompileProgram; +typedef void *cl_api_clLinkProgram; + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_2 + +typedef cl_int (CL_API_CALL *cl_api_clSetProgramReleaseCallback)( + cl_program program, + void (CL_CALLBACK *pfn_notify)(cl_program program, void *user_data), + void *user_data) CL_API_SUFFIX__VERSION_2_2; + +typedef cl_int(CL_API_CALL *cl_api_clSetProgramSpecializationConstant)( + cl_program program, + cl_uint spec_id, + size_t spec_size, + const void *spec_value) CL_API_SUFFIX__VERSION_2_2; + +#else + +typedef void *cl_api_clSetProgramSpecializationConstant; +typedef void *cl_api_clSetProgramReleaseCallback; + +#endif /* CL_VERSION_2_2 */ + +#ifdef CL_VERSION_1_2 + +typedef cl_int (CL_API_CALL *cl_api_clUnloadPlatformCompiler)( + cl_platform_id platform) CL_API_SUFFIX__VERSION_1_2; + +#else + +typedef void *cl_api_clUnloadPlatformCompiler; + +#endif /* CL_VERSION_1_2 */ + +typedef cl_int(CL_API_CALL *cl_api_clGetProgramInfo)( + cl_program program, + cl_program_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int(CL_API_CALL *cl_api_clGetProgramBuildInfo)( + cl_program program, + cl_device_id device, + cl_program_build_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +/* Kernel Object APIs */ + +typedef cl_kernel(CL_API_CALL *cl_api_clCreateKernel)( + cl_program program, + const char *kernel_name, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int(CL_API_CALL *cl_api_clCreateKernelsInProgram)( + cl_program program, + cl_uint num_kernels, + cl_kernel *kernels, + cl_uint *num_kernels_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_2_1 + +typedef cl_kernel (CL_API_CALL *cl_api_clCloneKernel)( + cl_kernel source_kernel, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_2_1; + +#else + +typedef void *cl_api_clCloneKernel; + +#endif /* CL_VERSION_2_1 */ + +typedef cl_int (CL_API_CALL *cl_api_clRetainKernel)( + cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clReleaseKernel)( + cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int(CL_API_CALL *cl_api_clSetKernelArg)( + cl_kernel kernel, + cl_uint arg_index, + size_t arg_size, + const void *arg_value) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_2_0 + +typedef cl_int (CL_API_CALL *cl_api_clSetKernelArgSVMPointer)( + cl_kernel kernel, + cl_uint arg_index, + const void *arg_value) CL_API_SUFFIX__VERSION_2_0; + +typedef cl_int (CL_API_CALL *cl_api_clSetKernelExecInfo)( + cl_kernel kernel, + cl_kernel_exec_info param_name, + size_t param_value_size, + const void *param_value) CL_API_SUFFIX__VERSION_2_0; + +#else + +typedef void *cl_api_clSetKernelArgSVMPointer; +typedef void *cl_api_clSetKernelExecInfo; + +#endif /* CL_VERSION_2_0 */ + +typedef cl_int(CL_API_CALL *cl_api_clGetKernelInfo)( + cl_kernel kernel, + cl_kernel_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +typedef cl_int (CL_API_CALL *cl_api_clGetKernelArgInfo)( + cl_kernel kernel, + cl_uint arg_indx, + cl_kernel_arg_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_2; + +#else + +typedef void *cl_api_clGetKernelArgInfo; + +#endif /* CL_VERSION_1_2 */ + +typedef cl_int (CL_API_CALL *cl_api_clGetKernelWorkGroupInfo)( + cl_kernel kernel, + cl_device_id device, + cl_kernel_work_group_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_2_1 + +typedef cl_int (CL_API_CALL *cl_api_clGetKernelSubGroupInfo)( + cl_kernel kernel, + cl_device_id device, + cl_kernel_sub_group_info param_name, + size_t input_value_size, + const void *input_value, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_2_1; + +#else + +typedef void *cl_api_clGetKernelSubGroupInfo; + +#endif /* CL_VERSION_2_1 */ + +/* Event Object APIs */ + +typedef cl_int (CL_API_CALL *cl_api_clWaitForEvents)( + cl_uint num_events, + const cl_event *event_list) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clGetEventInfo)( + cl_event event, + cl_event_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_1 + +typedef cl_event (CL_API_CALL *cl_api_clCreateUserEvent)( + cl_context context, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_1; + +#else + +typedef void *cl_api_clCreateUserEvent; + +#endif /* CL_VERSION_1_1 */ + +typedef cl_int (CL_API_CALL *cl_api_clRetainEvent)(cl_event event) + CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clReleaseEvent)(cl_event event) + CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_1 + +typedef cl_int (CL_API_CALL *cl_api_clSetUserEventStatus)( + cl_event event, + cl_int execution_status) CL_API_SUFFIX__VERSION_1_1; + +typedef cl_int (CL_API_CALL *cl_api_clSetEventCallback)( + cl_event event, + cl_int command_exec_callback_type, + void (CL_CALLBACK *pfn_notify)(cl_event, cl_int, void *), + void *user_data) CL_API_SUFFIX__VERSION_1_1; + +#else + +typedef void *cl_api_clSetUserEventStatus; +typedef void *cl_api_clSetEventCallback; + +#endif /* CL_VERSION_1_1 */ + +/* Profiling APIs */ + +typedef cl_int (CL_API_CALL *cl_api_clGetEventProfilingInfo)( + cl_event event, + cl_profiling_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +/* Flush and Finish APIs */ + +typedef cl_int (CL_API_CALL *cl_api_clFlush)( + cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clFinish)( + cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; + +/* Enqueued Commands APIs */ + +typedef cl_int(CL_API_CALL *cl_api_clEnqueueReadBuffer)( + cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_read, + size_t offset, + size_t cb, + void *ptr, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_1 + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueReadBufferRect)( + cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_read, + const size_t *buffer_origin, + const size_t *host_origin, + const size_t *region, + size_t buffer_row_pitch, + size_t buffer_slice_pitch, + size_t host_row_pitch, + size_t host_slice_pitch, + void *ptr, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_1; + +#else + +typedef void *cl_api_clEnqueueReadBufferRect; + +#endif /* CL_VERSION_1_1 */ + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueWriteBuffer)( + cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_write, + size_t offset, + size_t cb, + const void *ptr, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_1 + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueWriteBufferRect)( + cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_read, + const size_t *buffer_origin, + const size_t *host_origin, + const size_t *region, + size_t buffer_row_pitch, + size_t buffer_slice_pitch, + size_t host_row_pitch, + size_t host_slice_pitch, + const void *ptr, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_1; +#else + +typedef void *cl_api_clEnqueueWriteBufferRect; + +#endif /* CL_VERSION_1_1 */ + +#ifdef CL_VERSION_1_2 + +typedef cl_int(CL_API_CALL *cl_api_clEnqueueFillBuffer)( + cl_command_queue command_queue, + cl_mem buffer, + const void *pattern, + size_t pattern_size, + size_t offset, + size_t cb, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_2; + +#else + +typedef void *cl_api_clEnqueueFillBuffer; + +#endif /* CL_VERSION_1_2 */ + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueCopyBuffer)( + cl_command_queue command_queue, + cl_mem src_buffer, + cl_mem dst_buffer, + size_t src_offset, + size_t dst_offset, + size_t cb, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_1 + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueCopyBufferRect)( + cl_command_queue command_queue, + cl_mem src_buffer, + cl_mem dst_buffer, + const size_t *src_origin, + const size_t *dst_origin, + const size_t *region, + size_t src_row_pitch, + size_t src_slice_pitch, + size_t dst_row_pitch, + size_t dst_slice_pitch, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_1; + +#else + +typedef void *cl_api_clEnqueueCopyBufferRect; + +#endif /* CL_VERSION_1_1 */ + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueReadImage)( + cl_command_queue command_queue, + cl_mem image, + cl_bool blocking_read, + const size_t *origin, + const size_t *region, + size_t row_pitch, + size_t slice_pitch, + void *ptr, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueWriteImage)( + cl_command_queue command_queue, + cl_mem image, + cl_bool blocking_write, + const size_t *origin, + const size_t *region, + size_t input_row_pitch, + size_t input_slice_pitch, + const void *ptr, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueFillImage)( + cl_command_queue command_queue, + cl_mem image, + const void *fill_color, + const size_t *origin, + const size_t *region, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_2; + +#else + +typedef void *cl_api_clEnqueueFillImage; + +#endif /* CL_VERSION_1_2 */ + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueCopyImage)( + cl_command_queue command_queue, + cl_mem src_image, + cl_mem dst_image, + const size_t *src_origin, + const size_t *dst_origin, + const size_t *region, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueCopyImageToBuffer)( + cl_command_queue command_queue, + cl_mem src_image, + cl_mem dst_buffer, + const size_t *src_origin, + const size_t *region, + size_t dst_offset, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueCopyBufferToImage)( + cl_command_queue command_queue, + cl_mem src_buffer, + cl_mem dst_image, + size_t src_offset, + const size_t *dst_origin, + const size_t *region, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_0; + +typedef void * (CL_API_CALL *cl_api_clEnqueueMapBuffer)( + cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_map, + cl_map_flags map_flags, + size_t offset, + size_t cb, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef void * (CL_API_CALL *cl_api_clEnqueueMapImage)( + cl_command_queue command_queue, + cl_mem image, + cl_bool blocking_map, + cl_map_flags map_flags, + const size_t *origin, + const size_t *region, + size_t *image_row_pitch, + size_t *image_slice_pitch, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueUnmapMemObject)( + cl_command_queue command_queue, + cl_mem memobj, + void *mapped_ptr, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueMigrateMemObjects)( + cl_command_queue command_queue, + cl_uint num_mem_objects, + const cl_mem *mem_objects, + cl_mem_migration_flags flags, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_2; + +#else + +typedef void *cl_api_clEnqueueMigrateMemObjects; + +#endif /* CL_VERSION_1_2 */ + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueNDRangeKernel)( + cl_command_queue command_queue, + cl_kernel kernel, + cl_uint work_dim, + const size_t *global_work_offset, + const size_t *global_work_size, + const size_t *local_work_size, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueNativeKernel)( + cl_command_queue command_queue, + void (CL_CALLBACK *user_func)(void *), + void *args, + size_t cb_args, + cl_uint num_mem_objects, + const cl_mem *mem_list, + const void **args_mem_loc, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueMarkerWithWaitList)( + cl_command_queue command_queue, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueBarrierWithWaitList)( + cl_command_queue command_queue, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_2; + +#else + +typedef void *cl_api_clEnqueueMarkerWithWaitList; +typedef void *cl_api_clEnqueueBarrierWithWaitList; + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_0 + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueSVMFree)( + cl_command_queue command_queue, + cl_uint num_svm_pointers, + void *svm_pointers[], + void (CL_CALLBACK *pfn_free_func)(cl_command_queue queue, + cl_uint num_svm_pointers, + void *svm_pointers[], + void *user_data), + void *user_data, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_2_0; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueSVMMemcpy)( + cl_command_queue command_queue, + cl_bool blocking_copy, + void *dst_ptr, + const void *src_ptr, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_2_0; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueSVMMemFill)( + cl_command_queue command_queue, + void *svm_ptr, + const void *pattern, + size_t pattern_size, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_2_0; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueSVMMap)( + cl_command_queue command_queue, + cl_bool blocking_map, + cl_map_flags map_flags, + void *svm_ptr, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_2_0; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueSVMUnmap)( + cl_command_queue command_queue, + void *svm_ptr, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_2_0; + +#else + +typedef void *cl_api_clEnqueueSVMFree; +typedef void *cl_api_clEnqueueSVMMemcpy; +typedef void *cl_api_clEnqueueSVMMemFill; +typedef void *cl_api_clEnqueueSVMMap; +typedef void *cl_api_clEnqueueSVMUnmap; + +#endif /* CL_VERSION_2_0 */ + +#ifdef CL_VERSION_2_1 + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueSVMMigrateMem)( + cl_command_queue command_queue, + cl_uint num_svm_pointers, + const void **svm_pointers, + const size_t *sizes, + cl_mem_migration_flags flags, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_2_1; + +#else + +typedef void *cl_api_clEnqueueSVMMigrateMem; + +#endif /* CL_VERSION_2_1 */ + +#ifdef CL_VERSION_1_2 + +typedef void * (CL_API_CALL *cl_api_clGetExtensionFunctionAddressForPlatform)( + cl_platform_id platform, + const char *function_name) CL_API_SUFFIX__VERSION_1_2; + +#else + +typedef void *cl_api_clGetExtensionFunctionAddressForPlatform; + +#endif /* CL_VERSION_1_2 */ + +typedef cl_int (CL_API_CALL *cl_api_clSetCommandQueueProperty)( + cl_command_queue command_queue, + cl_command_queue_properties properties, + cl_bool enable, + cl_command_queue_properties *old_properties) CL_API_SUFFIX__VERSION_1_0_DEPRECATED; + +/* Deprecated OpenCL 1.1 APIs */ + +typedef cl_mem (CL_API_CALL *cl_api_clCreateImage2D)( + cl_context context, + cl_mem_flags flags, + const cl_image_format *image_format, + size_t image_width, + size_t image_height, + size_t image_row_pitch, + void *host_ptr, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +typedef cl_mem (CL_API_CALL *cl_api_clCreateImage3D)( + cl_context context, + cl_mem_flags flags, + const cl_image_format *image_format, + size_t image_width, + size_t image_height, + size_t image_depth, + size_t image_row_pitch, + size_t image_slice_pitch, + void *host_ptr, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueMarker)( + cl_command_queue command_queue, + cl_event *event) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueWaitForEvents)( + cl_command_queue command_queue, + cl_uint num_events, + const cl_event *event_list) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueBarrier)( + cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +typedef cl_int (CL_API_CALL *cl_api_clUnloadCompiler)(void) + CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +typedef void * (CL_API_CALL *cl_api_clGetExtensionFunctionAddress)( + const char *function_name) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +/* Deprecated OpenCL 2.0 APIs */ + +typedef cl_command_queue (CL_API_CALL *cl_api_clCreateCommandQueue)( + cl_context context, + cl_device_id device, + cl_command_queue_properties properties, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_sampler (CL_API_CALL *cl_api_clCreateSampler)( + cl_context context, + cl_bool normalized_coords, + cl_addressing_mode addressing_mode, + cl_filter_mode filter_mode, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueTask)( + cl_command_queue command_queue, + cl_kernel kernel, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_CL_API_PTRS_H_ */ diff --git a/CL/cl_icd.h b/CL/cl_icd.h index d5ac1de0..fc5e7678 100644 --- a/CL/cl_icd.h +++ b/CL/cl_icd.h @@ -28,6 +28,8 @@ #include #endif +#include + #ifdef __cplusplus extern "C" { #endif @@ -40,700 +42,22 @@ extern "C" { /* API function pointer definitions */ -// Platform APIs -typedef cl_int(CL_API_CALL *cl_api_clGetPlatformIDs)( - cl_uint num_entries, cl_platform_id *platforms, - cl_uint *num_platforms) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clGetPlatformInfo)( - cl_platform_id platform, cl_platform_info param_name, - size_t param_value_size, void *param_value, - size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -// Device APIs -typedef cl_int(CL_API_CALL *cl_api_clGetDeviceIDs)( - cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, - cl_device_id *devices, cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clGetDeviceInfo)( - cl_device_id device, cl_device_info param_name, size_t param_value_size, - void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -typedef cl_int(CL_API_CALL *cl_api_clCreateSubDevices)( - cl_device_id in_device, - const cl_device_partition_property *partition_properties, - cl_uint num_entries, cl_device_id *out_devices, cl_uint *num_devices); - -typedef cl_int(CL_API_CALL *cl_api_clRetainDevice)( - cl_device_id device) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_int(CL_API_CALL *cl_api_clReleaseDevice)( - cl_device_id device) CL_API_SUFFIX__VERSION_1_2; - -#else - -typedef void *cl_api_clCreateSubDevices; -typedef void *cl_api_clRetainDevice; -typedef void *cl_api_clReleaseDevice; - -#endif - -// Context APIs -typedef cl_context(CL_API_CALL *cl_api_clCreateContext)( - const cl_context_properties *properties, cl_uint num_devices, - const cl_device_id *devices, - void(CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *), - void *user_data, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_context(CL_API_CALL *cl_api_clCreateContextFromType)( - const cl_context_properties *properties, cl_device_type device_type, - void(CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *), - void *user_data, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clRetainContext)( - cl_context context) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clReleaseContext)( - cl_context context) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clGetContextInfo)( - cl_context context, cl_context_info param_name, size_t param_value_size, - void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -// Command Queue APIs -typedef cl_command_queue(CL_API_CALL *cl_api_clCreateCommandQueue)( - cl_context context, cl_device_id device, - cl_command_queue_properties properties, - cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_2_0 - -typedef -cl_command_queue(CL_API_CALL *cl_api_clCreateCommandQueueWithProperties)( - cl_context /* context */, cl_device_id /* device */, - const cl_queue_properties * /* properties */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0; - -#else - -typedef void *cl_api_clCreateCommandQueueWithProperties; - -#endif - -typedef cl_int(CL_API_CALL *cl_api_clRetainCommandQueue)( - cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clReleaseCommandQueue)( - cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clGetCommandQueueInfo)( - cl_command_queue command_queue, cl_command_queue_info param_name, - size_t param_value_size, void *param_value, - size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -// Memory Object APIs -typedef cl_mem(CL_API_CALL *cl_api_clCreateBuffer)( - cl_context context, cl_mem_flags flags, size_t size, void *host_ptr, - cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -typedef cl_mem(CL_API_CALL *cl_api_clCreateImage)( - cl_context context, 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_1_2; - -#else - -typedef void *cl_api_clCreateImage; - -#endif - -#ifdef CL_VERSION_3_0 - -typedef cl_mem(CL_API_CALL *cl_api_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; - -typedef cl_mem(CL_API_CALL *cl_api_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; - -typedef cl_int(CL_API_CALL* cl_api_clSetContextDestructorCallback)( - cl_context context, - void(CL_CALLBACK* pfn_notify)(cl_context context, void* user_data), - void* user_data) CL_API_SUFFIX__VERSION_3_0; - -#else - -typedef void *cl_api_clCreateBufferWithProperties; -typedef void *cl_api_clCreateImageWithProperties; -typedef void *cl_api_clSetContextDestructorCallback; - -#endif - -typedef cl_int(CL_API_CALL *cl_api_clRetainMemObject)( - cl_mem memobj) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clReleaseMemObject)( - cl_mem memobj) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clGetSupportedImageFormats)( - cl_context context, cl_mem_flags flags, cl_mem_object_type image_type, - cl_uint num_entries, cl_image_format *image_formats, - cl_uint *num_image_formats) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clGetMemObjectInfo)( - cl_mem memobj, cl_mem_info param_name, size_t param_value_size, - void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clGetImageInfo)( - cl_mem image, cl_image_info param_name, size_t param_value_size, - void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_2_0 - -typedef cl_mem(CL_API_CALL *cl_api_clCreatePipe)( - cl_context /* context */, cl_mem_flags /* flags */, - cl_uint /* pipe_packet_size */, cl_uint /* pipe_max_packets */, - const cl_pipe_properties * /* properties */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0; - -typedef cl_int(CL_API_CALL *cl_api_clGetPipeInfo)( - cl_mem /* pipe */, cl_pipe_info /* param_name */, - size_t /* param_value_size */, void * /* param_value */, - size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_2_0; - -typedef void *(CL_API_CALL *cl_api_clSVMAlloc)( - cl_context /* context */, cl_svm_mem_flags /* flags */, size_t /* size */, - unsigned int /* alignment */)CL_API_SUFFIX__VERSION_2_0; - -typedef void(CL_API_CALL *cl_api_clSVMFree)( - cl_context /* context */, - void * /* svm_pointer */) CL_API_SUFFIX__VERSION_2_0; - -#else - -typedef void *cl_api_clCreatePipe; -typedef void *cl_api_clGetPipeInfo; -typedef void *cl_api_clSVMAlloc; -typedef void *cl_api_clSVMFree; - -#endif - -// Sampler APIs -typedef cl_sampler(CL_API_CALL *cl_api_clCreateSampler)( - cl_context context, cl_bool normalized_coords, - cl_addressing_mode addressing_mode, cl_filter_mode filter_mode, - cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clRetainSampler)( - cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clReleaseSampler)( - cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clGetSamplerInfo)( - cl_sampler sampler, cl_sampler_info param_name, size_t param_value_size, - void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_2_0 - -typedef -cl_sampler(CL_API_CALL *cl_api_clCreateSamplerWithProperties)( - cl_context /* context */, - const cl_sampler_properties * /* sampler_properties */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0; - -#else - -typedef void *cl_api_clCreateSamplerWithProperties; - -#endif - -// Program Object APIs -typedef cl_program(CL_API_CALL *cl_api_clCreateProgramWithSource)( - cl_context context, cl_uint count, const char **strings, - const size_t *lengths, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_program(CL_API_CALL *cl_api_clCreateProgramWithBinary)( - cl_context context, cl_uint num_devices, const cl_device_id *device_list, - const size_t *lengths, const unsigned char **binaries, - cl_int *binary_status, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -typedef -cl_program(CL_API_CALL *cl_api_clCreateProgramWithBuiltInKernels)( - cl_context context, cl_uint num_devices, const cl_device_id *device_list, - const char *kernel_names, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -#else - -typedef void *cl_api_clCreateProgramWithBuiltInKernels; - -#endif - -typedef cl_int(CL_API_CALL *cl_api_clRetainProgram)( - cl_program program) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clReleaseProgram)( - cl_program program) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clBuildProgram)( - cl_program program, cl_uint num_devices, const cl_device_id *device_list, - const char *options, - void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data), - void *user_data) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -typedef cl_int(CL_API_CALL *cl_api_clCompileProgram)( - cl_program program, cl_uint num_devices, const cl_device_id *device_list, - const char *options, cl_uint num_input_headers, - const cl_program *input_headers, const char **header_include_names, - void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data), - void *user_data) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_program(CL_API_CALL *cl_api_clLinkProgram)( - cl_context context, cl_uint num_devices, const cl_device_id *device_list, - const char *options, cl_uint num_input_programs, - const cl_program *input_programs, - void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data), - void *user_data, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -#else - -typedef void *cl_api_clCompileProgram; -typedef void *cl_api_clLinkProgram; - -#endif - -#ifdef CL_VERSION_2_2 - -typedef -cl_int(CL_API_CALL *cl_api_clSetProgramSpecializationConstant)( - cl_program program, cl_uint spec_id, size_t spec_size, - const void *spec_value) CL_API_SUFFIX__VERSION_2_2; - -typedef cl_int(CL_API_CALL *cl_api_clSetProgramReleaseCallback)( - cl_program program, - void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data), - void *user_data) CL_API_SUFFIX__VERSION_2_2; - -#else - -typedef void *cl_api_clSetProgramSpecializationConstant; -typedef void *cl_api_clSetProgramReleaseCallback; - -#endif - -#ifdef CL_VERSION_1_2 - -typedef cl_int(CL_API_CALL *cl_api_clUnloadPlatformCompiler)( - cl_platform_id platform) CL_API_SUFFIX__VERSION_1_2; - -#else - -typedef void *cl_api_clUnloadPlatformCompiler; - -#endif - -typedef cl_int(CL_API_CALL *cl_api_clGetProgramInfo)( - cl_program program, cl_program_info param_name, size_t param_value_size, - void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clGetProgramBuildInfo)( - cl_program program, cl_device_id device, cl_program_build_info param_name, - size_t param_value_size, void *param_value, - size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -// Kernel Object APIs -typedef cl_kernel(CL_API_CALL *cl_api_clCreateKernel)( - cl_program program, const char *kernel_name, - cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clCreateKernelsInProgram)( - cl_program program, cl_uint num_kernels, cl_kernel *kernels, - cl_uint *num_kernels_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clRetainKernel)( - cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clReleaseKernel)( - cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clSetKernelArg)( - cl_kernel kernel, cl_uint arg_index, size_t arg_size, - const void *arg_value) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clGetKernelInfo)( - cl_kernel kernel, cl_kernel_info param_name, size_t param_value_size, - void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -typedef cl_int(CL_API_CALL *cl_api_clGetKernelArgInfo)( - cl_kernel kernel, cl_uint arg_indx, cl_kernel_arg_info param_name, - size_t param_value_size, void *param_value, - size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_2; - -#else - -typedef void *cl_api_clGetKernelArgInfo; - -#endif - -typedef cl_int(CL_API_CALL *cl_api_clGetKernelWorkGroupInfo)( - cl_kernel kernel, cl_device_id device, cl_kernel_work_group_info param_name, - size_t param_value_size, void *param_value, - size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - #ifdef CL_VERSION_2_0 - -typedef cl_int(CL_API_CALL *cl_api_clSetKernelArgSVMPointer)( - cl_kernel /* kernel */, cl_uint /* arg_index */, - const void * /* arg_value */) CL_API_SUFFIX__VERSION_2_0; - -typedef cl_int(CL_API_CALL *cl_api_clSetKernelExecInfo)( - cl_kernel /* kernel */, cl_kernel_exec_info /* param_name */, - size_t /* param_value_size */, - const void * /* param_value */) CL_API_SUFFIX__VERSION_2_0; - typedef cl_int(CL_API_CALL *cl_api_clGetKernelSubGroupInfoKHR)( - cl_kernel /* in_kernel */, cl_device_id /*in_device*/, - cl_kernel_sub_group_info /* param_name */, size_t /*input_value_size*/, - const void * /*input_value*/, size_t /*param_value_size*/, - void * /*param_value*/, - size_t * /*param_value_size_ret*/) CL_API_SUFFIX__VERSION_2_0; - + cl_kernel in_kernel, + cl_device_id in_device, + cl_kernel_sub_group_info param_name, + size_t input_value_size, + const void *input_value, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_2_0; #else -typedef void *cl_api_clSetKernelArgSVMPointer; -typedef void *cl_api_clSetKernelExecInfo; typedef void *cl_api_clGetKernelSubGroupInfoKHR; #endif -// Event Object APIs -typedef cl_int(CL_API_CALL *cl_api_clWaitForEvents)( - cl_uint num_events, const cl_event *event_list) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clGetEventInfo)( - cl_event event, cl_event_info param_name, size_t param_value_size, - void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clRetainEvent)(cl_event event) - CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clReleaseEvent)(cl_event event) - CL_API_SUFFIX__VERSION_1_0; - -// Profiling APIs -typedef cl_int(CL_API_CALL *cl_api_clGetEventProfilingInfo)( - cl_event event, cl_profiling_info param_name, size_t param_value_size, - void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -// Flush and Finish APIs -typedef cl_int(CL_API_CALL *cl_api_clFlush)( - cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clFinish)( - cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; - -// Enqueued Commands APIs -typedef cl_int(CL_API_CALL *cl_api_clEnqueueReadBuffer)( - cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, - size_t offset, size_t cb, void *ptr, cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_1 - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueReadBufferRect)( - cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, - const size_t *buffer_origin, const size_t *host_origin, - const size_t *region, size_t buffer_row_pitch, size_t buffer_slice_pitch, - size_t host_row_pitch, size_t host_slice_pitch, void *ptr, - cl_uint num_events_in_wait_list, const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_1; - -#else - -typedef void *cl_api_clEnqueueReadBufferRect; - -#endif - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueWriteBuffer)( - cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, - size_t offset, size_t cb, const void *ptr, cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_1 - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueWriteBufferRect)( - cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, - const size_t *buffer_origin, const size_t *host_origin, - const size_t *region, size_t buffer_row_pitch, size_t buffer_slice_pitch, - size_t host_row_pitch, size_t host_slice_pitch, const void *ptr, - cl_uint num_events_in_wait_list, const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_1; - -#else - -typedef void *cl_api_clEnqueueWriteBufferRect; - -#endif - -#ifdef CL_VERSION_1_2 - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueFillBuffer)( - cl_command_queue command_queue, cl_mem buffer, const void *pattern, - size_t pattern_size, size_t offset, size_t cb, - cl_uint num_events_in_wait_list, const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_2; - -#else - -typedef void *cl_api_clEnqueueFillBuffer; - -#endif - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueCopyBuffer)( - cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, - size_t src_offset, size_t dst_offset, size_t cb, - cl_uint num_events_in_wait_list, const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_1 - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueCopyBufferRect)( - cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, - const size_t *src_origin, const size_t *dst_origin, const size_t *region, - size_t src_row_pitch, size_t src_slice_pitch, size_t dst_row_pitch, - size_t dst_slice_pitch, cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_1; - -#else - -typedef void *cl_api_clEnqueueCopyBufferRect; - -#endif - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueReadImage)( - cl_command_queue command_queue, cl_mem image, cl_bool blocking_read, - const size_t *origin, const size_t *region, size_t row_pitch, - size_t slice_pitch, void *ptr, cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueWriteImage)( - cl_command_queue command_queue, cl_mem image, cl_bool blocking_write, - const size_t *origin, const size_t *region, size_t input_row_pitch, - size_t input_slice_pitch, const void *ptr, cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueFillImage)( - cl_command_queue command_queue, cl_mem image, const void *fill_color, - const size_t origin[3], const size_t region[3], - cl_uint num_events_in_wait_list, const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_2; - -#else - -typedef void *cl_api_clEnqueueFillImage; - -#endif - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueCopyImage)( - cl_command_queue command_queue, cl_mem src_image, cl_mem dst_image, - const size_t *src_origin, const size_t *dst_origin, const size_t *region, - cl_uint num_events_in_wait_list, const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueCopyImageToBuffer)( - cl_command_queue command_queue, cl_mem src_image, cl_mem dst_buffer, - const size_t *src_origin, const size_t *region, size_t dst_offset, - cl_uint num_events_in_wait_list, const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueCopyBufferToImage)( - cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_image, - size_t src_offset, const size_t *dst_origin, const size_t *region, - cl_uint num_events_in_wait_list, const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_0; - -typedef void *(CL_API_CALL *cl_api_clEnqueueMapBuffer)( - cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map, - cl_map_flags map_flags, size_t offset, size_t cb, - cl_uint num_events_in_wait_list, const cl_event *event_wait_list, - cl_event *event, cl_int *errcode_ret)CL_API_SUFFIX__VERSION_1_0; - -typedef void *(CL_API_CALL *cl_api_clEnqueueMapImage)( - cl_command_queue command_queue, cl_mem image, cl_bool blocking_map, - cl_map_flags map_flags, const size_t *origin, const size_t *region, - size_t *image_row_pitch, size_t *image_slice_pitch, - cl_uint num_events_in_wait_list, const cl_event *event_wait_list, - cl_event *event, cl_int *errcode_ret)CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueUnmapMemObject)( - cl_command_queue command_queue, cl_mem memobj, void *mapped_ptr, - cl_uint num_events_in_wait_list, const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueMigrateMemObjects)( - cl_command_queue command_queue, cl_uint num_mem_objects, - const cl_mem *mem_objects, cl_mem_migration_flags flags, - cl_uint num_events_in_wait_list, const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_2; - -#else - -typedef void *cl_api_clEnqueueMigrateMemObjects; - -#endif - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueNDRangeKernel)( - cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, - const size_t *global_work_offset, const size_t *global_work_size, - const size_t *local_work_size, cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueTask)( - cl_command_queue command_queue, cl_kernel kernel, - cl_uint num_events_in_wait_list, const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueNativeKernel)( - cl_command_queue command_queue, void(CL_CALLBACK *user_func)(void *), - void *args, size_t cb_args, cl_uint num_mem_objects, const cl_mem *mem_list, - const void **args_mem_loc, cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueMarkerWithWaitList)( - cl_command_queue command_queue, cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueBarrierWithWaitList)( - cl_command_queue command_queue, cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_2; - -typedef void *( - CL_API_CALL *cl_api_clGetExtensionFunctionAddressForPlatform)( - cl_platform_id platform, - const char *function_name)CL_API_SUFFIX__VERSION_1_2; - -#else - -typedef void *cl_api_clEnqueueMarkerWithWaitList; -typedef void *cl_api_clEnqueueBarrierWithWaitList; -typedef void *cl_api_clGetExtensionFunctionAddressForPlatform; - -#endif - -// Shared Virtual Memory APIs - -#ifdef CL_VERSION_2_0 - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueSVMFree)( - cl_command_queue /* command_queue */, cl_uint /* num_svm_pointers */, - void ** /* svm_pointers */, - void(CL_CALLBACK *pfn_free_func)(cl_command_queue /* queue */, - cl_uint /* num_svm_pointers */, - void ** /* svm_pointers[] */, - void * /* user_data */), - void * /* user_data */, cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueSVMMemcpy)( - cl_command_queue /* command_queue */, cl_bool /* blocking_copy */, - void * /* dst_ptr */, const void * /* src_ptr */, size_t /* size */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueSVMMemFill)( - cl_command_queue /* command_queue */, void * /* svm_ptr */, - const void * /* pattern */, size_t /* pattern_size */, size_t /* size */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueSVMMap)( - cl_command_queue /* command_queue */, cl_bool /* blocking_map */, - cl_map_flags /* map_flags */, void * /* svm_ptr */, size_t /* size */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueSVMUnmap)( - cl_command_queue /* command_queue */, void * /* svm_ptr */, - cl_uint /* num_events_in_wait_list */, - const cl_event * /* event_wait_list */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0; - -#else - -typedef void *cl_api_clEnqueueSVMFree; -typedef void *cl_api_clEnqueueSVMMemcpy; -typedef void *cl_api_clEnqueueSVMMemFill; -typedef void *cl_api_clEnqueueSVMMap; -typedef void *cl_api_clEnqueueSVMUnmap; - -#endif - -// Deprecated APIs -typedef cl_int(CL_API_CALL *cl_api_clSetCommandQueueProperty)( - cl_command_queue command_queue, cl_command_queue_properties properties, - cl_bool enable, cl_command_queue_properties *old_properties) - CL_API_SUFFIX__VERSION_1_0_DEPRECATED; - -typedef cl_mem(CL_API_CALL *cl_api_clCreateImage2D)( - cl_context context, cl_mem_flags flags, const cl_image_format *image_format, - size_t image_width, size_t image_height, size_t image_row_pitch, - void *host_ptr, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -typedef cl_mem(CL_API_CALL *cl_api_clCreateImage3D)( - cl_context context, cl_mem_flags flags, const cl_image_format *image_format, - size_t image_width, size_t image_height, size_t image_depth, - size_t image_row_pitch, size_t image_slice_pitch, void *host_ptr, - cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -typedef cl_int(CL_API_CALL *cl_api_clUnloadCompiler)(void) - CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueMarker)( - cl_command_queue command_queue, - cl_event *event) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueWaitForEvents)( - cl_command_queue command_queue, cl_uint num_events, - const cl_event *event_list) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueBarrier)( - cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -typedef void *(CL_API_CALL *cl_api_clGetExtensionFunctionAddress)( - const char *function_name)CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - // GL and other APIs typedef cl_mem(CL_API_CALL *cl_api_clCreateFromGLBuffer)( cl_context context, cl_mem_flags flags, cl_GLuint bufobj, @@ -985,44 +309,6 @@ typedef void *cl_api_clGetDeviceIDsFromDX9MediaAdapterKHR; /* OpenCL 1.1 */ -#ifdef CL_VERSION_1_1 - -typedef cl_int(CL_API_CALL *cl_api_clSetEventCallback)( - cl_event /* event */, cl_int /* command_exec_callback_type */, - void(CL_CALLBACK * /* pfn_notify */)(cl_event, cl_int, void *), - void * /* user_data */) CL_API_SUFFIX__VERSION_1_1; - -typedef cl_mem(CL_API_CALL *cl_api_clCreateSubBuffer)( - cl_mem /* buffer */, cl_mem_flags /* flags */, - cl_buffer_create_type /* buffer_create_type */, - const void * /* buffer_create_info */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1; - -typedef -cl_int(CL_API_CALL *cl_api_clSetMemObjectDestructorCallback)( - cl_mem /* memobj */, - void(CL_CALLBACK * /*pfn_notify*/)(cl_mem /* memobj */, - void * /*user_data*/), - void * /*user_data */) CL_API_SUFFIX__VERSION_1_1; - -typedef cl_event(CL_API_CALL *cl_api_clCreateUserEvent)( - cl_context /* context */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1; - -typedef cl_int(CL_API_CALL *cl_api_clSetUserEventStatus)( - cl_event /* event */, - cl_int /* execution_status */) CL_API_SUFFIX__VERSION_1_1; - -#else - -typedef void *cl_api_clSetEventCallback; -typedef void *cl_api_clCreateSubBuffer; -typedef void *cl_api_clSetMemObjectDestructorCallback; -typedef void *cl_api_clCreateUserEvent; -typedef void *cl_api_clSetUserEventStatus; - -#endif - typedef cl_int(CL_API_CALL *cl_api_clCreateSubDevicesEXT)( cl_device_id in_device, const cl_device_partition_property_ext *partition_properties, @@ -1055,50 +341,6 @@ typedef cl_event(CL_API_CALL *cl_api_clCreateEventFromEGLSyncKHR)( cl_context context, CLeglSyncKHR sync, CLeglDisplayKHR display, cl_int *errcode_ret); -#ifdef CL_VERSION_2_1 - -typedef cl_int(CL_API_CALL *cl_api_clSetDefaultDeviceCommandQueue)( - cl_context context, cl_device_id device, - cl_command_queue command_queue) CL_API_SUFFIX__VERSION_2_1; - -typedef cl_program(CL_API_CALL *cl_api_clCreateProgramWithIL)( - cl_context context, const void *il, size_t length, - cl_int *errcode_ret) CL_API_SUFFIX__VERSION_2_1; - -typedef cl_int(CL_API_CALL *cl_api_clGetKernelSubGroupInfo)( - cl_kernel kernel, cl_device_id device, cl_kernel_sub_group_info param_name, - size_t input_value_size, const void *input_value, size_t param_value_size, - void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_2_1; - -typedef cl_kernel(CL_API_CALL *cl_api_clCloneKernel)( - cl_kernel source_kernel, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_2_1; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueSVMMigrateMem)( - cl_command_queue command_queue, cl_uint num_svm_pointers, - const void **svm_pointers, const size_t *sizes, - cl_mem_migration_flags flags, cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_2_1; - -typedef cl_int(CL_API_CALL *cl_api_clGetDeviceAndHostTimer)( - cl_device_id device, cl_ulong *device_timestamp, - cl_ulong *host_timestamp) CL_API_SUFFIX__VERSION_2_1; - -typedef cl_int(CL_API_CALL *cl_api_clGetHostTimer)( - cl_device_id device, cl_ulong *host_timestamp) CL_API_SUFFIX__VERSION_2_1; - -#else - -typedef void *cl_api_clSetDefaultDeviceCommandQueue; -typedef void *cl_api_clCreateProgramWithIL; -typedef void *cl_api_clGetKernelSubGroupInfo; -typedef void *cl_api_clCloneKernel; -typedef void *cl_api_clEnqueueSVMMigrateMem; -typedef void *cl_api_clGetDeviceAndHostTimer; -typedef void *cl_api_clGetHostTimer; - -#endif - /* Vendor dispatch table struture */ typedef struct _cl_icd_dispatch { diff --git a/CL/cl_load.h b/CL/cl_load.h new file mode 100644 index 00000000..da65d740 --- /dev/null +++ b/CL/cl_load.h @@ -0,0 +1,1600 @@ +/******************************************************************************* + * Copyright (c) 2008-2020 The Khronos Group Inc. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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_LOAD_H_ +#define OPENCL_CL_LOAD_H_ + +#include +#ifdef OPENCL_LOAD +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Platform API */ + +CLLD_DECL(clGetPlatformIDs); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetPlatformIDs(cl_uint num_entries, + cl_platform_id * platforms, + cl_uint * num_platforms) { + CLLD_FETCH(clGetPlatformIDs); + return CLLD_PTR(clGetPlatformIDs)(num_entries, platforms, num_platforms); +} + +CLLD_DECL(clGetPlatformInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetPlatformInfo(cl_platform_id platform, + cl_platform_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetPlatformInfo); + return CLLD_PTR(clGetPlatformInfo)( + platform, param_name, param_value_size, + param_value, param_value_size_ret); +} + +/* Device APIs */ + +CLLD_DECL(clGetDeviceIDs); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetDeviceIDs(cl_platform_id platform, + cl_device_type device_type, + cl_uint num_entries, + cl_device_id * devices, + cl_uint * num_devices) { + CLLD_FETCH(clGetDeviceIDs); + return CLLD_PTR(clGetDeviceIDs)( + platform, device_type, num_entries, + devices, num_devices); +} + +CLLD_DECL(clGetDeviceInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetDeviceInfo(cl_device_id device, + cl_device_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetDeviceInfo); + return CLLD_PTR(clGetDeviceInfo)( + device, param_name, param_value_size, + param_value, param_value_size_ret); +} + +#ifdef CL_VERSION_1_2 + +CLLD_DECL(clCreateSubDevices); +inline CL_API_ENTRY cl_int CL_API_CALL +clCreateSubDevices(cl_device_id in_device, + const cl_device_partition_property * properties, + cl_uint num_devices, + cl_device_id * out_devices, + cl_uint * num_devices_ret) { + CLLD_FETCH(clCreateSubDevices); + return CLLD_PTR(clCreateSubDevices)( + in_device, properties, num_devices, + out_devices, num_devices_ret); +} + +CLLD_DECL(clRetainDevice); +inline CL_API_ENTRY cl_int CL_API_CALL +clRetainDevice(cl_device_id device) { + CLLD_FETCH(clRetainDevice); + return CLLD_PTR(clRetainDevice)(device); +} + +CLLD_DECL(clReleaseDevice); +inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseDevice(cl_device_id device) { + CLLD_FETCH(clReleaseDevice); + return CLLD_PTR(clReleaseDevice)(device); +} + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_1 + +CLLD_DECL(clSetDefaultDeviceCommandQueue); +inline CL_API_ENTRY cl_int CL_API_CALL +clSetDefaultDeviceCommandQueue(cl_context context, + cl_device_id device, + cl_command_queue command_queue) { + CLLD_FETCH(clSetDefaultDeviceCommandQueue); + return CLLD_PTR(clSetDefaultDeviceCommandQueue)( + context, device, command_queue); +} + +CLLD_DECL(clGetDeviceAndHostTimer); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetDeviceAndHostTimer(cl_device_id device, + cl_ulong* device_timestamp, + cl_ulong* host_timestamp) { + CLLD_FETCH(clGetDeviceAndHostTimer); + return CLLD_PTR(clGetDeviceAndHostTimer)( + device, device_timestamp, host_timestamp); +} + +CLLD_DECL(clGetHostTimer); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetHostTimer(cl_device_id device, + cl_ulong * host_timestamp) { + CLLD_FETCH(clGetHostTimer); + return CLLD_PTR(clGetHostTimer)( + device, host_timestamp); +} + +#endif /*CL_VERSION_2_1 */ + +/* Context APIs */ + +CLLD_DECL(clCreateContext); +inline CL_API_ENTRY cl_context CL_API_CALL +clCreateContext(const cl_context_properties * properties, + cl_uint num_devices, + const cl_device_id * devices, + void (CL_CALLBACK * pfn_notify)(const char * errinfo, + const void * private_info, + size_t cb, + void * user_data), + void * user_data, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateContext, errcode_ret); + return CLLD_PTR(clCreateContext)( + properties, num_devices, devices, + pfn_notify, user_data, errcode_ret); +} + +CLLD_DECL(clCreateContextFromType); +inline CL_API_ENTRY cl_context CL_API_CALL +clCreateContextFromType(const cl_context_properties * properties, + cl_device_type device_type, + void (CL_CALLBACK * pfn_notify)(const char * errinfo, + const void * private_info, + size_t cb, + void * user_data), + void * user_data, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateContextFromType, errcode_ret); + return CLLD_PTR(clCreateContextFromType)( + properties, device_type, pfn_notify, + user_data, errcode_ret); +} + +CLLD_DECL(clRetainContext); +inline CL_API_ENTRY cl_int CL_API_CALL +clRetainContext(cl_context context) { + CLLD_FETCH(clRetainContext); + return CLLD_PTR(clRetainContext)(context); +} + +CLLD_DECL(clReleaseContext); +inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseContext(cl_context context) { + CLLD_FETCH(clReleaseContext); + return CLLD_PTR(clReleaseContext)(context); +} + +CLLD_DECL(clGetContextInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetContextInfo(cl_context context, + cl_context_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetContextInfo); + return CLLD_PTR(clGetContextInfo)( + context, param_name, param_value_size, + param_value, param_value_size_ret); +} + +#ifdef CL_VERSION_3_0 + +CLLD_DECL(clSetContextDestructorCallback); +inline 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) { + CLLD_DECL(clSetContextDestructorCallback); + return CLLD_PTR(clSetContextDestructorCallback)( + context, pfn_notify, user_data); +} + +#endif /* CL_VERSION_3 */ + +/* Command Queue APIs */ + +#ifdef CL_VERSION_2_0 + +CLLD_DECL(clCreateCommandQueueWithProperties); +inline CL_API_ENTRY cl_command_queue CL_API_CALL +clCreateCommandQueueWithProperties(cl_context context, + cl_device_id device, + const cl_queue_properties * properties, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateCommandQueueWithProperties, errcode_ret); + return CLLD_PTR(clCreateCommandQueueWithProperties)( + context, device, properties, errcode_ret); +} + +#endif /* CL_VERSION_2_0 */ + +CLLD_DECL(clRetainCommandQueue); +inline CL_API_ENTRY cl_int CL_API_CALL +clRetainCommandQueue(cl_command_queue command_queue) { + CLLD_FETCH(clRetainCommandQueue); + return CLLD_PTR(clRetainCommandQueue)(command_queue); +} + +CLLD_DECL(clReleaseCommandQueue); +inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseCommandQueue(cl_command_queue command_queue) { + CLLD_FETCH(clReleaseCommandQueue); + return CLLD_PTR(clReleaseCommandQueue)(command_queue); +} + +CLLD_DECL(clGetCommandQueueInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetCommandQueueInfo(cl_command_queue command_queue, + cl_command_queue_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetCommandQueueInfo); + return CLLD_PTR(clGetCommandQueueInfo)( + command_queue, param_name, param_value_size, + param_value, param_value_size_ret); +} + +/* Memory Object APIs */ + +CLLD_DECL(clCreateBuffer); +inline CL_API_ENTRY cl_mem CL_API_CALL +clCreateBuffer(cl_context context, + cl_mem_flags flags, + size_t size, + void * host_ptr, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateBuffer, errcode_ret); + return CLLD_PTR(clCreateBuffer)( + context, flags, size, host_ptr, errcode_ret); +} + +#ifdef CL_VERSION_1_1 + +CLLD_DECL(clCreateSubBuffer); +inline CL_API_ENTRY cl_mem CL_API_CALL +clCreateSubBuffer(cl_mem buffer, + cl_mem_flags flags, + cl_buffer_create_type buffer_create_type, + const void * buffer_create_info, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateSubBuffer, errcode_ret); + return CLLD_PTR(clCreateSubBuffer)( + buffer, flags, buffer_create_type, buffer_create_info, errcode_ret); +} + +#endif /* CL_VERSION_1_1 */ + +#ifdef CL_VERSION_1_2 + +CLLD_DECL(clCreateImage); +inline CL_API_ENTRY cl_mem CL_API_CALL +clCreateImage(cl_context context, + cl_mem_flags flags, + const cl_image_format * image_format, + const cl_image_desc * image_desc, + void * host_ptr, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateImage, errcode_ret); + return CLLD_PTR(clCreateImage)( + context, flags, image_format, image_desc, host_ptr, errcode_ret); +} + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_0 + +CLLD_DECL(clCreatePipe); +inline CL_API_ENTRY cl_mem CL_API_CALL +clCreatePipe(cl_context context, + cl_mem_flags flags, + cl_uint pipe_packet_size, + cl_uint pipe_max_packets, + const cl_pipe_properties * properties, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreatePipe, errcode_ret); + return CLLD_PTR(clCreatePipe)( + context, flags, pipe_packet_size, pipe_max_packets, properties, errcode_ret); +} + +#endif /* CL_VERSION_2_0 */ + +#ifdef CL_VERSION_3_0 + +CLLD_DECL(clCreateBufferWithProperties); +inline 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) { + CLLD_FETCH_ERR(clCreateBufferWithProperties, errcode_ret); + return CLLD_PTR(clCreateBufferWithProperties)( + context, properties, flags, size, host_ptr, errcode_ret); +} + +CLLD_DECL(clCreateImageWithProperties); +inline 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) { + CLLD_FETCH_ERR(clCreateImageWithProperties, errcode_ret); + return CLLD_PTR(clCreateImageWithProperties)( + context, properties, flags, image_format, image_desc, host_ptr, errcode_ret); +} + +#endif /* CL_VERSION_3_0 */ + +CLLD_DECL(clRetainMemObject); +inline CL_API_ENTRY cl_int CL_API_CALL +clRetainMemObject(cl_mem memobj) { + CLLD_FETCH(clRetainMemObject); + return CLLD_PTR(clRetainMemObject)(memobj); +} + +CLLD_DECL(clReleaseMemObject); +inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseMemObject(cl_mem memobj) { + CLLD_FETCH(clReleaseMemObject); + return CLLD_PTR(clReleaseMemObject)(memobj); +} + +CLLD_DECL(clGetSupportedImageFormats); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetSupportedImageFormats(cl_context context, + cl_mem_flags flags, + cl_mem_object_type image_type, + cl_uint num_entries, + cl_image_format * image_formats, + cl_uint * num_image_formats) { + CLLD_FETCH(clGetSupportedImageFormats); + return CLLD_PTR(clGetSupportedImageFormats)( + context, flags, image_type, num_entries, image_formats, num_image_formats); +} + +CLLD_DECL(clGetMemObjectInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetMemObjectInfo(cl_mem memobj, + cl_mem_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetMemObjectInfo); + return CLLD_PTR(clGetMemObjectInfo)( + memobj, param_name, param_value_size, param_value, param_value_size_ret); +} + +CLLD_DECL(clGetImageInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetImageInfo(cl_mem image, + cl_image_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetImageInfo); + return CLLD_PTR(clGetImageInfo)( + image, param_name, param_value_size, param_value, param_value_size_ret); +} + +#ifdef CL_VERSION_2_0 + +CLLD_DECL(clGetPipeInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetPipeInfo(cl_mem pipe, + cl_pipe_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetPipeInfo); + return CLLD_PTR(clGetPipeInfo)( + pipe, param_name, param_value_size, param_value, param_value_size_ret); +} + +#endif /* CL_VERSION_2_0 */ + +#ifdef CL_VERSION_1_1 + +CLLD_DECL(clSetMemObjectDestructorCallback); +inline CL_API_ENTRY cl_int CL_API_CALL +clSetMemObjectDestructorCallback(cl_mem memobj, + void (CL_CALLBACK * pfn_notify)(cl_mem memobj, + void * user_data), + void * user_data) { + CLLD_FETCH(clSetMemObjectDestructorCallback); + return CLLD_PTR(clSetMemObjectDestructorCallback)( + memobj, pfn_notify, user_data); +} + +#endif /* CL_VERSION_1_1 */ + +/* SVM Allocation APIs */ + +#ifdef CL_VERSION_2_0 + +CLLD_DECL(clSVMAlloc); +inline CL_API_ENTRY void * CL_API_CALL +clSVMAlloc(cl_context context, + cl_svm_mem_flags flags, + size_t size, + cl_uint alignment) { + CLLD_FETCH_NULL(clSVMAlloc); + return CLLD_PTR(clSVMAlloc)( + context, flags, size, alignment); +} + +CLLD_DECL(clSVMFree); +inline CL_API_ENTRY void CL_API_CALL +clSVMFree(cl_context context, + void * svm_pointer) { + CLLD_FETCH_NOERR(clSVMFree); + CLLD_PTR(clSVMFree)(context, svm_pointer); +} + +#endif /* CL_VERSION_2_0 */ + +/* Sampler APIs */ + +#ifdef CL_VERSION_2_0 + +CLLD_DECL(clCreateSamplerWithProperties); +inline CL_API_ENTRY cl_sampler CL_API_CALL +clCreateSamplerWithProperties(cl_context context, + const cl_sampler_properties * sampler_properties, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateSamplerWithProperties, errcode_ret); + return CLLD_PTR(clCreateSamplerWithProperties)( + context, sampler_properties, errcode_ret); +} + +#endif /* CL_VERSION_2_0 */ + +CLLD_DECL(clRetainSampler); +inline CL_API_ENTRY cl_int CL_API_CALL +clRetainSampler(cl_sampler sampler) { + CLLD_FETCH(clRetainSampler); + return CLLD_PTR(clRetainSampler)(sampler); +} + +CLLD_DECL(clReleaseSampler); +inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseSampler(cl_sampler sampler) { + CLLD_FETCH(clReleaseSampler); + return CLLD_PTR(clReleaseSampler)(sampler); +} + +CLLD_DECL(clGetSamplerInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetSamplerInfo(cl_sampler sampler, + cl_sampler_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetSamplerInfo); + return CLLD_PTR(clGetSamplerInfo)( + sampler, param_name, param_value_size, param_value, param_value_size_ret); +} + +/* Program Object APIs */ + +CLLD_DECL(clCreateProgramWithSource); +inline CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithSource(cl_context context, + cl_uint count, + const char ** strings, + const size_t * lengths, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateProgramWithSource, errcode_ret); + return CLLD_PTR(clCreateProgramWithSource)( + context, count, strings, lengths, errcode_ret); +} + +CLLD_DECL(clCreateProgramWithBinary); +inline CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithBinary(cl_context context, + cl_uint num_devices, + const cl_device_id * device_list, + const size_t * lengths, + const unsigned char ** binaries, + cl_int * binary_status, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateProgramWithBinary, errcode_ret); + return CLLD_PTR(clCreateProgramWithBinary)( + context, num_devices, device_list, lengths, binaries, binary_status, errcode_ret); +} + +#ifdef CL_VERSION_1_2 + +CLLD_DECL(clCreateProgramWithBuiltInKernels); +inline CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithBuiltInKernels(cl_context context, + cl_uint num_devices, + const cl_device_id * device_list, + const char * kernel_names, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateProgramWithBuiltInKernels, errcode_ret); + return CLLD_PTR(clCreateProgramWithBuiltInKernels)( + context, num_devices, device_list, kernel_names, errcode_ret); +} + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_1 + +CLLD_DECL(clCreateProgramWithIL); +inline CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithIL(cl_context context, + const void* il, + size_t length, + cl_int* errcode_ret) { + CLLD_FETCH_ERR(clCreateProgramWithIL, errcode_ret); + return CLLD_PTR(clCreateProgramWithIL)( + context, il, length, errcode_ret); +} + +#endif /* CL_VERSION_2_1 */ + +CLLD_DECL(clRetainProgram); +inline CL_API_ENTRY cl_int CL_API_CALL +clRetainProgram(cl_program program) { + CLLD_FETCH(clRetainProgram); + return CLLD_PTR(clRetainProgram)(program); +} + +CLLD_DECL(clReleaseProgram); +inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseProgram(cl_program program) { + CLLD_FETCH(clReleaseProgram); + return CLLD_PTR(clReleaseProgram)(program); +} + +CLLD_DECL(clBuildProgram); +inline CL_API_ENTRY cl_int CL_API_CALL +clBuildProgram(cl_program program, + cl_uint num_devices, + const cl_device_id * device_list, + const char * options, + void (CL_CALLBACK * pfn_notify)(cl_program program, + void * user_data), + void * user_data) { + CLLD_FETCH(clBuildProgram); + return CLLD_PTR(clBuildProgram)( + program, num_devices, device_list, options, pfn_notify, user_data); +} + +#ifdef CL_VERSION_1_2 + +CLLD_DECL(clCompileProgram); +inline CL_API_ENTRY cl_int CL_API_CALL +clCompileProgram(cl_program program, + cl_uint num_devices, + const cl_device_id * device_list, + const char * options, + cl_uint num_input_headers, + const cl_program * input_headers, + const char ** header_include_names, + void (CL_CALLBACK * pfn_notify)(cl_program program, + void * user_data), + void * user_data) { + CLLD_FETCH(clCompileProgram); + return CLLD_PTR(clCompileProgram)( + program, num_devices, device_list, options, num_input_headers, input_headers, + header_include_names, pfn_notify, user_data); +} + +CLLD_DECL(clLinkProgram); +inline CL_API_ENTRY cl_program CL_API_CALL +clLinkProgram(cl_context context, + cl_uint num_devices, + const cl_device_id * device_list, + const char * options, + cl_uint num_input_programs, + const cl_program * input_programs, + void (CL_CALLBACK * pfn_notify)(cl_program program, + void * user_data), + void * user_data, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clLinkProgram, errcode_ret); + return CLLD_PTR(clLinkProgram)( + context, num_devices, device_list, options, num_input_programs, + input_programs, pfn_notify, user_data, errcode_ret); +} + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_2 + +CLLD_DECL(clSetProgramReleaseCallback); +inline CL_API_ENTRY CL_API_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) { + CLLD_FETCH(clSetProgramReleaseCallback); + return CLLD_PTR(clSetProgramReleaseCallback)( + program, pfn_notify, user_data); +} + +CLLD_DECL(clSetProgramSpecializationConstant); +inline CL_API_ENTRY cl_int CL_API_CALL +clSetProgramSpecializationConstant(cl_program program, + cl_uint spec_id, + size_t spec_size, + const void* spec_value) { + CLLD_FETCH(clSetProgramSpecializationConstant); + return CLLD_PTR(clSetProgramSpecializationConstant)( + program, spec_id, spec_size, spec_value); +} + +#endif /* CL_VERSION_2_2 */ + +#ifdef CL_VERSION_1_2 + +CLLD_DECL(clUnloadPlatformCompiler); +inline CL_API_ENTRY cl_int CL_API_CALL +clUnloadPlatformCompiler(cl_platform_id platform) { + CLLD_FETCH(clUnloadPlatformCompiler); + return CLLD_PTR(clUnloadPlatformCompiler)(platform); +} + +#endif /* CL_VERSION_1_2 */ + +CLLD_DECL(clGetProgramInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetProgramInfo(cl_program program, + cl_program_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetProgramInfo); + return CLLD_PTR(clGetProgramInfo)( + program, param_name, param_value_size, param_value, param_value_size_ret); +} + +CLLD_DECL(clGetProgramBuildInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetProgramBuildInfo(cl_program program, + cl_device_id device, + cl_program_build_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetProgramBuildInfo); + return CLLD_PTR(clGetProgramBuildInfo)( + program, device, param_name, param_value_size, param_value, param_value_size_ret); +} + +/* Kernel Object APIs */ + +CLLD_DECL(clCreateKernel); +inline CL_API_ENTRY cl_kernel CL_API_CALL +clCreateKernel(cl_program program, + const char * kernel_name, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateKernel, errcode_ret); + return CLLD_PTR(clCreateKernel)( + program, kernel_name, errcode_ret); +} + +CLLD_DECL(clCreateKernelsInProgram); +inline CL_API_ENTRY cl_int CL_API_CALL +clCreateKernelsInProgram(cl_program program, + cl_uint num_kernels, + cl_kernel * kernels, + cl_uint * num_kernels_ret) { + CLLD_FETCH(clCreateKernelsInProgram); + return CLLD_PTR(clCreateKernelsInProgram)( + program, num_kernels, kernels, num_kernels_ret); +} + +#ifdef CL_VERSION_2_1 + +CLLD_DECL(clCloneKernel); +inline CL_API_ENTRY cl_kernel CL_API_CALL +clCloneKernel(cl_kernel source_kernel, + cl_int* errcode_ret) { + CLLD_FETCH_ERR(clCloneKernel, errcode_ret); + return CLLD_PTR(clCloneKernel)( + source_kernel, errcode_ret); +} + +#endif /* CL_VERSION_2_1 */ + +CLLD_DECL(clRetainKernel); +inline CL_API_ENTRY cl_int CL_API_CALL +clRetainKernel(cl_kernel kernel) { + CLLD_FETCH(clRetainKernel); + return CLLD_PTR(clRetainKernel)(kernel); +} + +CLLD_DECL(clReleaseKernel); +inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseKernel(cl_kernel kernel) { + CLLD_FETCH(clReleaseKernel); + return CLLD_PTR(clReleaseKernel)(kernel); +} + +CLLD_DECL(clSetKernelArg); +inline CL_API_ENTRY cl_int CL_API_CALL +clSetKernelArg(cl_kernel kernel, + cl_uint arg_index, + size_t arg_size, + const void * arg_value) { + CLLD_FETCH(clSetKernelArg); + return CLLD_PTR(clSetKernelArg)( + kernel, arg_index, arg_size, arg_value); +} + +#ifdef CL_VERSION_2_0 + +CLLD_DECL(clSetKernelArgSVMPointer); +inline CL_API_ENTRY cl_int CL_API_CALL +clSetKernelArgSVMPointer(cl_kernel kernel, + cl_uint arg_index, + const void * arg_value) { + CLLD_FETCH(clSetKernelArgSVMPointer); + return CLLD_PTR(clSetKernelArgSVMPointer)( + kernel, arg_index, arg_value); +} + +CLLD_DECL(clSetKernelExecInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clSetKernelExecInfo(cl_kernel kernel, + cl_kernel_exec_info param_name, + size_t param_value_size, + const void * param_value) { + CLLD_FETCH(clSetKernelExecInfo); + return CLLD_PTR(clSetKernelExecInfo)( + kernel, param_name, param_value_size, param_value); +} + +#endif /* CL_VERSION_2_0 */ + +CLLD_DECL(clGetKernelInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetKernelInfo(cl_kernel kernel, + cl_kernel_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetKernelInfo); + return CLLD_PTR(clGetKernelInfo)( + kernel, param_name, param_value_size, param_value, param_value_size_ret); +} + +#ifdef CL_VERSION_1_2 + +CLLD_DECL(clGetKernelArgInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetKernelArgInfo(cl_kernel kernel, + cl_uint arg_indx, + cl_kernel_arg_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetKernelArgInfo); + return CLLD_PTR(clGetKernelArgInfo)( + kernel, arg_indx, param_name, param_value_size, + param_value, param_value_size_ret); +} + +#endif /* CL_VERSION_1_2 */ + +CLLD_DECL(clGetKernelWorkGroupInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetKernelWorkGroupInfo(cl_kernel kernel, + cl_device_id device, + cl_kernel_work_group_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetKernelWorkGroupInfo); + return CLLD_PTR(clGetKernelWorkGroupInfo)( + kernel, device, param_name, param_value_size, param_value, param_value_size_ret); +} + +#ifdef CL_VERSION_2_1 + +CLLD_DECL(clGetKernelSubGroupInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetKernelSubGroupInfo(cl_kernel kernel, + cl_device_id device, + cl_kernel_sub_group_info param_name, + size_t input_value_size, + const void* input_value, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret) { + CLLD_FETCH(clGetKernelSubGroupInfo); + return CLLD_PTR(clGetKernelSubGroupInfo)( + kernel, device, param_name, input_value_size, input_value, + param_value_size, param_value, param_value_size_ret); +} + +#endif /* CL_VERSION_2_1 */ + +/* Event Object APIs */ + +CLLD_DECL(clWaitForEvents); +inline CL_API_ENTRY cl_int CL_API_CALL +clWaitForEvents(cl_uint num_events, + const cl_event * event_list) { + CLLD_FETCH(clWaitForEvents); + return CLLD_PTR(clWaitForEvents)( + num_events, event_list); +} + +CLLD_DECL(clGetEventInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetEventInfo(cl_event event, + cl_event_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetEventInfo); + return CLLD_PTR(clGetEventInfo)( + event, param_name, param_value_size, param_value, param_value_size_ret); +} + +#ifdef CL_VERSION_1_1 + +CLLD_DECL(clCreateUserEvent); +inline CL_API_ENTRY cl_event CL_API_CALL +clCreateUserEvent(cl_context context, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateUserEvent, errcode_ret); + return CLLD_PTR(clCreateUserEvent)( + context, errcode_ret); +} + +#endif /* CL_VERSION_1_1 */ + +CLLD_DECL(clRetainEvent); +inline CL_API_ENTRY cl_int CL_API_CALL +clRetainEvent(cl_event event) { + CLLD_FETCH(clRetainEvent); + return CLLD_PTR(clRetainEvent)(event); +} + +CLLD_DECL(clReleaseEvent); +inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseEvent(cl_event event) { + CLLD_FETCH(clReleaseEvent); + return CLLD_PTR(clReleaseEvent)(event); +} + +#ifdef CL_VERSION_1_1 + +CLLD_DECL(clSetUserEventStatus); +inline CL_API_ENTRY cl_int CL_API_CALL +clSetUserEventStatus(cl_event event, + cl_int execution_status) { + CLLD_FETCH(clSetUserEventStatus); + return CLLD_PTR(clSetUserEventStatus)( + event, execution_status); +} + +CLLD_DECL(clSetEventCallback); +inline CL_API_ENTRY cl_int CL_API_CALL +clSetEventCallback(cl_event event, + cl_int command_exec_callback_type, + void (CL_CALLBACK * pfn_notify)(cl_event event, + cl_int event_command_status, + void * user_data), + void * user_data) { + CLLD_FETCH(clSetEventCallback); + return CLLD_PTR(clSetEventCallback)( + event, command_exec_callback_type, pfn_notify, user_data); +} + +#endif /* CL_VERSION_1_1 */ + +/* Profiling APIs */ + +CLLD_DECL(clGetEventProfilingInfo); +inline CL_API_ENTRY cl_int CL_API_CALL +clGetEventProfilingInfo(cl_event event, + cl_profiling_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetEventProfilingInfo); + return CLLD_PTR(clGetEventProfilingInfo)( + event, param_name, param_value_size, param_value, param_value_size_ret); +} + +/* Flush and Finish APIs */ + +CLLD_DECL(clFlush); +inline CL_API_ENTRY cl_int CL_API_CALL +clFlush(cl_command_queue command_queue) { + CLLD_FETCH(clFlush); + return CLLD_PTR(clFlush)(command_queue); +} + +CLLD_DECL(clFinish); +inline CL_API_ENTRY cl_int CL_API_CALL +clFinish(cl_command_queue command_queue) { + CLLD_FETCH(clFinish); + return CLLD_PTR(clFinish)(command_queue); +} + +/* Enqueued Commands APIs */ + +CLLD_DECL(clEnqueueReadBuffer); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReadBuffer(cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_read, + size_t offset, + size_t size, + void * ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueReadBuffer); + return CLLD_PTR(clEnqueueReadBuffer)( + command_queue, buffer, blocking_read, offset, size, + ptr, num_events_in_wait_list, event_wait_list, event); +} + +#ifdef CL_VERSION_1_1 + +CLLD_DECL(clEnqueueReadBufferRect); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReadBufferRect(cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_read, + const size_t * buffer_origin, + const size_t * host_origin, + const size_t * region, + size_t buffer_row_pitch, + size_t buffer_slice_pitch, + size_t host_row_pitch, + size_t host_slice_pitch, + void * ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueReadBufferRect); + return CLLD_PTR(clEnqueueReadBufferRect)( + command_queue, buffer, blocking_read, buffer_origin, host_origin, region, + buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, + ptr, num_events_in_wait_list, event_wait_list, event); +} + +#endif /* CL_VERSION_1_1 */ + +CLLD_DECL(clEnqueueWriteBuffer); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueWriteBuffer(cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_write, + size_t offset, + size_t size, + const void * ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueWriteBuffer); + return CLLD_PTR(clEnqueueWriteBuffer)( + command_queue, buffer, blocking_write, offset, size, + ptr, num_events_in_wait_list, event_wait_list, event); +} + +#ifdef CL_VERSION_1_1 + +CLLD_DECL(clEnqueueWriteBufferRect); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueWriteBufferRect(cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_write, + const size_t * buffer_origin, + const size_t * host_origin, + const size_t * region, + size_t buffer_row_pitch, + size_t buffer_slice_pitch, + size_t host_row_pitch, + size_t host_slice_pitch, + const void * ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueWriteBufferRect); + return CLLD_PTR(clEnqueueWriteBufferRect)( + command_queue, buffer, blocking_write, buffer_origin, host_origin, region, + buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, + ptr, num_events_in_wait_list, event_wait_list, event); +} + +#endif /* CL_VERSION_1_1 */ + +#ifdef CL_VERSION_1_2 + +CLLD_DECL(clEnqueueFillBuffer); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueFillBuffer(cl_command_queue command_queue, + cl_mem buffer, + const void * pattern, + size_t pattern_size, + size_t offset, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueFillBuffer); + return CLLD_PTR(clEnqueueFillBuffer)( + command_queue, buffer, pattern, pattern_size, offset, size, + num_events_in_wait_list, event_wait_list, event); +} + +#endif /* CL_VERSION_1_2 */ + +CLLD_DECL(clEnqueueCopyBuffer); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueCopyBuffer(cl_command_queue command_queue, + cl_mem src_buffer, + cl_mem dst_buffer, + size_t src_offset, + size_t dst_offset, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueCopyBuffer); + return CLLD_PTR(clEnqueueCopyBuffer)( + command_queue, src_buffer, dst_buffer, src_offset, dst_offset, + size, num_events_in_wait_list, event_wait_list, event); +} + +#ifdef CL_VERSION_1_1 + +CLLD_DECL(clEnqueueCopyBufferRect); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueCopyBufferRect(cl_command_queue command_queue, + cl_mem src_buffer, + cl_mem dst_buffer, + const size_t * src_origin, + const size_t * dst_origin, + const size_t * region, + size_t src_row_pitch, + size_t src_slice_pitch, + size_t dst_row_pitch, + size_t dst_slice_pitch, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueCopyBufferRect); + return CLLD_PTR(clEnqueueCopyBufferRect)( + command_queue, src_buffer, dst_buffer, src_origin, dst_origin, + region, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, + num_events_in_wait_list, event_wait_list, event); +} + +#endif /* CL_VERSION_1_1 */ + +CLLD_DECL(clEnqueueReadImage); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReadImage(cl_command_queue command_queue, + cl_mem image, + cl_bool blocking_read, + const size_t * origin, + const size_t * region, + size_t row_pitch, + size_t slice_pitch, + void * ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueReadImage); + return CLLD_PTR(clEnqueueReadImage)( + command_queue, image, blocking_read, origin, region, row_pitch, + slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); +} + +CLLD_DECL(clEnqueueWriteImage); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueWriteImage(cl_command_queue command_queue, + cl_mem image, + cl_bool blocking_write, + const size_t * origin, + const size_t * region, + size_t input_row_pitch, + size_t input_slice_pitch, + const void * ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueWriteImage); + return CLLD_PTR(clEnqueueWriteImage)( + command_queue, image, blocking_write, origin, region, input_row_pitch, + input_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); +} + +#ifdef CL_VERSION_1_2 + +CLLD_DECL(clEnqueueFillImage); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueFillImage(cl_command_queue command_queue, + cl_mem image, + const void * fill_color, + const size_t * origin, + const size_t * region, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueFillImage); + return CLLD_PTR(clEnqueueFillImage)( + command_queue, image, fill_color, origin, region, + num_events_in_wait_list, event_wait_list, event); +} + +#endif /* CL_VERSION_1_2 */ + +CLLD_DECL(clEnqueueCopyImage); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueCopyImage(cl_command_queue command_queue, + cl_mem src_image, + cl_mem dst_image, + const size_t * src_origin, + const size_t * dst_origin, + const size_t * region, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueCopyImage); + return CLLD_PTR(clEnqueueCopyImage)( + command_queue, src_image, dst_image, src_origin, dst_origin, + region, num_events_in_wait_list, event_wait_list, event); +} + +CLLD_DECL(clEnqueueCopyImageToBuffer); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueCopyImageToBuffer(cl_command_queue command_queue, + cl_mem src_image, + cl_mem dst_buffer, + const size_t * src_origin, + const size_t * region, + size_t dst_offset, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueCopyImageToBuffer); + return CLLD_PTR(clEnqueueCopyImageToBuffer)( + command_queue, src_image, dst_buffer, src_origin, region, + dst_offset, num_events_in_wait_list, event_wait_list, event); +} + +CLLD_DECL(clEnqueueCopyBufferToImage); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueCopyBufferToImage(cl_command_queue command_queue, + cl_mem src_buffer, + cl_mem dst_image, + size_t src_offset, + const size_t * dst_origin, + const size_t * region, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueCopyBufferToImage); + return CLLD_PTR(clEnqueueCopyBufferToImage)( + command_queue, src_buffer, dst_image, src_offset,dst_origin, + region, num_events_in_wait_list, event_wait_list, event); +} + +CLLD_DECL(clEnqueueMapBuffer); +inline CL_API_ENTRY void * CL_API_CALL +clEnqueueMapBuffer(cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_map, + cl_map_flags map_flags, + size_t offset, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clEnqueueMapBuffer, errcode_ret); + return CLLD_PTR(clEnqueueMapBuffer)( + command_queue, buffer, blocking_map, map_flags, offset, size, + num_events_in_wait_list, event_wait_list, event, errcode_ret); +} + +CLLD_DECL(clEnqueueMapImage); +inline CL_API_ENTRY void * CL_API_CALL +clEnqueueMapImage(cl_command_queue command_queue, + cl_mem image, + cl_bool blocking_map, + cl_map_flags map_flags, + const size_t * origin, + const size_t * region, + size_t * image_row_pitch, + size_t * image_slice_pitch, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clEnqueueMapImage, errcode_ret); + return CLLD_PTR(clEnqueueMapImage)( + command_queue, image, blocking_map, map_flags, origin, region, + image_row_pitch, image_slice_pitch, num_events_in_wait_list, + event_wait_list, event, errcode_ret); +} + +CLLD_DECL(clEnqueueUnmapMemObject); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueUnmapMemObject(cl_command_queue command_queue, + cl_mem memobj, + void * mapped_ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueUnmapMemObject); + return CLLD_PTR(clEnqueueUnmapMemObject)( + command_queue, memobj, mapped_ptr, + num_events_in_wait_list, event_wait_list, event); +} + +#ifdef CL_VERSION_1_2 + +CLLD_DECL(clEnqueueMigrateMemObjects); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueMigrateMemObjects(cl_command_queue command_queue, + cl_uint num_mem_objects, + const cl_mem * mem_objects, + cl_mem_migration_flags flags, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueMigrateMemObjects); + return CLLD_PTR(clEnqueueMigrateMemObjects)( + command_queue, num_mem_objects, mem_objects, flags, + num_events_in_wait_list, event_wait_list, event); +} + +#endif /* CL_VERSION_1_2 */ + +CLLD_DECL(clEnqueueNDRangeKernel); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueNDRangeKernel(cl_command_queue command_queue, + cl_kernel kernel, + cl_uint work_dim, + const size_t * global_work_offset, + const size_t * global_work_size, + const size_t * local_work_size, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueNDRangeKernel); + return CLLD_PTR(clEnqueueNDRangeKernel)( + command_queue, kernel, work_dim, global_work_offset,global_work_size, + local_work_size, num_events_in_wait_list, event_wait_list, event); +} + +CLLD_DECL(clEnqueueNativeKernel); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueNativeKernel(cl_command_queue command_queue, + void (CL_CALLBACK * user_func)(void *), + void * args, + size_t cb_args, + cl_uint num_mem_objects, + const cl_mem * mem_list, + const void ** args_mem_loc, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueNativeKernel); + return CLLD_PTR(clEnqueueNativeKernel)( + command_queue, user_func, args, cb_args, num_mem_objects, mem_list, + args_mem_loc, num_events_in_wait_list, event_wait_list, event); +} + +#ifdef CL_VERSION_1_2 + +CLLD_DECL(clEnqueueMarkerWithWaitList); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueMarkerWithWaitList(cl_command_queue command_queue, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueMarkerWithWaitList); + return CLLD_PTR(clEnqueueMarkerWithWaitList)( + command_queue, num_events_in_wait_list, event_wait_list, event); +} + +CLLD_DECL(clEnqueueBarrierWithWaitList); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueBarrierWithWaitList(cl_command_queue command_queue, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueBarrierWithWaitList); + return CLLD_PTR(clEnqueueBarrierWithWaitList)( + command_queue, num_events_in_wait_list, event_wait_list, event); +} + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_0 + +CLLD_DECL(clEnqueueSVMFree); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMFree(cl_command_queue command_queue, + cl_uint num_svm_pointers, + void * svm_pointers[], + void (CL_CALLBACK * pfn_free_func)(cl_command_queue queue, + cl_uint num_svm_pointers, + void * svm_pointers[], + void * user_data), + void * user_data, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueSVMFree); + return CLLD_PTR(clEnqueueSVMFree)( + command_queue, num_svm_pointers, svm_pointers, pfn_free_func, + user_data, num_events_in_wait_list, event_wait_list, event); +} + +CLLD_DECL(clEnqueueSVMMemcpy); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMMemcpy(cl_command_queue command_queue, + cl_bool blocking_copy, + void * dst_ptr, + const void * src_ptr, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueSVMMemcpy); + return CLLD_PTR(clEnqueueSVMMemcpy)( + command_queue, blocking_copy, dst_ptr, src_ptr, size, + num_events_in_wait_list, event_wait_list, event); +} + +CLLD_DECL(clEnqueueSVMMemFill); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMMemFill(cl_command_queue command_queue, + void * svm_ptr, + const void * pattern, + size_t pattern_size, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueSVMMemFill); + return CLLD_PTR(clEnqueueSVMMemFill)( + command_queue, svm_ptr, pattern, pattern_size, size, + num_events_in_wait_list, event_wait_list, event); +} + +CLLD_DECL(clEnqueueSVMMap); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMMap(cl_command_queue command_queue, + cl_bool blocking_map, + cl_map_flags flags, + void * svm_ptr, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueSVMMap); + return CLLD_PTR(clEnqueueSVMMap)( + command_queue, blocking_map, flags, svm_ptr, size, + num_events_in_wait_list, event_wait_list, event); +} + +CLLD_DECL(clEnqueueSVMUnmap); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMUnmap(cl_command_queue command_queue, + void * svm_ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueSVMUnmap); + return CLLD_PTR(clEnqueueSVMUnmap)( + command_queue, svm_ptr, num_events_in_wait_list, + event_wait_list, event); +} + +#endif /* CL_VERSION_2_0 */ + +#ifdef CL_VERSION_2_1 + +CLLD_DECL(clEnqueueSVMMigrateMem); +inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMMigrateMem(cl_command_queue command_queue, + cl_uint num_svm_pointers, + const void ** svm_pointers, + const size_t * sizes, + cl_mem_migration_flags flags, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueSVMMigrateMem); + return CLLD_PTR(clEnqueueSVMMigrateMem)( + command_queue, num_svm_pointers, svm_pointers, sizes, + flags, num_events_in_wait_list, event_wait_list, event); +} + +#endif /* CL_VERSION_2_1 */ + +#ifdef CL_VERSION_1_2 + +CLLD_DECL(clGetExtensionFunctionAddressForPlatform); +inline CL_API_ENTRY void * CL_API_CALL +clGetExtensionFunctionAddressForPlatform(cl_platform_id platform, + const char * func_name) { + CLLD_FETCH_NULL(clGetExtensionFunctionAddressForPlatform); + return CLLD_PTR(clGetExtensionFunctionAddressForPlatform)( + platform, func_name); +} + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS + +CLLD_DECL(clSetCommandQueueProperty); +inline CL_API_ENTRY cl_int CL_API_CALL +clSetCommandQueueProperty(cl_command_queue command_queue, + cl_command_queue_properties properties, + cl_bool enable, + cl_command_queue_properties * old_properties) { + CLLD_FETCH(clSetCommandQueueProperty); + return CLLD_PTR(clSetCommandQueueProperty)( + command_queue, properties, enable, old_properties); +} + +#endif /* CL_USE_DEPRECATED_OPENCL_1_0_APIS */ + +/* Deprecated OpenCL 1.1 APIs */ + +CLLD_DECL(clCreateImage2D); +inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL +clCreateImage2D(cl_context context, + cl_mem_flags flags, + const cl_image_format * image_format, + size_t image_width, + size_t image_height, + size_t image_row_pitch, + void * host_ptr, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateImage2D, errcode_ret); + return CLLD_PTR(clCreateImage2D)( + context, flags, image_format, image_width, + image_height, image_row_pitch, host_ptr, errcode_ret); +} + +CLLD_DECL(clCreateImage3D); +inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL +clCreateImage3D(cl_context context, + cl_mem_flags flags, + const cl_image_format * image_format, + size_t image_width, + size_t image_height, + size_t image_depth, + size_t image_row_pitch, + size_t image_slice_pitch, + void * host_ptr, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateImage3D, errcode_ret); + return CLLD_PTR(clCreateImage3D)( + context, flags, image_format, image_width, image_height, image_depth, + image_row_pitch, image_slice_pitch, host_ptr, errcode_ret); +} + +CLLD_DECL(clEnqueueMarker); +inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +clEnqueueMarker(cl_command_queue command_queue, + cl_event * event) { + CLLD_FETCH(clEnqueueMarker); + return CLLD_PTR(clEnqueueMarker)(command_queue, event); +} + +CLLD_DECL(clEnqueueWaitForEvents); +inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +clEnqueueWaitForEvents(cl_command_queue command_queue, + cl_uint num_events, + const cl_event * event_list) { + CLLD_FETCH(clEnqueueWaitForEvents); + return CLLD_PTR(clEnqueueWaitForEvents)( + command_queue, num_events, event_list); +} + +CLLD_DECL(clEnqueueBarrier); +inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +clEnqueueBarrier(cl_command_queue command_queue) { + CLLD_FETCH(clEnqueueBarrier); + return CLLD_PTR(clEnqueueBarrier)(command_queue); +} + +CLLD_DECL(clUnloadCompiler); +inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +clUnloadCompiler(void) { + CLLD_FETCH(clUnloadCompiler); + return CLLD_PTR(clUnloadCompiler)(); +} + +CLLD_DECL(clGetExtensionFunctionAddress); +inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED void * CL_API_CALL +clGetExtensionFunctionAddress(const char * func_name) { + CLLD_FETCH_NULL(clGetExtensionFunctionAddress); + return CLLD_PTR(clGetExtensionFunctionAddress)(func_name); +} + +/* Deprecated OpenCL 2.0 APIs */ + +CLLD_DECL(clCreateCommandQueue); +inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_command_queue CL_API_CALL +clCreateCommandQueue(cl_context context, + cl_device_id device, + cl_command_queue_properties properties, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateCommandQueue, errcode_ret); + return CLLD_PTR(clCreateCommandQueue)( + context, device, properties, errcode_ret); +} + +CLLD_DECL(clCreateSampler); +inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_sampler CL_API_CALL +clCreateSampler(cl_context context, + cl_bool normalized_coords, + cl_addressing_mode addressing_mode, + cl_filter_mode filter_mode, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateSampler, errcode_ret); + return CLLD_PTR(clCreateSampler)( + context, normalized_coords, addressing_mode, filter_mode, errcode_ret); +} + +CLLD_DECL(clEnqueueTask); +inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_int CL_API_CALL +clEnqueueTask(cl_command_queue command_queue, + cl_kernel kernel, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueTask); + return CLLD_PTR(clEnqueueTask)( + command_queue, kernel, num_events_in_wait_list, event_wait_list, event); +} + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_LOAD */ + +#endif /* OPENCL_CL_LOAD_H_ */ diff --git a/CL/opencl.h b/CL/opencl.h index ef8dd1e0..20e4f964 100644 --- a/CL/opencl.h +++ b/CL/opencl.h @@ -22,6 +22,7 @@ extern "C" { #endif #include +#include #include #include diff --git a/CL/opencl_load.h b/CL/opencl_load.h new file mode 100644 index 00000000..7ff45391 --- /dev/null +++ b/CL/opencl_load.h @@ -0,0 +1,100 @@ +/******************************************************************************* + * Copyright (c) 2008-2021 The Khronos Group Inc. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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_DLOPEN_H +#define OPENCL_DLOPEN_H + +#ifdef OPENCL_LOAD + +#ifdef _WIN32 +#include +#else +#include +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern +#ifdef _WIN32 +HMODULE +#else +void * +#endif +opencl_lib_handle; + +cl_int extOpenOpenCL(); + +inline cl_int +extFindOpenCLSymbol(void **pVar, const char *symbolName) { + if(!opencl_lib_handle) { + cl_int err = extOpenOpenCL(); + if(err != CL_SUCCESS) + return err; + } + *pVar = dlsym(opencl_lib_handle, symbolName); + if (!*pVar) + return CL_INVALID_OPERATION; + else + return CL_SUCCESS; +} + +#define CLLD_PTR_NAME(name) name ## _ptr + +#define CLLD_PTR CLLD_PTR_NAME + +#define CLLD_DECL(name) \ +extern cl_api_ ## name CLLD_PTR_NAME(name) + +#define CLLD_DEF(name) \ +cl_api_ ## name CLLD_PTR_NAME(name) + +#define CLLD_FETCH_SYMBOL(name) \ +extFindOpenCLSymbol((void**)&CLLD_PTR_NAME(name), #name) + +#define CLLD_FETCH_RET(name, ret) \ +do { \ + if (!CLLD_PTR_NAME(name)) { \ + cl_int _err = CLLD_FETCH_SYMBOL(name); \ + if (_err != CL_SUCCESS) return ret; \ + } \ +} while(0) + +#define CLLD_FETCH(name) CLLD_FETCH_RET(name, _err) +#define CLLD_FETCH_NULL(name) CLLD_FETCH_RET(name, NULL) +#define CLLD_FETCH_NOERR(name) CLLD_FETCH_RET(name, ) + +#define CLLD_FETCH_ERR(name, errcode_ret) \ +do { \ + if (!CLLD_PTR(name)) { \ + cl_int _err = CLLD_FETCH_SYMBOL(name); \ + if (_err != CL_SUCCESS) { \ + if (errcode_ret) \ + *errcode_ret = _err; \ + return NULL; \ + } \ + } \ +} while(0) + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_LOAD */ + +#endif /* OPENCL_DLOPEN_H */ diff --git a/CL/opencl_load_lib.h b/CL/opencl_load_lib.h new file mode 100644 index 00000000..3e517c0d --- /dev/null +++ b/CL/opencl_load_lib.h @@ -0,0 +1,1157 @@ +/******************************************************************************* + * Copyright (c) 2008-2021 The Khronos Group Inc. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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_DLOPEN_LIB_H +#define OPENCL_DLOPEN_LIB_H + +#ifdef OPENCL_LOAD + +#ifdef _WIN32 +#include +#else +#include +#include +#endif + +#include + +#ifdef _WIN32 +static INIT_ONCE initialized = INIT_ONCE_STATIC_INIT; +HMODULE opencl_lib_handle; +#else +static pthread_once_t initialized = PTHREAD_ONCE_INIT; +void *opencl_lib_handle; +#endif + +#ifdef _WIN32 +static void extOpenOpenCL_impl(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContext) { + (void)InitOnce; (void)Parameter; (void)lpContext; + opencl_lib_handle = LoadLibraryExA(libraryName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + if (!opencl_lib_handle && GetLastError() == ERROR_INVALID_PARAMETER) + { + opencl_lib_handle = LoadLibraryExA("OpencL", NULL, 0); + } +} +#else +static void extOpenOpenCL_impl() { + opencl_lib_handle = dlopen("libOpenCL.so", RTLD_LAZY | RTLD_LOCAL | RTLD_DEEPBIND); +} +#endif + +cl_int extOpenOpenCL() { +#ifdef _WIN32 + InitOnceExecuteOnce(&initialized, extOpenOpenCL_impl, NULL, NULL); +#else + pthread_once(&initialized, extOpenOpenCL_impl); +#endif + if (!opencl_lib_handle) { + return CL_PLATFORM_NOT_FOUND_KHR; + } else { + return CL_SUCCESS; + } +} + +extern inline cl_int +extFindOpenCLSymbol(void **pVar, const char *symbolName); + +/* Platform APIs */ + +CLLD_DEF(clGetPlatformIDs); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetPlatformIDs(cl_uint num_entries, + cl_platform_id * platforms, + cl_uint * num_platforms) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clGetPlatformInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetPlatformInfo(cl_platform_id platform, + cl_platform_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +/* Device APIs */ + +CLLD_DEF(clGetDeviceIDs); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetDeviceIDs(cl_platform_id platform, + cl_device_type device_type, + cl_uint num_entries, + cl_device_id * devices, + cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clGetDeviceInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetDeviceInfo(cl_device_id device, + cl_device_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +CLLD_DEF(clCreateSubDevices); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clCreateSubDevices(cl_device_id in_device, + const cl_device_partition_property * properties, + cl_uint num_devices, + cl_device_id * out_devices, + cl_uint * num_devices_ret) CL_API_SUFFIX__VERSION_1_2; + +CLLD_DEF(clRetainDevice); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clRetainDevice(cl_device_id device) CL_API_SUFFIX__VERSION_1_2; + +CLLD_DEF(clReleaseDevice); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseDevice(cl_device_id device) CL_API_SUFFIX__VERSION_1_2; + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_1 + +CLLD_DEF(clSetDefaultDeviceCommandQueue); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clSetDefaultDeviceCommandQueue(cl_context context, + cl_device_id device, + cl_command_queue command_queue) CL_API_SUFFIX__VERSION_2_1; + +CLLD_DEF(clGetDeviceAndHostTimer); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetDeviceAndHostTimer(cl_device_id device, + cl_ulong* device_timestamp, + cl_ulong* host_timestamp) CL_API_SUFFIX__VERSION_2_1; + +CLLD_DEF(clGetHostTimer); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetHostTimer(cl_device_id device, + cl_ulong * host_timestamp) CL_API_SUFFIX__VERSION_2_1; + +#endif /* CL_VERSION_2_1 */ + +/* Context APIs */ + +CLLD_DEF(clCreateContext); +extern inline CL_API_ENTRY cl_context CL_API_CALL +clCreateContext(const cl_context_properties * properties, + cl_uint num_devices, + const cl_device_id * devices, + void (CL_CALLBACK * pfn_notify)(const char * errinfo, + const void * private_info, + size_t cb, + void * user_data), + void * user_data, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clCreateContextFromType); +extern inline CL_API_ENTRY cl_context CL_API_CALL +clCreateContextFromType(const cl_context_properties * properties, + cl_device_type device_type, + void (CL_CALLBACK * pfn_notify)(const char * errinfo, + const void * private_info, + size_t cb, + void * user_data), + void * user_data, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clRetainContext); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clRetainContext(cl_context context) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clReleaseContext); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseContext(cl_context context) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clGetContextInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetContextInfo(cl_context context, + cl_context_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_3_0 + +CLLD_DEF(clSetContextDestructorCallback); +extern inline 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 /* CL_VERSION_3_0 */ + +/* Command Queue APIs */ + +#ifdef CL_VERSION_2_0 + +CLLD_DEF(clCreateCommandQueueWithProperties); +extern inline CL_API_ENTRY cl_command_queue CL_API_CALL +clCreateCommandQueueWithProperties(cl_context context, + cl_device_id device, + const cl_queue_properties * properties, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_2_0; + +#endif /* CL_VERSION_2_0 */ + +CLLD_DEF(clRetainCommandQueue); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clRetainCommandQueue(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clReleaseCommandQueue); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseCommandQueue(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clGetCommandQueueInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetCommandQueueInfo(cl_command_queue command_queue, + cl_command_queue_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +/* Memory Object APIs */ + +CLLD_DEF(clCreateBuffer); +extern inline CL_API_ENTRY cl_mem CL_API_CALL +clCreateBuffer(cl_context context, + cl_mem_flags flags, + size_t size, + void * host_ptr, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_1 + +CLLD_DEF(clCreateSubBuffer); +extern inline CL_API_ENTRY cl_mem CL_API_CALL +clCreateSubBuffer(cl_mem buffer, + cl_mem_flags flags, + cl_buffer_create_type buffer_create_type, + const void * buffer_create_info, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1; + +#endif /* CL_VERSION_1_1 */ + +#ifdef CL_VERSION_1_2 + +CLLD_DEF(clCreateImage); +extern inline CL_API_ENTRY cl_mem CL_API_CALL +clCreateImage(cl_context context, + 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_1_2; + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_0 + +CLLD_DEF(clCreatePipe); +extern inline CL_API_ENTRY cl_mem CL_API_CALL +clCreatePipe(cl_context context, + cl_mem_flags flags, + cl_uint pipe_packet_size, + cl_uint pipe_max_packets, + const cl_pipe_properties * properties, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_2_0; + +#endif /* CL_VERSION_2_0 */ + +#ifdef CL_VERSION_3_0 + +CLLD_DEF(clCreateBufferWithProperties); +extern inline 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; + +CLLD_DEF(clCreateImageWithProperties); +extern inline 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 /* CL_VERSION_3_0 */ + +CLLD_DEF(clRetainMemObject); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clRetainMemObject(cl_mem memobj) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clReleaseMemObject); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseMemObject(cl_mem memobj) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clGetSupportedImageFormats); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetSupportedImageFormats(cl_context context, + cl_mem_flags flags, + cl_mem_object_type image_type, + cl_uint num_entries, + cl_image_format * image_formats, + cl_uint * num_image_formats) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clGetMemObjectInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetMemObjectInfo(cl_mem memobj, + cl_mem_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clGetImageInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetImageInfo(cl_mem image, + cl_image_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_2_0 + +CLLD_DEF(clGetPipeInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetPipeInfo(cl_mem pipe, + cl_pipe_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_2_0; + +#endif /* CL_VERSION_2_0 */ + +#ifdef CL_VERSION_1_1 + +CLLD_DEF(clSetMemObjectDestructorCallback); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clSetMemObjectDestructorCallback(cl_mem memobj, + void (CL_CALLBACK * pfn_notify)(cl_mem memobj, + void * user_data), + void * user_data) CL_API_SUFFIX__VERSION_1_1; + +#endif /* CL_VERSION_1_1 */ + +#ifdef CL_VERSION_2_0 + +CLLD_DEF(clSVMAlloc); +extern inline CL_API_ENTRY void * CL_API_CALL +clSVMAlloc(cl_context context, + cl_svm_mem_flags flags, + size_t size, + cl_uint alignment) CL_API_SUFFIX__VERSION_2_0; + +CLLD_DEF(clSVMFree); +extern inline CL_API_ENTRY void CL_API_CALL +clSVMFree(cl_context context, + void * svm_pointer) CL_API_SUFFIX__VERSION_2_0; + +#endif /* CL_VERSION_2_0 */ + +/* Sampler APIs */ + +#ifdef CL_VERSION_2_0 + +CLLD_DEF(clCreateSamplerWithProperties); +extern inline CL_API_ENTRY cl_sampler CL_API_CALL +clCreateSamplerWithProperties(cl_context context, + const cl_sampler_properties * sampler_properties, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_2_0; + +#endif /* CL_VERSION_2_0 */ + +CLLD_DEF(clRetainSampler); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clRetainSampler(cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clReleaseSampler); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseSampler(cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clGetSamplerInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetSamplerInfo(cl_sampler sampler, + cl_sampler_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +/* Program Object APIs */ + +CLLD_DEF(clCreateProgramWithSource); +extern inline CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithSource(cl_context context, + cl_uint count, + const char ** strings, + const size_t * lengths, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clCreateProgramWithBinary); +extern inline CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithBinary(cl_context context, + cl_uint num_devices, + const cl_device_id * device_list, + const size_t * lengths, + const unsigned char ** binaries, + cl_int * binary_status, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +CLLD_DEF(clCreateProgramWithBuiltInKernels); +extern inline CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithBuiltInKernels(cl_context context, + cl_uint num_devices, + const cl_device_id * device_list, + const char * kernel_names, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_1 + +CLLD_DEF(clCreateProgramWithIL); +extern inline CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithIL(cl_context context, + const void* il, + size_t length, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_2_1; + +#endif /* CL_VERSION_2_1 */ + +CLLD_DEF(clRetainProgram); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clRetainProgram(cl_program program) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clReleaseProgram); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseProgram(cl_program program) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clBuildProgram); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clBuildProgram(cl_program program, + cl_uint num_devices, + const cl_device_id * device_list, + const char * options, + void (CL_CALLBACK * pfn_notify)(cl_program program, + void * user_data), + void * user_data) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +CLLD_DEF(clCompileProgram); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clCompileProgram(cl_program program, + cl_uint num_devices, + const cl_device_id * device_list, + const char * options, + cl_uint num_input_headers, + const cl_program * input_headers, + const char ** header_include_names, + void (CL_CALLBACK * pfn_notify)(cl_program program, + void * user_data), + void * user_data) CL_API_SUFFIX__VERSION_1_2; + +CLLD_DEF(clLinkProgram); +extern inline CL_API_ENTRY cl_program CL_API_CALL +clLinkProgram(cl_context context, + cl_uint num_devices, + const cl_device_id * device_list, + const char * options, + cl_uint num_input_programs, + const cl_program * input_programs, + void (CL_CALLBACK * pfn_notify)(cl_program program, + void * user_data), + void * user_data, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_2 + +CLLD_DEF(clSetProgramReleaseCallback); +extern inline CL_API_ENTRY CL_API_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_DEPRECATED; + +CLLD_DEF(clSetProgramSpecializationConstant); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clSetProgramSpecializationConstant(cl_program program, + cl_uint spec_id, + size_t spec_size, + const void* spec_value) CL_API_SUFFIX__VERSION_2_2; + +#endif /* CL_VERSION_2_2 */ + +#ifdef CL_VERSION_1_2 + +CLLD_DEF(clUnloadPlatformCompiler); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clUnloadPlatformCompiler(cl_platform_id platform) CL_API_SUFFIX__VERSION_1_2; + +#endif /* CL_VERSION_1_2 */ + +CLLD_DEF(clGetProgramInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetProgramInfo(cl_program program, + cl_program_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clGetProgramBuildInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetProgramBuildInfo(cl_program program, + cl_device_id device, + cl_program_build_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +/* Kernel Object APIs */ + +CLLD_DEF(clCreateKernel); +extern inline CL_API_ENTRY cl_kernel CL_API_CALL +clCreateKernel(cl_program program, + const char * kernel_name, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clCreateKernelsInProgram); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clCreateKernelsInProgram(cl_program program, + cl_uint num_kernels, + cl_kernel * kernels, + cl_uint * num_kernels_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_2_1 + +CLLD_DEF(clCloneKernel); +extern inline CL_API_ENTRY cl_kernel CL_API_CALL +clCloneKernel(cl_kernel source_kernel, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_2_1; + +#endif /* CL_VERSION_2_1 */ + +CLLD_DEF(clRetainKernel); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clRetainKernel(cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clReleaseKernel); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseKernel(cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clSetKernelArg); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clSetKernelArg(cl_kernel kernel, + cl_uint arg_index, + size_t arg_size, + const void * arg_value) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_2_0 + +CLLD_DEF(clSetKernelArgSVMPointer); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clSetKernelArgSVMPointer(cl_kernel kernel, + cl_uint arg_index, + const void * arg_value) CL_API_SUFFIX__VERSION_2_0; + +CLLD_DEF(clSetKernelExecInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clSetKernelExecInfo(cl_kernel kernel, + cl_kernel_exec_info param_name, + size_t param_value_size, + const void * param_value) CL_API_SUFFIX__VERSION_2_0; + +#endif /* CL_VERSION_2_0 */ + +CLLD_DEF(clGetKernelInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetKernelInfo(cl_kernel kernel, + cl_kernel_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +CLLD_DEF(clGetKernelArgInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetKernelArgInfo(cl_kernel kernel, + cl_uint arg_indx, + cl_kernel_arg_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_2; + +#endif /* CL_VERSION_1_2 */ + +CLLD_DEF(clGetKernelWorkGroupInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetKernelWorkGroupInfo(cl_kernel kernel, + cl_device_id device, + cl_kernel_work_group_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_2_1 + +CLLD_DEF(clGetKernelSubGroupInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetKernelSubGroupInfo(cl_kernel kernel, + cl_device_id device, + cl_kernel_sub_group_info param_name, + size_t input_value_size, + const void* input_value, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_2_1; + +#endif /* CL_VERSION_2_1 */ + +/* Event Object APIs */ + +CLLD_DEF(clWaitForEvents); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clWaitForEvents(cl_uint num_events, + const cl_event * event_list) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clGetEventInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetEventInfo(cl_event event, + cl_event_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_1 + +CLLD_DEF(clCreateUserEvent); +extern inline CL_API_ENTRY cl_event CL_API_CALL +clCreateUserEvent(cl_context context, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1; + +#endif /* CL_VERSION_1_1 */ + +CLLD_DEF(clRetainEvent); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clRetainEvent(cl_event event) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clReleaseEvent); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clReleaseEvent(cl_event event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_1 + +CLLD_DEF(clSetUserEventStatus); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clSetUserEventStatus(cl_event event, + cl_int execution_status) CL_API_SUFFIX__VERSION_1_1; + +CLLD_DEF(clSetEventCallback); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clSetEventCallback(cl_event event, + cl_int command_exec_callback_type, + void (CL_CALLBACK * pfn_notify)(cl_event event, + cl_int event_command_status, + void * user_data), + void * user_data) CL_API_SUFFIX__VERSION_1_1; + +#endif /* CL_VERSION_1_1 */ + +/* Profiling APIs */ + +CLLD_DEF(clGetEventProfilingInfo); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clGetEventProfilingInfo(cl_event event, + cl_profiling_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +/* Flush and Finish APIs */ + +CLLD_DEF(clFlush); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clFlush(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clFinish); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clFinish(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; + +/* Enqueued Commands APIs */ + +CLLD_DEF(clEnqueueReadBuffer); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReadBuffer(cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_read, + size_t offset, + size_t size, + void * ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_1 + +CLLD_DEF(clEnqueueReadBufferRect); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReadBufferRect(cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_read, + const size_t * buffer_origin, + const size_t * host_origin, + const size_t * region, + size_t buffer_row_pitch, + size_t buffer_slice_pitch, + size_t host_row_pitch, + size_t host_slice_pitch, + void * ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_1; + +#endif /* CL_VERSION_1_1 */ + +CLLD_DEF(clEnqueueWriteBuffer); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueWriteBuffer(cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_write, + size_t offset, + size_t size, + const void * ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_1 + +CLLD_DEF(clEnqueueWriteBufferRect); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueWriteBufferRect(cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_write, + const size_t * buffer_origin, + const size_t * host_origin, + const size_t * region, + size_t buffer_row_pitch, + size_t buffer_slice_pitch, + size_t host_row_pitch, + size_t host_slice_pitch, + const void * ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_1; + +#endif /* CL_VERSION_1_1 */ + +#ifdef CL_VERSION_1_2 + +CLLD_DEF(clEnqueueFillBuffer); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueFillBuffer(cl_command_queue command_queue, + cl_mem buffer, + const void * pattern, + size_t pattern_size, + size_t offset, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_2; + +#endif /* CL_VERSION_1_2 */ + +CLLD_DEF(clEnqueueCopyBuffer); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueCopyBuffer(cl_command_queue command_queue, + cl_mem src_buffer, + cl_mem dst_buffer, + size_t src_offset, + size_t dst_offset, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_1 + +CLLD_DEF(clEnqueueCopyBufferRect); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueCopyBufferRect(cl_command_queue command_queue, + cl_mem src_buffer, + cl_mem dst_buffer, + const size_t * src_origin, + const size_t * dst_origin, + const size_t * region, + size_t src_row_pitch, + size_t src_slice_pitch, + size_t dst_row_pitch, + size_t dst_slice_pitch, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_1; + +#endif /* CL_VERSION_1_1 */ + +CLLD_DEF(clEnqueueReadImage); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReadImage(cl_command_queue command_queue, + cl_mem image, + cl_bool blocking_read, + const size_t * origin, + const size_t * region, + size_t row_pitch, + size_t slice_pitch, + void * ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clEnqueueWriteImage); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueWriteImage(cl_command_queue command_queue, + cl_mem image, + cl_bool blocking_write, + const size_t * origin, + const size_t * region, + size_t input_row_pitch, + size_t input_slice_pitch, + const void * ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +CLLD_DEF(clEnqueueFillImage); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueFillImage(cl_command_queue command_queue, + cl_mem image, + const void * fill_color, + const size_t * origin, + const size_t * region, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_2; + +#endif /* CL_VERSION_1_2 */ + +CLLD_DEF(clEnqueueCopyImage); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueCopyImage(cl_command_queue command_queue, + cl_mem src_image, + cl_mem dst_image, + const size_t * src_origin, + const size_t * dst_origin, + const size_t * region, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clEnqueueCopyImageToBuffer); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueCopyImageToBuffer(cl_command_queue command_queue, + cl_mem src_image, + cl_mem dst_buffer, + const size_t * src_origin, + const size_t * region, + size_t dst_offset, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clEnqueueCopyBufferToImage); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueCopyBufferToImage(cl_command_queue command_queue, + cl_mem src_buffer, + cl_mem dst_image, + size_t src_offset, + const size_t * dst_origin, + const size_t * region, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clEnqueueMapBuffer); +extern inline CL_API_ENTRY void * CL_API_CALL +clEnqueueMapBuffer(cl_command_queue command_queue, + cl_mem buffer, + cl_bool blocking_map, + cl_map_flags map_flags, + size_t offset, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clEnqueueMapImage); +extern inline CL_API_ENTRY void * CL_API_CALL +clEnqueueMapImage(cl_command_queue command_queue, + cl_mem image, + cl_bool blocking_map, + cl_map_flags map_flags, + const size_t * origin, + const size_t * region, + size_t * image_row_pitch, + size_t * image_slice_pitch, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clEnqueueUnmapMemObject); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueUnmapMemObject(cl_command_queue command_queue, + cl_mem memobj, + void * mapped_ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +CLLD_DEF(clEnqueueMigrateMemObjects); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueMigrateMemObjects(cl_command_queue command_queue, + cl_uint num_mem_objects, + const cl_mem * mem_objects, + cl_mem_migration_flags flags, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_2; + +#endif /* CL_VERSION_1_2 */ + +CLLD_DEF(clEnqueueNDRangeKernel); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueNDRangeKernel(cl_command_queue command_queue, + cl_kernel kernel, + cl_uint work_dim, + const size_t * global_work_offset, + const size_t * global_work_size, + const size_t * local_work_size, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_0; + +CLLD_DEF(clEnqueueNativeKernel); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueNativeKernel(cl_command_queue command_queue, + void (CL_CALLBACK * user_func)(void *), + void * args, + size_t cb_args, + cl_uint num_mem_objects, + const cl_mem * mem_list, + const void ** args_mem_loc, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +CLLD_DEF(clEnqueueMarkerWithWaitList); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueMarkerWithWaitList(cl_command_queue command_queue, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_2; + +CLLD_DEF(clEnqueueBarrierWithWaitList); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueBarrierWithWaitList(cl_command_queue command_queue, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_2; + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_0 + +CLLD_DEF(clEnqueueSVMFree); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMFree(cl_command_queue command_queue, + cl_uint num_svm_pointers, + void * svm_pointers[], + void (CL_CALLBACK * pfn_free_func)(cl_command_queue queue, + cl_uint num_svm_pointers, + void * svm_pointers[], + void * user_data), + void * user_data, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_2_0; + +CLLD_DEF(clEnqueueSVMMemcpy); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMMemcpy(cl_command_queue command_queue, + cl_bool blocking_copy, + void * dst_ptr, + const void * src_ptr, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_2_0; + +CLLD_DEF(clEnqueueSVMMemFill); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMMemFill(cl_command_queue command_queue, + void * svm_ptr, + const void * pattern, + size_t pattern_size, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_2_0; + +CLLD_DEF(clEnqueueSVMMap); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMMap(cl_command_queue command_queue, + cl_bool blocking_map, + cl_map_flags flags, + void * svm_ptr, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_2_0; + +CLLD_DEF(clEnqueueSVMUnmap); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMUnmap(cl_command_queue command_queue, + void * svm_ptr, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_2_0; + +#endif /* CL_VERSION_2_0 */ + +#ifdef CL_VERSION_2_1 + +CLLD_DEF(clEnqueueSVMMigrateMem); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMMigrateMem(cl_command_queue command_queue, + cl_uint num_svm_pointers, + const void ** svm_pointers, + const size_t * sizes, + cl_mem_migration_flags flags, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_2_1; + +#endif /* CL_VERSION_2_1 */ + +#ifdef CL_VERSION_1_2 + +CLLD_DEF(clGetExtensionFunctionAddressForPlatform); +extern inline CL_API_ENTRY void * CL_API_CALL +clGetExtensionFunctionAddressForPlatform(cl_platform_id platform, + const char * func_name) CL_API_SUFFIX__VERSION_1_2; + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS + +CLLD_DEF(clSetCommandQueueProperty); +extern inline CL_API_ENTRY cl_int CL_API_CALL +clSetCommandQueueProperty(cl_command_queue command_queue, + cl_command_queue_properties properties, + cl_bool enable, + cl_command_queue_properties * old_properties) CL_API_SUFFIX__VERSION_1_0_DEPRECATED; + +#endif /* CL_USE_DEPRECATED_OPENCL_1_0_APIS */ + +CLLD_DEF(clCreateImage2D); +extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL +clCreateImage2D(cl_context context, + cl_mem_flags flags, + const cl_image_format * image_format, + size_t image_width, + size_t image_height, + size_t image_row_pitch, + void * host_ptr, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +CLLD_DEF(clCreateImage3D); +extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL +clCreateImage3D(cl_context context, + cl_mem_flags flags, + const cl_image_format * image_format, + size_t image_width, + size_t image_height, + size_t image_depth, + size_t image_row_pitch, + size_t image_slice_pitch, + void * host_ptr, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +CLLD_DEF(clEnqueueMarker); +extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +clEnqueueMarker(cl_command_queue command_queue, + cl_event * event) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +CLLD_DEF(clEnqueueWaitForEvents); +extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +clEnqueueWaitForEvents(cl_command_queue command_queue, + cl_uint num_events, + const cl_event * event_list) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +CLLD_DEF(clEnqueueBarrier); +extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +clEnqueueBarrier(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +CLLD_DEF(clUnloadCompiler); +extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +clUnloadCompiler(void) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +CLLD_DEF(clGetExtensionFunctionAddress); +extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED void * CL_API_CALL +clGetExtensionFunctionAddress(const char * func_name) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +CLLD_DEF(clCreateCommandQueue); +extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_command_queue CL_API_CALL +clCreateCommandQueue(cl_context context, + cl_device_id device, + cl_command_queue_properties properties, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2_DEPRECATED; + +CLLD_DEF(clCreateSampler); +extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_sampler CL_API_CALL +clCreateSampler(cl_context context, + cl_bool normalized_coords, + cl_addressing_mode addressing_mode, + cl_filter_mode filter_mode, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2_DEPRECATED; + +CLLD_DEF(clEnqueueTask); +extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_int CL_API_CALL +clEnqueueTask(cl_command_queue command_queue, + cl_kernel kernel, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_2_DEPRECATED; + +#endif /* OPENCL_LOAD */ + +#endif /* OPENCL_DLOPEN_lib_H */ From e16a303bd044e775cd99726a176bea75e5abe00f Mon Sep 17 00:00:00 2001 From: Brice Videau Date: Sat, 15 May 2021 18:30:39 -0500 Subject: [PATCH 2/4] Simplified and generalized proposal. --- CL/cl_egl.h | 8 + CL/cl_egl_api_ptrs.h | 64 +++ CL/cl_egl_load.h | 81 ++++ CL/cl_ext.h | 8 + CL/cl_ext_api_ptrs.h | 61 +++ CL/cl_ext_load.h | 71 +++ CL/cl_gl.h | 6 + CL/cl_gl_api_ptrs.h | 120 +++++ CL/cl_gl_load.h | 164 +++++++ CL/cl_icd.h | 103 +--- CL/cl_load.h | 347 +++++--------- CL/opencl.h | 5 +- CL/opencl_load.h | 192 +++++++- CL/opencl_load_lib.h | 1093 +----------------------------------------- 14 files changed, 888 insertions(+), 1435 deletions(-) create mode 100644 CL/cl_egl_api_ptrs.h create mode 100644 CL/cl_egl_load.h create mode 100644 CL/cl_ext_api_ptrs.h create mode 100644 CL/cl_ext_load.h create mode 100644 CL/cl_gl_api_ptrs.h create mode 100644 CL/cl_gl_load.h diff --git a/CL/cl_egl.h b/CL/cl_egl.h index 357a37c0..e1623d3a 100644 --- a/CL/cl_egl.h +++ b/CL/cl_egl.h @@ -48,6 +48,7 @@ typedef intptr_t cl_egl_image_properties_khr; #define cl_khr_egl_image 1 +#ifndef OPENCL_LOAD extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromEGLImageKHR(cl_context context, CLeglDisplayKHR egldisplay, @@ -55,6 +56,7 @@ clCreateFromEGLImageKHR(cl_context context, cl_mem_flags flags, const cl_egl_image_properties_khr * properties, cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; +#endif typedef cl_mem (CL_API_CALL *clCreateFromEGLImageKHR_fn)( cl_context context, @@ -65,6 +67,7 @@ typedef cl_mem (CL_API_CALL *clCreateFromEGLImageKHR_fn)( cl_int * errcode_ret); +#ifndef OPENCL_LOAD extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireEGLObjectsKHR(cl_command_queue command_queue, cl_uint num_objects, @@ -72,6 +75,7 @@ clEnqueueAcquireEGLObjectsKHR(cl_command_queue command_queue, cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event) CL_API_SUFFIX__VERSION_1_0; +#endif typedef cl_int (CL_API_CALL *clEnqueueAcquireEGLObjectsKHR_fn)( cl_command_queue command_queue, @@ -82,6 +86,7 @@ typedef cl_int (CL_API_CALL *clEnqueueAcquireEGLObjectsKHR_fn)( cl_event * event); +#ifndef OPENCL_LOAD extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseEGLObjectsKHR(cl_command_queue command_queue, cl_uint num_objects, @@ -89,6 +94,7 @@ clEnqueueReleaseEGLObjectsKHR(cl_command_queue command_queue, cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event) CL_API_SUFFIX__VERSION_1_0; +#endif typedef cl_int (CL_API_CALL *clEnqueueReleaseEGLObjectsKHR_fn)( cl_command_queue command_queue, @@ -101,11 +107,13 @@ typedef cl_int (CL_API_CALL *clEnqueueReleaseEGLObjectsKHR_fn)( #define cl_khr_egl_event 1 +#ifndef OPENCL_LOAD extern CL_API_ENTRY cl_event CL_API_CALL clCreateEventFromEGLSyncKHR(cl_context context, CLeglSyncKHR sync, CLeglDisplayKHR display, cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; +#endif typedef cl_event (CL_API_CALL *clCreateEventFromEGLSyncKHR_fn)( cl_context context, diff --git a/CL/cl_egl_api_ptrs.h b/CL/cl_egl_api_ptrs.h new file mode 100644 index 00000000..c6d8c274 --- /dev/null +++ b/CL/cl_egl_api_ptrs.h @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2008-2020 The Khronos Group Inc. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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_EGL_API_PTRS_H_ +#define OPENCL_CL_EGL_API_PTRS_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* cl_khr_egl_image */ + +typedef cl_mem (CL_API_CALL *cl_api_clCreateFromEGLImageKHR)( + cl_context context, + CLeglDisplayKHR display, + CLeglImageKHR image, + cl_mem_flags flags, + const cl_egl_image_properties_khr *properties, + cl_int *errcode_ret); + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueAcquireEGLObjectsKHR)( + cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem *mem_objects, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event); + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueReleaseEGLObjectsKHR)( + cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem *mem_objects, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event); + +/* cl_khr_egl_event */ + +typedef cl_event(CL_API_CALL *cl_api_clCreateEventFromEGLSyncKHR)( + cl_context context, + CLeglSyncKHR sync, + CLeglDisplayKHR display, + cl_int *errcode_ret); + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_CL_EGL_API_PTRS_H_ */ diff --git a/CL/cl_egl_load.h b/CL/cl_egl_load.h new file mode 100644 index 00000000..54e84894 --- /dev/null +++ b/CL/cl_egl_load.h @@ -0,0 +1,81 @@ +/******************************************************************************* + * Copyright (c) 2008-2021 The Khronos Group Inc. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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_EGL_LOAD_H_ +#define OPENCL_CL_EGL_LOAD_H_ + +#include +#ifdef OPENCL_LOAD + +#ifdef __cplusplus +extern "C" { +#endif + +CLLD_INLINE CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromEGLImageKHR(cl_context context, + CLeglDisplayKHR egldisplay, + CLeglImageKHR eglimage, + cl_mem_flags flags, + const cl_egl_image_properties_khr * properties, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateFromEGLImageKHR, errcode_ret); + return CLLD_PTR(clCreateFromEGLImageKHR)( + context, egldisplay, eglimage, flags, properties, errcode_ret); +} + +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL +clEnqueueAcquireEGLObjectsKHR(cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem * mem_objects, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueAcquireEGLObjectsKHR); + return CLLD_PTR(clEnqueueAcquireEGLObjectsKHR)( + command_queue, num_objects, mem_objects, + num_events_in_wait_list, event_wait_list, event); +} + +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReleaseEGLObjectsKHR(cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem * mem_objects, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueReleaseEGLObjectsKHR); + return CLLD_PTR(clEnqueueReleaseEGLObjectsKHR)( + command_queue, num_objects, mem_objects, + num_events_in_wait_list, event_wait_list, event); +} + +CLLD_INLINE CL_API_ENTRY cl_event CL_API_CALL +clCreateEventFromEGLSyncKHR(cl_context context, + CLeglSyncKHR sync, + CLeglDisplayKHR display, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateEventFromEGLSyncKHR, errcode_ret); + return CLLD_PTR(clCreateEventFromEGLSyncKHR)( + context, sync, display, errcode_ret); +} + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_LOAD */ + +#endif /* OPENCL_CL_EGL_LOAD_H_ */ diff --git a/CL/cl_ext.h b/CL/cl_ext.h index 3015f46f..7ec54ab7 100644 --- a/CL/cl_ext.h +++ b/CL/cl_ext.h @@ -267,25 +267,31 @@ typedef cl_command_queue ***********************************/ #define cl_ext_device_fission 1 +#ifndef OPENCL_LOAD extern CL_API_ENTRY cl_int CL_API_CALL clReleaseDeviceEXT(cl_device_id device) CL_API_SUFFIX__VERSION_1_1; +#endif typedef cl_int (CL_API_CALL *clReleaseDeviceEXT_fn)(cl_device_id device) CL_API_SUFFIX__VERSION_1_1; +#ifndef OPENCL_LOAD extern CL_API_ENTRY cl_int CL_API_CALL clRetainDeviceEXT(cl_device_id device) CL_API_SUFFIX__VERSION_1_1; +#endif typedef cl_int (CL_API_CALL *clRetainDeviceEXT_fn)(cl_device_id device) CL_API_SUFFIX__VERSION_1_1; typedef cl_ulong cl_device_partition_property_ext; +#ifndef OPENCL_LOAD extern CL_API_ENTRY cl_int CL_API_CALL clCreateSubDevicesEXT(cl_device_id in_device, const cl_device_partition_property_ext * properties, cl_uint num_entries, cl_device_id * out_devices, cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_1; +#endif typedef cl_int (CL_API_CALL * clCreateSubDevicesEXT_fn)(cl_device_id in_device, @@ -556,6 +562,7 @@ typedef cl_uint cl_kernel_sub_group_info; #define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR 0x2033 #define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR 0x2034 +#ifndef OPENCL_LOAD extern CL_API_ENTRY cl_int CL_API_CALL clGetKernelSubGroupInfoKHR(cl_kernel in_kernel, cl_device_id in_device, @@ -565,6 +572,7 @@ clGetKernelSubGroupInfoKHR(cl_kernel in_kernel, size_t param_value_size, void * param_value, size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_2_0_DEPRECATED; +#endif typedef cl_int (CL_API_CALL * clGetKernelSubGroupInfoKHR_fn)(cl_kernel in_kernel, diff --git a/CL/cl_ext_api_ptrs.h b/CL/cl_ext_api_ptrs.h new file mode 100644 index 00000000..ada6c4ba --- /dev/null +++ b/CL/cl_ext_api_ptrs.h @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2008-2020 The Khronos Group Inc. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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_EXT_API_PTRS_H_ +#define OPENCL_CL_EXT_API_PTRS_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CL_VERSION_2_0 + +typedef cl_int (CL_API_CALL *cl_api_clGetKernelSubGroupInfoKHR)( + cl_kernel in_kernel, + cl_device_id in_device, + cl_kernel_sub_group_info param_name, + size_t input_value_size, + const void *input_value, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_2_0; + +#else + +typedef void *cl_api_clGetKernelSubGroupInfoKHR; + +#endif + +typedef cl_int (CL_API_CALL *cl_api_clCreateSubDevicesEXT)( + cl_device_id in_device, + const cl_device_partition_property_ext *partition_properties, + cl_uint num_entries, + cl_device_id *out_devices, + cl_uint *num_devices); + +typedef cl_int (CL_API_CALL *cl_api_clRetainDeviceEXT)( + cl_device_id device) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clReleaseDeviceEXT)( + cl_device_id device) CL_API_SUFFIX__VERSION_1_0; + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_CL_EXT_API_PTRS_H_ */ diff --git a/CL/cl_ext_load.h b/CL/cl_ext_load.h new file mode 100644 index 00000000..88b7b1a3 --- /dev/null +++ b/CL/cl_ext_load.h @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2008-2021 The Khronos Group Inc. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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_EXT_LOAD_H_ +#define OPENCL_CL_EXT_LOAD_H_ + +#include +#ifdef OPENCL_LOAD + +#ifdef __cplusplus +extern "C" { +#endif + +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL +clGetKernelSubGroupInfoKHR(cl_kernel in_kernel, + cl_device_id in_device, + cl_kernel_sub_group_info param_name, + size_t input_value_size, + const void * input_value, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetKernelSubGroupInfoKHR); + return CLLD_PTR(clGetKernelSubGroupInfoKHR)( + in_kernel, in_device, param_name, input_value_size, input_value, + param_value_size, param_value, param_value_size_ret); +} + +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL +clReleaseDeviceEXT(cl_device_id device) { + CLLD_FETCH(clReleaseDeviceEXT); + return CLLD_PTR(clReleaseDeviceEXT)(device); +} + +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL +clRetainDeviceEXT(cl_device_id device) { + CLLD_FETCH(clRetainDeviceEXT); + return CLLD_PTR(clRetainDeviceEXT)(device); +} + +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL +clCreateSubDevicesEXT(cl_device_id in_device, + const cl_device_partition_property_ext * properties, + cl_uint num_entries, + cl_device_id * out_devices, + cl_uint * num_devices) { + CLLD_FETCH(clCreateSubDevicesEXT); + return CLLD_PTR(clCreateSubDevicesEXT)( + in_device, properties, num_entries, out_devices, num_devices); +} + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_LOAD */ + +#endif /* OPENCL_CL_EXT_LOAD_H_ */ diff --git a/CL/cl_gl.h b/CL/cl_gl.h index 5ea0fd8b..8e7ba53a 100644 --- a/CL/cl_gl.h +++ b/CL/cl_gl.h @@ -48,6 +48,7 @@ typedef struct __GLsync *cl_GLsync; #endif +#ifndef OPENCL_LOAD extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLBuffer(cl_context context, cl_mem_flags flags, @@ -117,6 +118,7 @@ clCreateFromGLTexture3D(cl_context context, cl_GLint miplevel, cl_GLuint texture, cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; +#endif /* OPENCL_LOAD */ /* cl_khr_gl_sharing extension */ @@ -138,12 +140,14 @@ typedef cl_uint cl_gl_context_info; #define CL_WGL_HDC_KHR 0x200B #define CL_CGL_SHAREGROUP_KHR 0x200C +#ifndef OPENCL_LOAD extern CL_API_ENTRY cl_int CL_API_CALL clGetGLContextInfoKHR(const cl_context_properties * properties, cl_gl_context_info param_name, size_t param_value_size, void * param_value, size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; +#endif typedef cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)( const cl_context_properties * properties, @@ -157,10 +161,12 @@ typedef cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)( */ #define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D +#ifndef OPENCL_LOAD extern CL_API_ENTRY cl_event CL_API_CALL clCreateEventFromGLsyncKHR(cl_context context, cl_GLsync sync, cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1; +#endif #ifdef __cplusplus } diff --git a/CL/cl_gl_api_ptrs.h b/CL/cl_gl_api_ptrs.h new file mode 100644 index 00000000..0a5e066c --- /dev/null +++ b/CL/cl_gl_api_ptrs.h @@ -0,0 +1,120 @@ +/******************************************************************************* + * Copyright (c) 2008-2020 The Khronos Group Inc. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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_GL_API_PTRS_H_ +#define OPENCL_CL_GL_API_PTRS_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef cl_mem (CL_API_CALL *cl_api_clCreateFromGLBuffer)( + cl_context context, + cl_mem_flags flags, + cl_GLuint bufobj, + int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +#ifdef CL_VERSION_1_2 + +typedef cl_mem (CL_API_CALL *cl_api_clCreateFromGLTexture)( + cl_context context, + cl_mem_flags flags, + cl_GLenum target, + cl_GLint miplevel, + cl_GLuint texture, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +#else + +typedef void *cl_api_clCreateFromGLTexture; + +#endif + +typedef cl_mem (CL_API_CALL *cl_api_clCreateFromGLRenderbuffer)( + cl_context context, + cl_mem_flags flags, + cl_GLuint renderbuffer, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clGetGLObjectInfo)( + cl_mem memobj, + cl_gl_object_type *gl_object_type, + cl_GLuint *gl_object_name) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clGetGLTextureInfo)( + cl_mem memobj, + cl_gl_texture_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueAcquireGLObjects)( + cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem *mem_objects, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int (CL_API_CALL *cl_api_clEnqueueReleaseGLObjects)( + cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem *mem_objects, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, + cl_event *event) CL_API_SUFFIX__VERSION_1_0; + +/* Deprecated OpenCL 1.1 APIs */ + +typedef cl_mem (CL_API_CALL *cl_api_clCreateFromGLTexture2D)( + cl_context context, + cl_mem_flags flags, + cl_GLenum target, + cl_GLint miplevel, + cl_GLuint texture, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef cl_mem (CL_API_CALL *cl_api_clCreateFromGLTexture3D)( + cl_context context, + cl_mem_flags flags, + cl_GLenum target, + cl_GLint miplevel, + cl_GLuint texture, + cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +/* cl_khr_gl_sharing */ + +typedef cl_int (CL_API_CALL *cl_api_clGetGLContextInfoKHR)( + const cl_context_properties *properties, + cl_gl_context_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret); + +/* cl_khr_gl_event */ + +typedef cl_event (CL_API_CALL *cl_api_clCreateEventFromGLsyncKHR)( + cl_context context, + cl_GLsync sync, + cl_int *errcode_ret); + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_CL_GL_API_PTRS_H_ */ diff --git a/CL/cl_gl_load.h b/CL/cl_gl_load.h new file mode 100644 index 00000000..29cd4318 --- /dev/null +++ b/CL/cl_gl_load.h @@ -0,0 +1,164 @@ +/******************************************************************************* + * Copyright (c) 2008-2020 The Khronos Group Inc. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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_GL_LOAD_H_ +#define OPENCL_CL_GL_LOAD_H_ + +#include +#ifdef OPENCL_LOAD + +#ifdef __cplusplus +extern "C" { +#endif + +CLLD_INLINE CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromGLBuffer(cl_context context, + cl_mem_flags flags, + cl_GLuint bufobj, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateFromGLBuffer, errcode_ret); + return CLLD_PTR(clCreateFromGLBuffer)( + context, flags, bufobj, errcode_ret); +} + +#ifdef CL_VERSION_1_2 + +CLLD_INLINE CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromGLTexture(cl_context context, + cl_mem_flags flags, + cl_GLenum target, + cl_GLint miplevel, + cl_GLuint texture, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateFromGLTexture, errcode_ret); + return CLLD_PTR(clCreateFromGLTexture)( + context, flags, target, miplevel, texture, errcode_ret); +} + +#endif + +CLLD_INLINE CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromGLRenderbuffer(cl_context context, + cl_mem_flags flags, + cl_GLuint renderbuffer, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateFromGLRenderbuffer, errcode_ret); + return CLLD_PTR(clCreateFromGLRenderbuffer)( + context, flags, renderbuffer, errcode_ret); +} + +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL +clGetGLObjectInfo(cl_mem memobj, + cl_gl_object_type * gl_object_type, + cl_GLuint * gl_object_name) { + CLLD_FETCH(clGetGLObjectInfo); + return CLLD_PTR(clGetGLObjectInfo)( + memobj, gl_object_type, gl_object_name); +} + +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL +clGetGLTextureInfo(cl_mem memobj, + cl_gl_texture_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetGLTextureInfo); + return CLLD_PTR(clGetGLTextureInfo)( + memobj, param_name, param_value_size, param_value, param_value_size_ret); +} + + +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL +clEnqueueAcquireGLObjects(cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem * mem_objects, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueAcquireGLObjects); + return CLLD_PTR(clEnqueueAcquireGLObjects)( + command_queue, num_objects, mem_objects, + num_events_in_wait_list, event_wait_list, event); +} + +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReleaseGLObjects(cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem * mem_objects, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { + CLLD_FETCH(clEnqueueReleaseGLObjects); + return CLLD_PTR(clEnqueueReleaseGLObjects)( + command_queue, num_objects, mem_objects, + num_events_in_wait_list, event_wait_list, event); +} + +/* Deprecated OpenCL 1.1 APIs */ + +CLLD_INLINE CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL +clCreateFromGLTexture2D(cl_context context, + cl_mem_flags flags, + cl_GLenum target, + cl_GLint miplevel, + cl_GLuint texture, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateFromGLTexture2D, errcode_ret); + return CLLD_PTR(clCreateFromGLTexture2D)( + context, flags, target, miplevel, texture, errcode_ret); +} + +CLLD_INLINE CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL +clCreateFromGLTexture3D(cl_context context, + cl_mem_flags flags, + cl_GLenum target, + cl_GLint miplevel, + cl_GLuint texture, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateFromGLTexture3D, errcode_ret); + return CLLD_PTR(clCreateFromGLTexture3D)( + context, flags, target, miplevel, texture, errcode_ret); +} + +/* cl_khr_gl_sharing extension */ + +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL +clGetGLContextInfoKHR(const cl_context_properties * properties, + cl_gl_context_info param_name, + size_t param_value_size, + void * param_value, + size_t * param_value_size_ret) { + CLLD_FETCH(clGetGLContextInfoKHR); + return CLLD_PTR(clGetGLContextInfoKHR)( + properties, param_name, param_value_size, param_value, param_value_size_ret); +} + +CLLD_INLINE CL_API_ENTRY cl_event CL_API_CALL +clCreateEventFromGLsyncKHR(cl_context context, + cl_GLsync sync, + cl_int * errcode_ret) { + CLLD_FETCH_ERR(clCreateEventFromGLsyncKHR, errcode_ret); + return CLLD_PTR(clCreateEventFromGLsyncKHR)( + context, sync, errcode_ret); +} + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_LOAD */ + +#endif /* OPENCL_CL_GL_LOAD_H_ */ diff --git a/CL/cl_icd.h b/CL/cl_icd.h index fc5e7678..5bc4787c 100644 --- a/CL/cl_icd.h +++ b/CL/cl_icd.h @@ -29,6 +29,9 @@ #endif #include +#include +#include +#include #ifdef __cplusplus extern "C" { @@ -42,72 +45,6 @@ extern "C" { /* API function pointer definitions */ -#ifdef CL_VERSION_2_0 -typedef cl_int(CL_API_CALL *cl_api_clGetKernelSubGroupInfoKHR)( - cl_kernel in_kernel, - cl_device_id in_device, - cl_kernel_sub_group_info param_name, - size_t input_value_size, - const void *input_value, - size_t param_value_size, - void *param_value, - size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_2_0; -#else - -typedef void *cl_api_clGetKernelSubGroupInfoKHR; - -#endif - -// GL and other APIs -typedef cl_mem(CL_API_CALL *cl_api_clCreateFromGLBuffer)( - cl_context context, cl_mem_flags flags, cl_GLuint bufobj, - int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_mem(CL_API_CALL *cl_api_clCreateFromGLTexture)( - cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, - cl_GLuint texture, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_mem(CL_API_CALL *cl_api_clCreateFromGLTexture2D)( - cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, - cl_GLuint texture, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_mem(CL_API_CALL *cl_api_clCreateFromGLTexture3D)( - cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, - cl_GLuint texture, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_mem(CL_API_CALL *cl_api_clCreateFromGLRenderbuffer)( - cl_context context, cl_mem_flags flags, cl_GLuint renderbuffer, - cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clGetGLObjectInfo)( - cl_mem memobj, cl_gl_object_type *gl_object_type, - cl_GLuint *gl_object_name) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clGetGLTextureInfo)( - cl_mem memobj, cl_gl_texture_info param_name, size_t param_value_size, - void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueAcquireGLObjects)( - cl_command_queue command_queue, cl_uint num_objects, - const cl_mem *mem_objects, cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueReleaseGLObjects)( - cl_command_queue command_queue, cl_uint num_objects, - const cl_mem *mem_objects, cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_0; - -/* cl_khr_gl_sharing */ -typedef cl_int(CL_API_CALL *cl_api_clGetGLContextInfoKHR)( - const cl_context_properties *properties, cl_gl_context_info param_name, - size_t param_value_size, void *param_value, size_t *param_value_size_ret); - -/* cl_khr_gl_event */ -typedef cl_event(CL_API_CALL *cl_api_clCreateEventFromGLsyncKHR)( - cl_context context, cl_GLsync sync, cl_int *errcode_ret); - #if defined(_WIN32) /* cl_khr_d3d10_sharing */ @@ -307,40 +244,6 @@ typedef void *cl_api_clGetDeviceIDsFromDX9MediaAdapterKHR; #endif -/* OpenCL 1.1 */ - -typedef cl_int(CL_API_CALL *cl_api_clCreateSubDevicesEXT)( - cl_device_id in_device, - const cl_device_partition_property_ext *partition_properties, - cl_uint num_entries, cl_device_id *out_devices, cl_uint *num_devices); - -typedef cl_int(CL_API_CALL *cl_api_clRetainDeviceEXT)( - cl_device_id device) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int(CL_API_CALL *cl_api_clReleaseDeviceEXT)( - cl_device_id device) CL_API_SUFFIX__VERSION_1_0; - -/* cl_khr_egl_image */ -typedef cl_mem(CL_API_CALL *cl_api_clCreateFromEGLImageKHR)( - cl_context context, CLeglDisplayKHR display, CLeglImageKHR image, - cl_mem_flags flags, const cl_egl_image_properties_khr *properties, - cl_int *errcode_ret); - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueAcquireEGLObjectsKHR)( - cl_command_queue command_queue, cl_uint num_objects, - const cl_mem *mem_objects, cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, cl_event *event); - -typedef cl_int(CL_API_CALL *cl_api_clEnqueueReleaseEGLObjectsKHR)( - cl_command_queue command_queue, cl_uint num_objects, - const cl_mem *mem_objects, cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, cl_event *event); - -/* cl_khr_egl_event */ -typedef cl_event(CL_API_CALL *cl_api_clCreateEventFromEGLSyncKHR)( - cl_context context, CLeglSyncKHR sync, CLeglDisplayKHR display, - cl_int *errcode_ret); - /* Vendor dispatch table struture */ typedef struct _cl_icd_dispatch { diff --git a/CL/cl_load.h b/CL/cl_load.h index da65d740..b15b2c53 100644 --- a/CL/cl_load.h +++ b/CL/cl_load.h @@ -17,10 +17,8 @@ #ifndef OPENCL_CL_LOAD_H_ #define OPENCL_CL_LOAD_H_ -#include -#ifdef OPENCL_LOAD #include -#include +#ifdef OPENCL_LOAD #ifdef __cplusplus extern "C" { @@ -28,8 +26,7 @@ extern "C" { /* Platform API */ -CLLD_DECL(clGetPlatformIDs); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetPlatformIDs(cl_uint num_entries, cl_platform_id * platforms, cl_uint * num_platforms) { @@ -37,8 +34,7 @@ clGetPlatformIDs(cl_uint num_entries, return CLLD_PTR(clGetPlatformIDs)(num_entries, platforms, num_platforms); } -CLLD_DECL(clGetPlatformInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetPlatformInfo(cl_platform_id platform, cl_platform_info param_name, size_t param_value_size, @@ -52,8 +48,7 @@ clGetPlatformInfo(cl_platform_id platform, /* Device APIs */ -CLLD_DECL(clGetDeviceIDs); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDs(cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, @@ -65,8 +60,7 @@ clGetDeviceIDs(cl_platform_id platform, devices, num_devices); } -CLLD_DECL(clGetDeviceInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetDeviceInfo(cl_device_id device, cl_device_info param_name, size_t param_value_size, @@ -80,8 +74,7 @@ clGetDeviceInfo(cl_device_id device, #ifdef CL_VERSION_1_2 -CLLD_DECL(clCreateSubDevices); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clCreateSubDevices(cl_device_id in_device, const cl_device_partition_property * properties, cl_uint num_devices, @@ -93,15 +86,13 @@ clCreateSubDevices(cl_device_id in_device, out_devices, num_devices_ret); } -CLLD_DECL(clRetainDevice); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clRetainDevice(cl_device_id device) { CLLD_FETCH(clRetainDevice); return CLLD_PTR(clRetainDevice)(device); } -CLLD_DECL(clReleaseDevice); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clReleaseDevice(cl_device_id device) { CLLD_FETCH(clReleaseDevice); return CLLD_PTR(clReleaseDevice)(device); @@ -111,8 +102,7 @@ clReleaseDevice(cl_device_id device) { #ifdef CL_VERSION_2_1 -CLLD_DECL(clSetDefaultDeviceCommandQueue); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clSetDefaultDeviceCommandQueue(cl_context context, cl_device_id device, cl_command_queue command_queue) { @@ -121,8 +111,7 @@ clSetDefaultDeviceCommandQueue(cl_context context, context, device, command_queue); } -CLLD_DECL(clGetDeviceAndHostTimer); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetDeviceAndHostTimer(cl_device_id device, cl_ulong* device_timestamp, cl_ulong* host_timestamp) { @@ -131,8 +120,7 @@ clGetDeviceAndHostTimer(cl_device_id device, device, device_timestamp, host_timestamp); } -CLLD_DECL(clGetHostTimer); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetHostTimer(cl_device_id device, cl_ulong * host_timestamp) { CLLD_FETCH(clGetHostTimer); @@ -144,8 +132,7 @@ clGetHostTimer(cl_device_id device, /* Context APIs */ -CLLD_DECL(clCreateContext); -inline CL_API_ENTRY cl_context CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_context CL_API_CALL clCreateContext(const cl_context_properties * properties, cl_uint num_devices, const cl_device_id * devices, @@ -161,8 +148,7 @@ clCreateContext(const cl_context_properties * properties, pfn_notify, user_data, errcode_ret); } -CLLD_DECL(clCreateContextFromType); -inline CL_API_ENTRY cl_context CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_context CL_API_CALL clCreateContextFromType(const cl_context_properties * properties, cl_device_type device_type, void (CL_CALLBACK * pfn_notify)(const char * errinfo, @@ -177,22 +163,19 @@ clCreateContextFromType(const cl_context_properties * properties, user_data, errcode_ret); } -CLLD_DECL(clRetainContext); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clRetainContext(cl_context context) { CLLD_FETCH(clRetainContext); return CLLD_PTR(clRetainContext)(context); } -CLLD_DECL(clReleaseContext); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clReleaseContext(cl_context context) { CLLD_FETCH(clReleaseContext); return CLLD_PTR(clReleaseContext)(context); } -CLLD_DECL(clGetContextInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetContextInfo(cl_context context, cl_context_info param_name, size_t param_value_size, @@ -206,13 +189,11 @@ clGetContextInfo(cl_context context, #ifdef CL_VERSION_3_0 -CLLD_DECL(clSetContextDestructorCallback); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE 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) { - CLLD_DECL(clSetContextDestructorCallback); return CLLD_PTR(clSetContextDestructorCallback)( context, pfn_notify, user_data); } @@ -223,8 +204,7 @@ clSetContextDestructorCallback(cl_context context, #ifdef CL_VERSION_2_0 -CLLD_DECL(clCreateCommandQueueWithProperties); -inline CL_API_ENTRY cl_command_queue CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties(cl_context context, cl_device_id device, const cl_queue_properties * properties, @@ -236,22 +216,19 @@ clCreateCommandQueueWithProperties(cl_context context, #endif /* CL_VERSION_2_0 */ -CLLD_DECL(clRetainCommandQueue); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clRetainCommandQueue(cl_command_queue command_queue) { CLLD_FETCH(clRetainCommandQueue); return CLLD_PTR(clRetainCommandQueue)(command_queue); } -CLLD_DECL(clReleaseCommandQueue); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clReleaseCommandQueue(cl_command_queue command_queue) { CLLD_FETCH(clReleaseCommandQueue); return CLLD_PTR(clReleaseCommandQueue)(command_queue); } -CLLD_DECL(clGetCommandQueueInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetCommandQueueInfo(cl_command_queue command_queue, cl_command_queue_info param_name, size_t param_value_size, @@ -265,8 +242,7 @@ clGetCommandQueueInfo(cl_command_queue command_queue, /* Memory Object APIs */ -CLLD_DECL(clCreateBuffer); -inline CL_API_ENTRY cl_mem CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_mem CL_API_CALL clCreateBuffer(cl_context context, cl_mem_flags flags, size_t size, @@ -279,8 +255,7 @@ clCreateBuffer(cl_context context, #ifdef CL_VERSION_1_1 -CLLD_DECL(clCreateSubBuffer); -inline CL_API_ENTRY cl_mem CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_mem CL_API_CALL clCreateSubBuffer(cl_mem buffer, cl_mem_flags flags, cl_buffer_create_type buffer_create_type, @@ -295,8 +270,7 @@ clCreateSubBuffer(cl_mem buffer, #ifdef CL_VERSION_1_2 -CLLD_DECL(clCreateImage); -inline CL_API_ENTRY cl_mem CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_mem CL_API_CALL clCreateImage(cl_context context, cl_mem_flags flags, const cl_image_format * image_format, @@ -312,8 +286,7 @@ clCreateImage(cl_context context, #ifdef CL_VERSION_2_0 -CLLD_DECL(clCreatePipe); -inline CL_API_ENTRY cl_mem CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_mem CL_API_CALL clCreatePipe(cl_context context, cl_mem_flags flags, cl_uint pipe_packet_size, @@ -329,8 +302,7 @@ clCreatePipe(cl_context context, #ifdef CL_VERSION_3_0 -CLLD_DECL(clCreateBufferWithProperties); -inline CL_API_ENTRY cl_mem CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_mem CL_API_CALL clCreateBufferWithProperties(cl_context context, const cl_mem_properties * properties, cl_mem_flags flags, @@ -342,8 +314,7 @@ clCreateBufferWithProperties(cl_context context, context, properties, flags, size, host_ptr, errcode_ret); } -CLLD_DECL(clCreateImageWithProperties); -inline CL_API_ENTRY cl_mem CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_mem CL_API_CALL clCreateImageWithProperties(cl_context context, const cl_mem_properties * properties, cl_mem_flags flags, @@ -358,22 +329,19 @@ clCreateImageWithProperties(cl_context context, #endif /* CL_VERSION_3_0 */ -CLLD_DECL(clRetainMemObject); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clRetainMemObject(cl_mem memobj) { CLLD_FETCH(clRetainMemObject); return CLLD_PTR(clRetainMemObject)(memobj); } -CLLD_DECL(clReleaseMemObject); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clReleaseMemObject(cl_mem memobj) { CLLD_FETCH(clReleaseMemObject); return CLLD_PTR(clReleaseMemObject)(memobj); } -CLLD_DECL(clGetSupportedImageFormats); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetSupportedImageFormats(cl_context context, cl_mem_flags flags, cl_mem_object_type image_type, @@ -385,8 +353,7 @@ clGetSupportedImageFormats(cl_context context, context, flags, image_type, num_entries, image_formats, num_image_formats); } -CLLD_DECL(clGetMemObjectInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetMemObjectInfo(cl_mem memobj, cl_mem_info param_name, size_t param_value_size, @@ -397,8 +364,7 @@ clGetMemObjectInfo(cl_mem memobj, memobj, param_name, param_value_size, param_value, param_value_size_ret); } -CLLD_DECL(clGetImageInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetImageInfo(cl_mem image, cl_image_info param_name, size_t param_value_size, @@ -411,8 +377,7 @@ clGetImageInfo(cl_mem image, #ifdef CL_VERSION_2_0 -CLLD_DECL(clGetPipeInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetPipeInfo(cl_mem pipe, cl_pipe_info param_name, size_t param_value_size, @@ -427,8 +392,7 @@ clGetPipeInfo(cl_mem pipe, #ifdef CL_VERSION_1_1 -CLLD_DECL(clSetMemObjectDestructorCallback); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clSetMemObjectDestructorCallback(cl_mem memobj, void (CL_CALLBACK * pfn_notify)(cl_mem memobj, void * user_data), @@ -444,8 +408,7 @@ clSetMemObjectDestructorCallback(cl_mem memobj, #ifdef CL_VERSION_2_0 -CLLD_DECL(clSVMAlloc); -inline CL_API_ENTRY void * CL_API_CALL +CLLD_INLINE CL_API_ENTRY void * CL_API_CALL clSVMAlloc(cl_context context, cl_svm_mem_flags flags, size_t size, @@ -455,8 +418,7 @@ clSVMAlloc(cl_context context, context, flags, size, alignment); } -CLLD_DECL(clSVMFree); -inline CL_API_ENTRY void CL_API_CALL +CLLD_INLINE CL_API_ENTRY void CL_API_CALL clSVMFree(cl_context context, void * svm_pointer) { CLLD_FETCH_NOERR(clSVMFree); @@ -469,8 +431,7 @@ clSVMFree(cl_context context, #ifdef CL_VERSION_2_0 -CLLD_DECL(clCreateSamplerWithProperties); -inline CL_API_ENTRY cl_sampler CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_sampler CL_API_CALL clCreateSamplerWithProperties(cl_context context, const cl_sampler_properties * sampler_properties, cl_int * errcode_ret) { @@ -481,22 +442,19 @@ clCreateSamplerWithProperties(cl_context context, #endif /* CL_VERSION_2_0 */ -CLLD_DECL(clRetainSampler); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clRetainSampler(cl_sampler sampler) { CLLD_FETCH(clRetainSampler); return CLLD_PTR(clRetainSampler)(sampler); } -CLLD_DECL(clReleaseSampler); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clReleaseSampler(cl_sampler sampler) { CLLD_FETCH(clReleaseSampler); return CLLD_PTR(clReleaseSampler)(sampler); } -CLLD_DECL(clGetSamplerInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetSamplerInfo(cl_sampler sampler, cl_sampler_info param_name, size_t param_value_size, @@ -509,8 +467,7 @@ clGetSamplerInfo(cl_sampler sampler, /* Program Object APIs */ -CLLD_DECL(clCreateProgramWithSource); -inline CL_API_ENTRY cl_program CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithSource(cl_context context, cl_uint count, const char ** strings, @@ -521,8 +478,7 @@ clCreateProgramWithSource(cl_context context, context, count, strings, lengths, errcode_ret); } -CLLD_DECL(clCreateProgramWithBinary); -inline CL_API_ENTRY cl_program CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithBinary(cl_context context, cl_uint num_devices, const cl_device_id * device_list, @@ -537,8 +493,7 @@ clCreateProgramWithBinary(cl_context context, #ifdef CL_VERSION_1_2 -CLLD_DECL(clCreateProgramWithBuiltInKernels); -inline CL_API_ENTRY cl_program CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithBuiltInKernels(cl_context context, cl_uint num_devices, const cl_device_id * device_list, @@ -553,8 +508,7 @@ clCreateProgramWithBuiltInKernels(cl_context context, #ifdef CL_VERSION_2_1 -CLLD_DECL(clCreateProgramWithIL); -inline CL_API_ENTRY cl_program CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithIL(cl_context context, const void* il, size_t length, @@ -566,22 +520,19 @@ clCreateProgramWithIL(cl_context context, #endif /* CL_VERSION_2_1 */ -CLLD_DECL(clRetainProgram); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clRetainProgram(cl_program program) { CLLD_FETCH(clRetainProgram); return CLLD_PTR(clRetainProgram)(program); } -CLLD_DECL(clReleaseProgram); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clReleaseProgram(cl_program program) { CLLD_FETCH(clReleaseProgram); return CLLD_PTR(clReleaseProgram)(program); } -CLLD_DECL(clBuildProgram); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clBuildProgram(cl_program program, cl_uint num_devices, const cl_device_id * device_list, @@ -596,8 +547,7 @@ clBuildProgram(cl_program program, #ifdef CL_VERSION_1_2 -CLLD_DECL(clCompileProgram); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clCompileProgram(cl_program program, cl_uint num_devices, const cl_device_id * device_list, @@ -614,8 +564,7 @@ clCompileProgram(cl_program program, header_include_names, pfn_notify, user_data); } -CLLD_DECL(clLinkProgram); -inline CL_API_ENTRY cl_program CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_program CL_API_CALL clLinkProgram(cl_context context, cl_uint num_devices, const cl_device_id * device_list, @@ -636,8 +585,7 @@ clLinkProgram(cl_context context, #ifdef CL_VERSION_2_2 -CLLD_DECL(clSetProgramReleaseCallback); -inline CL_API_ENTRY CL_API_PREFIX__VERSION_2_2_DEPRECATED cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY CL_API_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), @@ -647,8 +595,7 @@ clSetProgramReleaseCallback(cl_program program, program, pfn_notify, user_data); } -CLLD_DECL(clSetProgramSpecializationConstant); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clSetProgramSpecializationConstant(cl_program program, cl_uint spec_id, size_t spec_size, @@ -662,8 +609,7 @@ clSetProgramSpecializationConstant(cl_program program, #ifdef CL_VERSION_1_2 -CLLD_DECL(clUnloadPlatformCompiler); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clUnloadPlatformCompiler(cl_platform_id platform) { CLLD_FETCH(clUnloadPlatformCompiler); return CLLD_PTR(clUnloadPlatformCompiler)(platform); @@ -671,8 +617,7 @@ clUnloadPlatformCompiler(cl_platform_id platform) { #endif /* CL_VERSION_1_2 */ -CLLD_DECL(clGetProgramInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetProgramInfo(cl_program program, cl_program_info param_name, size_t param_value_size, @@ -683,8 +628,7 @@ clGetProgramInfo(cl_program program, program, param_name, param_value_size, param_value, param_value_size_ret); } -CLLD_DECL(clGetProgramBuildInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetProgramBuildInfo(cl_program program, cl_device_id device, cl_program_build_info param_name, @@ -698,8 +642,7 @@ clGetProgramBuildInfo(cl_program program, /* Kernel Object APIs */ -CLLD_DECL(clCreateKernel); -inline CL_API_ENTRY cl_kernel CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_kernel CL_API_CALL clCreateKernel(cl_program program, const char * kernel_name, cl_int * errcode_ret) { @@ -708,8 +651,7 @@ clCreateKernel(cl_program program, program, kernel_name, errcode_ret); } -CLLD_DECL(clCreateKernelsInProgram); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clCreateKernelsInProgram(cl_program program, cl_uint num_kernels, cl_kernel * kernels, @@ -721,8 +663,7 @@ clCreateKernelsInProgram(cl_program program, #ifdef CL_VERSION_2_1 -CLLD_DECL(clCloneKernel); -inline CL_API_ENTRY cl_kernel CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_kernel CL_API_CALL clCloneKernel(cl_kernel source_kernel, cl_int* errcode_ret) { CLLD_FETCH_ERR(clCloneKernel, errcode_ret); @@ -732,22 +673,19 @@ clCloneKernel(cl_kernel source_kernel, #endif /* CL_VERSION_2_1 */ -CLLD_DECL(clRetainKernel); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clRetainKernel(cl_kernel kernel) { CLLD_FETCH(clRetainKernel); return CLLD_PTR(clRetainKernel)(kernel); } -CLLD_DECL(clReleaseKernel); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clReleaseKernel(cl_kernel kernel) { CLLD_FETCH(clReleaseKernel); return CLLD_PTR(clReleaseKernel)(kernel); } -CLLD_DECL(clSetKernelArg); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clSetKernelArg(cl_kernel kernel, cl_uint arg_index, size_t arg_size, @@ -759,8 +697,7 @@ clSetKernelArg(cl_kernel kernel, #ifdef CL_VERSION_2_0 -CLLD_DECL(clSetKernelArgSVMPointer); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clSetKernelArgSVMPointer(cl_kernel kernel, cl_uint arg_index, const void * arg_value) { @@ -769,8 +706,7 @@ clSetKernelArgSVMPointer(cl_kernel kernel, kernel, arg_index, arg_value); } -CLLD_DECL(clSetKernelExecInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clSetKernelExecInfo(cl_kernel kernel, cl_kernel_exec_info param_name, size_t param_value_size, @@ -782,8 +718,7 @@ clSetKernelExecInfo(cl_kernel kernel, #endif /* CL_VERSION_2_0 */ -CLLD_DECL(clGetKernelInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetKernelInfo(cl_kernel kernel, cl_kernel_info param_name, size_t param_value_size, @@ -796,8 +731,7 @@ clGetKernelInfo(cl_kernel kernel, #ifdef CL_VERSION_1_2 -CLLD_DECL(clGetKernelArgInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetKernelArgInfo(cl_kernel kernel, cl_uint arg_indx, cl_kernel_arg_info param_name, @@ -812,8 +746,7 @@ clGetKernelArgInfo(cl_kernel kernel, #endif /* CL_VERSION_1_2 */ -CLLD_DECL(clGetKernelWorkGroupInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetKernelWorkGroupInfo(cl_kernel kernel, cl_device_id device, cl_kernel_work_group_info param_name, @@ -827,8 +760,7 @@ clGetKernelWorkGroupInfo(cl_kernel kernel, #ifdef CL_VERSION_2_1 -CLLD_DECL(clGetKernelSubGroupInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetKernelSubGroupInfo(cl_kernel kernel, cl_device_id device, cl_kernel_sub_group_info param_name, @@ -847,8 +779,7 @@ clGetKernelSubGroupInfo(cl_kernel kernel, /* Event Object APIs */ -CLLD_DECL(clWaitForEvents); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clWaitForEvents(cl_uint num_events, const cl_event * event_list) { CLLD_FETCH(clWaitForEvents); @@ -856,8 +787,7 @@ clWaitForEvents(cl_uint num_events, num_events, event_list); } -CLLD_DECL(clGetEventInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetEventInfo(cl_event event, cl_event_info param_name, size_t param_value_size, @@ -870,8 +800,7 @@ clGetEventInfo(cl_event event, #ifdef CL_VERSION_1_1 -CLLD_DECL(clCreateUserEvent); -inline CL_API_ENTRY cl_event CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_event CL_API_CALL clCreateUserEvent(cl_context context, cl_int * errcode_ret) { CLLD_FETCH_ERR(clCreateUserEvent, errcode_ret); @@ -881,15 +810,13 @@ clCreateUserEvent(cl_context context, #endif /* CL_VERSION_1_1 */ -CLLD_DECL(clRetainEvent); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clRetainEvent(cl_event event) { CLLD_FETCH(clRetainEvent); return CLLD_PTR(clRetainEvent)(event); } -CLLD_DECL(clReleaseEvent); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clReleaseEvent(cl_event event) { CLLD_FETCH(clReleaseEvent); return CLLD_PTR(clReleaseEvent)(event); @@ -897,8 +824,7 @@ clReleaseEvent(cl_event event) { #ifdef CL_VERSION_1_1 -CLLD_DECL(clSetUserEventStatus); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clSetUserEventStatus(cl_event event, cl_int execution_status) { CLLD_FETCH(clSetUserEventStatus); @@ -906,8 +832,7 @@ clSetUserEventStatus(cl_event event, event, execution_status); } -CLLD_DECL(clSetEventCallback); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clSetEventCallback(cl_event event, cl_int command_exec_callback_type, void (CL_CALLBACK * pfn_notify)(cl_event event, @@ -923,8 +848,7 @@ clSetEventCallback(cl_event event, /* Profiling APIs */ -CLLD_DECL(clGetEventProfilingInfo); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clGetEventProfilingInfo(cl_event event, cl_profiling_info param_name, size_t param_value_size, @@ -937,15 +861,13 @@ clGetEventProfilingInfo(cl_event event, /* Flush and Finish APIs */ -CLLD_DECL(clFlush); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clFlush(cl_command_queue command_queue) { CLLD_FETCH(clFlush); return CLLD_PTR(clFlush)(command_queue); } -CLLD_DECL(clFinish); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clFinish(cl_command_queue command_queue) { CLLD_FETCH(clFinish); return CLLD_PTR(clFinish)(command_queue); @@ -953,8 +875,7 @@ clFinish(cl_command_queue command_queue) { /* Enqueued Commands APIs */ -CLLD_DECL(clEnqueueReadBuffer); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadBuffer(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, @@ -972,8 +893,7 @@ clEnqueueReadBuffer(cl_command_queue command_queue, #ifdef CL_VERSION_1_1 -CLLD_DECL(clEnqueueReadBufferRect); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadBufferRect(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, @@ -997,8 +917,7 @@ clEnqueueReadBufferRect(cl_command_queue command_queue, #endif /* CL_VERSION_1_1 */ -CLLD_DECL(clEnqueueWriteBuffer); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteBuffer(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, @@ -1016,8 +935,7 @@ clEnqueueWriteBuffer(cl_command_queue command_queue, #ifdef CL_VERSION_1_1 -CLLD_DECL(clEnqueueWriteBufferRect); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteBufferRect(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, @@ -1043,8 +961,7 @@ clEnqueueWriteBufferRect(cl_command_queue command_queue, #ifdef CL_VERSION_1_2 -CLLD_DECL(clEnqueueFillBuffer); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueFillBuffer(cl_command_queue command_queue, cl_mem buffer, const void * pattern, @@ -1062,8 +979,7 @@ clEnqueueFillBuffer(cl_command_queue command_queue, #endif /* CL_VERSION_1_2 */ -CLLD_DECL(clEnqueueCopyBuffer); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBuffer(cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, @@ -1081,8 +997,7 @@ clEnqueueCopyBuffer(cl_command_queue command_queue, #ifdef CL_VERSION_1_1 -CLLD_DECL(clEnqueueCopyBufferRect); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBufferRect(cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, @@ -1105,8 +1020,7 @@ clEnqueueCopyBufferRect(cl_command_queue command_queue, #endif /* CL_VERSION_1_1 */ -CLLD_DECL(clEnqueueReadImage); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadImage(cl_command_queue command_queue, cl_mem image, cl_bool blocking_read, @@ -1124,8 +1038,7 @@ clEnqueueReadImage(cl_command_queue command_queue, slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } -CLLD_DECL(clEnqueueWriteImage); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteImage(cl_command_queue command_queue, cl_mem image, cl_bool blocking_write, @@ -1145,8 +1058,7 @@ clEnqueueWriteImage(cl_command_queue command_queue, #ifdef CL_VERSION_1_2 -CLLD_DECL(clEnqueueFillImage); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueFillImage(cl_command_queue command_queue, cl_mem image, const void * fill_color, @@ -1163,8 +1075,7 @@ clEnqueueFillImage(cl_command_queue command_queue, #endif /* CL_VERSION_1_2 */ -CLLD_DECL(clEnqueueCopyImage); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyImage(cl_command_queue command_queue, cl_mem src_image, cl_mem dst_image, @@ -1180,8 +1091,7 @@ clEnqueueCopyImage(cl_command_queue command_queue, region, num_events_in_wait_list, event_wait_list, event); } -CLLD_DECL(clEnqueueCopyImageToBuffer); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyImageToBuffer(cl_command_queue command_queue, cl_mem src_image, cl_mem dst_buffer, @@ -1197,8 +1107,7 @@ clEnqueueCopyImageToBuffer(cl_command_queue command_queue, dst_offset, num_events_in_wait_list, event_wait_list, event); } -CLLD_DECL(clEnqueueCopyBufferToImage); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBufferToImage(cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_image, @@ -1214,8 +1123,7 @@ clEnqueueCopyBufferToImage(cl_command_queue command_queue, region, num_events_in_wait_list, event_wait_list, event); } -CLLD_DECL(clEnqueueMapBuffer); -inline CL_API_ENTRY void * CL_API_CALL +CLLD_INLINE CL_API_ENTRY void * CL_API_CALL clEnqueueMapBuffer(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map, @@ -1232,8 +1140,7 @@ clEnqueueMapBuffer(cl_command_queue command_queue, num_events_in_wait_list, event_wait_list, event, errcode_ret); } -CLLD_DECL(clEnqueueMapImage); -inline CL_API_ENTRY void * CL_API_CALL +CLLD_INLINE CL_API_ENTRY void * CL_API_CALL clEnqueueMapImage(cl_command_queue command_queue, cl_mem image, cl_bool blocking_map, @@ -1253,8 +1160,7 @@ clEnqueueMapImage(cl_command_queue command_queue, event_wait_list, event, errcode_ret); } -CLLD_DECL(clEnqueueUnmapMemObject); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueUnmapMemObject(cl_command_queue command_queue, cl_mem memobj, void * mapped_ptr, @@ -1269,8 +1175,7 @@ clEnqueueUnmapMemObject(cl_command_queue command_queue, #ifdef CL_VERSION_1_2 -CLLD_DECL(clEnqueueMigrateMemObjects); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjects(cl_command_queue command_queue, cl_uint num_mem_objects, const cl_mem * mem_objects, @@ -1286,8 +1191,7 @@ clEnqueueMigrateMemObjects(cl_command_queue command_queue, #endif /* CL_VERSION_1_2 */ -CLLD_DECL(clEnqueueNDRangeKernel); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueNDRangeKernel(cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, @@ -1303,8 +1207,7 @@ clEnqueueNDRangeKernel(cl_command_queue command_queue, local_work_size, num_events_in_wait_list, event_wait_list, event); } -CLLD_DECL(clEnqueueNativeKernel); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueNativeKernel(cl_command_queue command_queue, void (CL_CALLBACK * user_func)(void *), void * args, @@ -1323,8 +1226,7 @@ clEnqueueNativeKernel(cl_command_queue command_queue, #ifdef CL_VERSION_1_2 -CLLD_DECL(clEnqueueMarkerWithWaitList); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueMarkerWithWaitList(cl_command_queue command_queue, cl_uint num_events_in_wait_list, const cl_event * event_wait_list, @@ -1334,8 +1236,7 @@ clEnqueueMarkerWithWaitList(cl_command_queue command_queue, command_queue, num_events_in_wait_list, event_wait_list, event); } -CLLD_DECL(clEnqueueBarrierWithWaitList); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueBarrierWithWaitList(cl_command_queue command_queue, cl_uint num_events_in_wait_list, const cl_event * event_wait_list, @@ -1349,8 +1250,7 @@ clEnqueueBarrierWithWaitList(cl_command_queue command_queue, #ifdef CL_VERSION_2_0 -CLLD_DECL(clEnqueueSVMFree); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMFree(cl_command_queue command_queue, cl_uint num_svm_pointers, void * svm_pointers[], @@ -1368,8 +1268,7 @@ clEnqueueSVMFree(cl_command_queue command_queue, user_data, num_events_in_wait_list, event_wait_list, event); } -CLLD_DECL(clEnqueueSVMMemcpy); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMMemcpy(cl_command_queue command_queue, cl_bool blocking_copy, void * dst_ptr, @@ -1384,8 +1283,7 @@ clEnqueueSVMMemcpy(cl_command_queue command_queue, num_events_in_wait_list, event_wait_list, event); } -CLLD_DECL(clEnqueueSVMMemFill); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMMemFill(cl_command_queue command_queue, void * svm_ptr, const void * pattern, @@ -1400,8 +1298,7 @@ clEnqueueSVMMemFill(cl_command_queue command_queue, num_events_in_wait_list, event_wait_list, event); } -CLLD_DECL(clEnqueueSVMMap); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMMap(cl_command_queue command_queue, cl_bool blocking_map, cl_map_flags flags, @@ -1416,8 +1313,7 @@ clEnqueueSVMMap(cl_command_queue command_queue, num_events_in_wait_list, event_wait_list, event); } -CLLD_DECL(clEnqueueSVMUnmap); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMUnmap(cl_command_queue command_queue, void * svm_ptr, cl_uint num_events_in_wait_list, @@ -1433,8 +1329,7 @@ clEnqueueSVMUnmap(cl_command_queue command_queue, #ifdef CL_VERSION_2_1 -CLLD_DECL(clEnqueueSVMMigrateMem); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMMigrateMem(cl_command_queue command_queue, cl_uint num_svm_pointers, const void ** svm_pointers, @@ -1453,8 +1348,7 @@ clEnqueueSVMMigrateMem(cl_command_queue command_queue, #ifdef CL_VERSION_1_2 -CLLD_DECL(clGetExtensionFunctionAddressForPlatform); -inline CL_API_ENTRY void * CL_API_CALL +CLLD_INLINE CL_API_ENTRY void * CL_API_CALL clGetExtensionFunctionAddressForPlatform(cl_platform_id platform, const char * func_name) { CLLD_FETCH_NULL(clGetExtensionFunctionAddressForPlatform); @@ -1466,8 +1360,7 @@ clGetExtensionFunctionAddressForPlatform(cl_platform_id platform, #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS -CLLD_DECL(clSetCommandQueueProperty); -inline CL_API_ENTRY cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY cl_int CL_API_CALL clSetCommandQueueProperty(cl_command_queue command_queue, cl_command_queue_properties properties, cl_bool enable, @@ -1481,8 +1374,7 @@ clSetCommandQueueProperty(cl_command_queue command_queue, /* Deprecated OpenCL 1.1 APIs */ -CLLD_DECL(clCreateImage2D); -inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL +CLLD_INLINE CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL clCreateImage2D(cl_context context, cl_mem_flags flags, const cl_image_format * image_format, @@ -1497,8 +1389,7 @@ clCreateImage2D(cl_context context, image_height, image_row_pitch, host_ptr, errcode_ret); } -CLLD_DECL(clCreateImage3D); -inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL +CLLD_INLINE CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL clCreateImage3D(cl_context context, cl_mem_flags flags, const cl_image_format * image_format, @@ -1515,16 +1406,14 @@ clCreateImage3D(cl_context context, image_row_pitch, image_slice_pitch, host_ptr, errcode_ret); } -CLLD_DECL(clEnqueueMarker); -inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clEnqueueMarker(cl_command_queue command_queue, cl_event * event) { CLLD_FETCH(clEnqueueMarker); return CLLD_PTR(clEnqueueMarker)(command_queue, event); } -CLLD_DECL(clEnqueueWaitForEvents); -inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clEnqueueWaitForEvents(cl_command_queue command_queue, cl_uint num_events, const cl_event * event_list) { @@ -1533,22 +1422,19 @@ clEnqueueWaitForEvents(cl_command_queue command_queue, command_queue, num_events, event_list); } -CLLD_DECL(clEnqueueBarrier); -inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clEnqueueBarrier(cl_command_queue command_queue) { CLLD_FETCH(clEnqueueBarrier); return CLLD_PTR(clEnqueueBarrier)(command_queue); } -CLLD_DECL(clUnloadCompiler); -inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clUnloadCompiler(void) { CLLD_FETCH(clUnloadCompiler); return CLLD_PTR(clUnloadCompiler)(); } -CLLD_DECL(clGetExtensionFunctionAddress); -inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED void * CL_API_CALL +CLLD_INLINE CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED void * CL_API_CALL clGetExtensionFunctionAddress(const char * func_name) { CLLD_FETCH_NULL(clGetExtensionFunctionAddress); return CLLD_PTR(clGetExtensionFunctionAddress)(func_name); @@ -1556,8 +1442,7 @@ clGetExtensionFunctionAddress(const char * func_name) { /* Deprecated OpenCL 2.0 APIs */ -CLLD_DECL(clCreateCommandQueue); -inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_command_queue CL_API_CALL +CLLD_INLINE CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_command_queue CL_API_CALL clCreateCommandQueue(cl_context context, cl_device_id device, cl_command_queue_properties properties, @@ -1567,8 +1452,7 @@ clCreateCommandQueue(cl_context context, context, device, properties, errcode_ret); } -CLLD_DECL(clCreateSampler); -inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_sampler CL_API_CALL +CLLD_INLINE CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_sampler CL_API_CALL clCreateSampler(cl_context context, cl_bool normalized_coords, cl_addressing_mode addressing_mode, @@ -1579,8 +1463,7 @@ clCreateSampler(cl_context context, context, normalized_coords, addressing_mode, filter_mode, errcode_ret); } -CLLD_DECL(clEnqueueTask); -inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_int CL_API_CALL +CLLD_INLINE CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_int CL_API_CALL clEnqueueTask(cl_command_queue command_queue, cl_kernel kernel, cl_uint num_events_in_wait_list, diff --git a/CL/opencl.h b/CL/opencl.h index 20e4f964..57cf1621 100644 --- a/CL/opencl.h +++ b/CL/opencl.h @@ -21,10 +21,13 @@ extern "C" { #endif +#ifdef OPENCL_LOAD +#include +#else #include -#include #include #include +#endif #ifdef __cplusplus } diff --git a/CL/opencl_load.h b/CL/opencl_load.h index 7ff45391..0878d211 100644 --- a/CL/opencl_load.h +++ b/CL/opencl_load.h @@ -25,22 +25,189 @@ #include #include #endif +#include +#include +#include +#include #ifdef __cplusplus extern "C" { #endif -extern #ifdef _WIN32 -HMODULE +extern HMODULE opencl_lib_handle; #else -void * +extern void * opencl_lib_handle; #endif -opencl_lib_handle; + +typedef struct _clopencl_load_dispatch { + /* OpenCL 1.0 */ + cl_api_clGetPlatformIDs clGetPlatformIDs; + cl_api_clGetPlatformInfo clGetPlatformInfo; + cl_api_clGetDeviceIDs clGetDeviceIDs; + cl_api_clGetDeviceInfo clGetDeviceInfo; + cl_api_clCreateContext clCreateContext; + cl_api_clCreateContextFromType clCreateContextFromType; + cl_api_clRetainContext clRetainContext; + cl_api_clReleaseContext clReleaseContext; + cl_api_clGetContextInfo clGetContextInfo; + cl_api_clCreateCommandQueue clCreateCommandQueue; + cl_api_clRetainCommandQueue clRetainCommandQueue; + cl_api_clReleaseCommandQueue clReleaseCommandQueue; + cl_api_clGetCommandQueueInfo clGetCommandQueueInfo; + cl_api_clSetCommandQueueProperty clSetCommandQueueProperty; + cl_api_clCreateBuffer clCreateBuffer; + cl_api_clCreateImage2D clCreateImage2D; + cl_api_clCreateImage3D clCreateImage3D; + cl_api_clRetainMemObject clRetainMemObject; + cl_api_clReleaseMemObject clReleaseMemObject; + cl_api_clGetSupportedImageFormats clGetSupportedImageFormats; + cl_api_clGetMemObjectInfo clGetMemObjectInfo; + cl_api_clGetImageInfo clGetImageInfo; + cl_api_clCreateSampler clCreateSampler; + cl_api_clRetainSampler clRetainSampler; + cl_api_clReleaseSampler clReleaseSampler; + cl_api_clGetSamplerInfo clGetSamplerInfo; + cl_api_clCreateProgramWithSource clCreateProgramWithSource; + cl_api_clCreateProgramWithBinary clCreateProgramWithBinary; + cl_api_clRetainProgram clRetainProgram; + cl_api_clReleaseProgram clReleaseProgram; + cl_api_clBuildProgram clBuildProgram; + cl_api_clUnloadCompiler clUnloadCompiler; + cl_api_clGetProgramInfo clGetProgramInfo; + cl_api_clGetProgramBuildInfo clGetProgramBuildInfo; + cl_api_clCreateKernel clCreateKernel; + cl_api_clCreateKernelsInProgram clCreateKernelsInProgram; + cl_api_clRetainKernel clRetainKernel; + cl_api_clReleaseKernel clReleaseKernel; + cl_api_clSetKernelArg clSetKernelArg; + cl_api_clGetKernelInfo clGetKernelInfo; + cl_api_clGetKernelWorkGroupInfo clGetKernelWorkGroupInfo; + cl_api_clWaitForEvents clWaitForEvents; + cl_api_clGetEventInfo clGetEventInfo; + cl_api_clRetainEvent clRetainEvent; + cl_api_clReleaseEvent clReleaseEvent; + cl_api_clGetEventProfilingInfo clGetEventProfilingInfo; + cl_api_clFlush clFlush; + cl_api_clFinish clFinish; + cl_api_clEnqueueReadBuffer clEnqueueReadBuffer; + cl_api_clEnqueueWriteBuffer clEnqueueWriteBuffer; + cl_api_clEnqueueCopyBuffer clEnqueueCopyBuffer; + cl_api_clEnqueueReadImage clEnqueueReadImage; + cl_api_clEnqueueWriteImage clEnqueueWriteImage; + cl_api_clEnqueueCopyImage clEnqueueCopyImage; + cl_api_clEnqueueCopyImageToBuffer clEnqueueCopyImageToBuffer; + cl_api_clEnqueueCopyBufferToImage clEnqueueCopyBufferToImage; + cl_api_clEnqueueMapBuffer clEnqueueMapBuffer; + cl_api_clEnqueueMapImage clEnqueueMapImage; + cl_api_clEnqueueUnmapMemObject clEnqueueUnmapMemObject; + cl_api_clEnqueueNDRangeKernel clEnqueueNDRangeKernel; + cl_api_clEnqueueTask clEnqueueTask; + cl_api_clEnqueueNativeKernel clEnqueueNativeKernel; + cl_api_clEnqueueMarker clEnqueueMarker; + cl_api_clEnqueueWaitForEvents clEnqueueWaitForEvents; + cl_api_clEnqueueBarrier clEnqueueBarrier; + cl_api_clGetExtensionFunctionAddress clGetExtensionFunctionAddress; + cl_api_clCreateFromGLBuffer clCreateFromGLBuffer; + cl_api_clCreateFromGLTexture2D clCreateFromGLTexture2D; + cl_api_clCreateFromGLTexture3D clCreateFromGLTexture3D; + cl_api_clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer; + cl_api_clGetGLObjectInfo clGetGLObjectInfo; + cl_api_clGetGLTextureInfo clGetGLTextureInfo; + cl_api_clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects; + cl_api_clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects; + cl_api_clGetGLContextInfoKHR clGetGLContextInfoKHR; + + /* OpenCL 1.1 */ + cl_api_clSetEventCallback clSetEventCallback; + cl_api_clCreateSubBuffer clCreateSubBuffer; + cl_api_clSetMemObjectDestructorCallback clSetMemObjectDestructorCallback; + cl_api_clCreateUserEvent clCreateUserEvent; + cl_api_clSetUserEventStatus clSetUserEventStatus; + cl_api_clEnqueueReadBufferRect clEnqueueReadBufferRect; + cl_api_clEnqueueWriteBufferRect clEnqueueWriteBufferRect; + cl_api_clEnqueueCopyBufferRect clEnqueueCopyBufferRect; + + /* cl_ext_device_fission */ + cl_api_clCreateSubDevicesEXT clCreateSubDevicesEXT; + cl_api_clRetainDeviceEXT clRetainDeviceEXT; + cl_api_clReleaseDeviceEXT clReleaseDeviceEXT; + + /* cl_khr_gl_event */ + cl_api_clCreateEventFromGLsyncKHR clCreateEventFromGLsyncKHR; + + /* OpenCL 1.2 */ + cl_api_clCreateSubDevices clCreateSubDevices; + cl_api_clRetainDevice clRetainDevice; + cl_api_clReleaseDevice clReleaseDevice; + cl_api_clCreateImage clCreateImage; + cl_api_clCreateProgramWithBuiltInKernels clCreateProgramWithBuiltInKernels; + cl_api_clCompileProgram clCompileProgram; + cl_api_clLinkProgram clLinkProgram; + cl_api_clUnloadPlatformCompiler clUnloadPlatformCompiler; + cl_api_clGetKernelArgInfo clGetKernelArgInfo; + cl_api_clEnqueueFillBuffer clEnqueueFillBuffer; + cl_api_clEnqueueFillImage clEnqueueFillImage; + cl_api_clEnqueueMigrateMemObjects clEnqueueMigrateMemObjects; + cl_api_clEnqueueMarkerWithWaitList clEnqueueMarkerWithWaitList; + cl_api_clEnqueueBarrierWithWaitList clEnqueueBarrierWithWaitList; + cl_api_clGetExtensionFunctionAddressForPlatform + clGetExtensionFunctionAddressForPlatform; + cl_api_clCreateFromGLTexture clCreateFromGLTexture; + + /* cl_khr_egl_image */ + cl_api_clCreateFromEGLImageKHR clCreateFromEGLImageKHR; + cl_api_clEnqueueAcquireEGLObjectsKHR clEnqueueAcquireEGLObjectsKHR; + cl_api_clEnqueueReleaseEGLObjectsKHR clEnqueueReleaseEGLObjectsKHR; + + /* cl_khr_egl_event */ + cl_api_clCreateEventFromEGLSyncKHR clCreateEventFromEGLSyncKHR; + + /* OpenCL 2.0 */ + cl_api_clCreateCommandQueueWithProperties clCreateCommandQueueWithProperties; + cl_api_clCreatePipe clCreatePipe; + cl_api_clGetPipeInfo clGetPipeInfo; + cl_api_clSVMAlloc clSVMAlloc; + cl_api_clSVMFree clSVMFree; + cl_api_clEnqueueSVMFree clEnqueueSVMFree; + cl_api_clEnqueueSVMMemcpy clEnqueueSVMMemcpy; + cl_api_clEnqueueSVMMemFill clEnqueueSVMMemFill; + cl_api_clEnqueueSVMMap clEnqueueSVMMap; + cl_api_clEnqueueSVMUnmap clEnqueueSVMUnmap; + cl_api_clCreateSamplerWithProperties clCreateSamplerWithProperties; + cl_api_clSetKernelArgSVMPointer clSetKernelArgSVMPointer; + cl_api_clSetKernelExecInfo clSetKernelExecInfo; + + /* cl_khr_sub_groups */ + cl_api_clGetKernelSubGroupInfoKHR clGetKernelSubGroupInfoKHR; + + /* OpenCL 2.1 */ + cl_api_clCloneKernel clCloneKernel; + cl_api_clCreateProgramWithIL clCreateProgramWithIL; + cl_api_clEnqueueSVMMigrateMem clEnqueueSVMMigrateMem; + cl_api_clGetDeviceAndHostTimer clGetDeviceAndHostTimer; + cl_api_clGetHostTimer clGetHostTimer; + cl_api_clGetKernelSubGroupInfo clGetKernelSubGroupInfo; + cl_api_clSetDefaultDeviceCommandQueue clSetDefaultDeviceCommandQueue; + + /* OpenCL 2.2 */ + cl_api_clSetProgramReleaseCallback clSetProgramReleaseCallback; + cl_api_clSetProgramSpecializationConstant clSetProgramSpecializationConstant; + + /* OpenCL 3.0 */ + cl_api_clCreateBufferWithProperties clCreateBufferWithProperties; + cl_api_clCreateImageWithProperties clCreateImageWithProperties; + cl_api_clSetContextDestructorCallback clSetContextDestructorCallback; + +} opencl_load_dispatch; + + + +extern opencl_load_dispatch opencl_lib_dispatch; cl_int extOpenOpenCL(); -inline cl_int +static inline cl_int extFindOpenCLSymbol(void **pVar, const char *symbolName) { if(!opencl_lib_handle) { cl_int err = extOpenOpenCL(); @@ -54,15 +221,11 @@ extFindOpenCLSymbol(void **pVar, const char *symbolName) { return CL_SUCCESS; } -#define CLLD_PTR_NAME(name) name ## _ptr - -#define CLLD_PTR CLLD_PTR_NAME +#define CLLD_INLINE static inline -#define CLLD_DECL(name) \ -extern cl_api_ ## name CLLD_PTR_NAME(name) +#define CLLD_PTR_NAME(name) opencl_lib_dispatch.name -#define CLLD_DEF(name) \ -cl_api_ ## name CLLD_PTR_NAME(name) +#define CLLD_PTR CLLD_PTR_NAME #define CLLD_FETCH_SYMBOL(name) \ extFindOpenCLSymbol((void**)&CLLD_PTR_NAME(name), #name) @@ -91,6 +254,11 @@ do { \ } \ } while(0) +#include +#include +#include +#include + #ifdef __cplusplus } #endif diff --git a/CL/opencl_load_lib.h b/CL/opencl_load_lib.h index 3e517c0d..47a3df95 100644 --- a/CL/opencl_load_lib.h +++ b/CL/opencl_load_lib.h @@ -30,11 +30,12 @@ #ifdef _WIN32 static INIT_ONCE initialized = INIT_ONCE_STATIC_INIT; -HMODULE opencl_lib_handle; +HMODULE opencl_lib_handle = (HMODULE)NULL; #else static pthread_once_t initialized = PTHREAD_ONCE_INIT; -void *opencl_lib_handle; +void *opencl_lib_handle = NULL; #endif +opencl_load_dispatch opencl_lib_dispatch; #ifdef _WIN32 static void extOpenOpenCL_impl(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContext) { @@ -64,1094 +65,6 @@ cl_int extOpenOpenCL() { } } -extern inline cl_int -extFindOpenCLSymbol(void **pVar, const char *symbolName); - -/* Platform APIs */ - -CLLD_DEF(clGetPlatformIDs); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetPlatformIDs(cl_uint num_entries, - cl_platform_id * platforms, - cl_uint * num_platforms) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clGetPlatformInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetPlatformInfo(cl_platform_id platform, - cl_platform_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -/* Device APIs */ - -CLLD_DEF(clGetDeviceIDs); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetDeviceIDs(cl_platform_id platform, - cl_device_type device_type, - cl_uint num_entries, - cl_device_id * devices, - cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clGetDeviceInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetDeviceInfo(cl_device_id device, - cl_device_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -CLLD_DEF(clCreateSubDevices); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clCreateSubDevices(cl_device_id in_device, - const cl_device_partition_property * properties, - cl_uint num_devices, - cl_device_id * out_devices, - cl_uint * num_devices_ret) CL_API_SUFFIX__VERSION_1_2; - -CLLD_DEF(clRetainDevice); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clRetainDevice(cl_device_id device) CL_API_SUFFIX__VERSION_1_2; - -CLLD_DEF(clReleaseDevice); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clReleaseDevice(cl_device_id device) CL_API_SUFFIX__VERSION_1_2; - -#endif /* CL_VERSION_1_2 */ - -#ifdef CL_VERSION_2_1 - -CLLD_DEF(clSetDefaultDeviceCommandQueue); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clSetDefaultDeviceCommandQueue(cl_context context, - cl_device_id device, - cl_command_queue command_queue) CL_API_SUFFIX__VERSION_2_1; - -CLLD_DEF(clGetDeviceAndHostTimer); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetDeviceAndHostTimer(cl_device_id device, - cl_ulong* device_timestamp, - cl_ulong* host_timestamp) CL_API_SUFFIX__VERSION_2_1; - -CLLD_DEF(clGetHostTimer); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetHostTimer(cl_device_id device, - cl_ulong * host_timestamp) CL_API_SUFFIX__VERSION_2_1; - -#endif /* CL_VERSION_2_1 */ - -/* Context APIs */ - -CLLD_DEF(clCreateContext); -extern inline CL_API_ENTRY cl_context CL_API_CALL -clCreateContext(const cl_context_properties * properties, - cl_uint num_devices, - const cl_device_id * devices, - void (CL_CALLBACK * pfn_notify)(const char * errinfo, - const void * private_info, - size_t cb, - void * user_data), - void * user_data, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clCreateContextFromType); -extern inline CL_API_ENTRY cl_context CL_API_CALL -clCreateContextFromType(const cl_context_properties * properties, - cl_device_type device_type, - void (CL_CALLBACK * pfn_notify)(const char * errinfo, - const void * private_info, - size_t cb, - void * user_data), - void * user_data, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clRetainContext); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clRetainContext(cl_context context) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clReleaseContext); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clReleaseContext(cl_context context) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clGetContextInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetContextInfo(cl_context context, - cl_context_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_3_0 - -CLLD_DEF(clSetContextDestructorCallback); -extern inline 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 /* CL_VERSION_3_0 */ - -/* Command Queue APIs */ - -#ifdef CL_VERSION_2_0 - -CLLD_DEF(clCreateCommandQueueWithProperties); -extern inline CL_API_ENTRY cl_command_queue CL_API_CALL -clCreateCommandQueueWithProperties(cl_context context, - cl_device_id device, - const cl_queue_properties * properties, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_2_0; - -#endif /* CL_VERSION_2_0 */ - -CLLD_DEF(clRetainCommandQueue); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clRetainCommandQueue(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clReleaseCommandQueue); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clReleaseCommandQueue(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clGetCommandQueueInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetCommandQueueInfo(cl_command_queue command_queue, - cl_command_queue_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -/* Memory Object APIs */ - -CLLD_DEF(clCreateBuffer); -extern inline CL_API_ENTRY cl_mem CL_API_CALL -clCreateBuffer(cl_context context, - cl_mem_flags flags, - size_t size, - void * host_ptr, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_1 - -CLLD_DEF(clCreateSubBuffer); -extern inline CL_API_ENTRY cl_mem CL_API_CALL -clCreateSubBuffer(cl_mem buffer, - cl_mem_flags flags, - cl_buffer_create_type buffer_create_type, - const void * buffer_create_info, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1; - -#endif /* CL_VERSION_1_1 */ - -#ifdef CL_VERSION_1_2 - -CLLD_DEF(clCreateImage); -extern inline CL_API_ENTRY cl_mem CL_API_CALL -clCreateImage(cl_context context, - 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_1_2; - -#endif /* CL_VERSION_1_2 */ - -#ifdef CL_VERSION_2_0 - -CLLD_DEF(clCreatePipe); -extern inline CL_API_ENTRY cl_mem CL_API_CALL -clCreatePipe(cl_context context, - cl_mem_flags flags, - cl_uint pipe_packet_size, - cl_uint pipe_max_packets, - const cl_pipe_properties * properties, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_2_0; - -#endif /* CL_VERSION_2_0 */ - -#ifdef CL_VERSION_3_0 - -CLLD_DEF(clCreateBufferWithProperties); -extern inline 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; - -CLLD_DEF(clCreateImageWithProperties); -extern inline 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 /* CL_VERSION_3_0 */ - -CLLD_DEF(clRetainMemObject); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clRetainMemObject(cl_mem memobj) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clReleaseMemObject); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clReleaseMemObject(cl_mem memobj) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clGetSupportedImageFormats); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetSupportedImageFormats(cl_context context, - cl_mem_flags flags, - cl_mem_object_type image_type, - cl_uint num_entries, - cl_image_format * image_formats, - cl_uint * num_image_formats) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clGetMemObjectInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetMemObjectInfo(cl_mem memobj, - cl_mem_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clGetImageInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetImageInfo(cl_mem image, - cl_image_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_2_0 - -CLLD_DEF(clGetPipeInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetPipeInfo(cl_mem pipe, - cl_pipe_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_2_0; - -#endif /* CL_VERSION_2_0 */ - -#ifdef CL_VERSION_1_1 - -CLLD_DEF(clSetMemObjectDestructorCallback); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clSetMemObjectDestructorCallback(cl_mem memobj, - void (CL_CALLBACK * pfn_notify)(cl_mem memobj, - void * user_data), - void * user_data) CL_API_SUFFIX__VERSION_1_1; - -#endif /* CL_VERSION_1_1 */ - -#ifdef CL_VERSION_2_0 - -CLLD_DEF(clSVMAlloc); -extern inline CL_API_ENTRY void * CL_API_CALL -clSVMAlloc(cl_context context, - cl_svm_mem_flags flags, - size_t size, - cl_uint alignment) CL_API_SUFFIX__VERSION_2_0; - -CLLD_DEF(clSVMFree); -extern inline CL_API_ENTRY void CL_API_CALL -clSVMFree(cl_context context, - void * svm_pointer) CL_API_SUFFIX__VERSION_2_0; - -#endif /* CL_VERSION_2_0 */ - -/* Sampler APIs */ - -#ifdef CL_VERSION_2_0 - -CLLD_DEF(clCreateSamplerWithProperties); -extern inline CL_API_ENTRY cl_sampler CL_API_CALL -clCreateSamplerWithProperties(cl_context context, - const cl_sampler_properties * sampler_properties, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_2_0; - -#endif /* CL_VERSION_2_0 */ - -CLLD_DEF(clRetainSampler); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clRetainSampler(cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clReleaseSampler); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clReleaseSampler(cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clGetSamplerInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetSamplerInfo(cl_sampler sampler, - cl_sampler_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -/* Program Object APIs */ - -CLLD_DEF(clCreateProgramWithSource); -extern inline CL_API_ENTRY cl_program CL_API_CALL -clCreateProgramWithSource(cl_context context, - cl_uint count, - const char ** strings, - const size_t * lengths, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clCreateProgramWithBinary); -extern inline CL_API_ENTRY cl_program CL_API_CALL -clCreateProgramWithBinary(cl_context context, - cl_uint num_devices, - const cl_device_id * device_list, - const size_t * lengths, - const unsigned char ** binaries, - cl_int * binary_status, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -CLLD_DEF(clCreateProgramWithBuiltInKernels); -extern inline CL_API_ENTRY cl_program CL_API_CALL -clCreateProgramWithBuiltInKernels(cl_context context, - cl_uint num_devices, - const cl_device_id * device_list, - const char * kernel_names, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -#endif /* CL_VERSION_1_2 */ - -#ifdef CL_VERSION_2_1 - -CLLD_DEF(clCreateProgramWithIL); -extern inline CL_API_ENTRY cl_program CL_API_CALL -clCreateProgramWithIL(cl_context context, - const void* il, - size_t length, - cl_int* errcode_ret) CL_API_SUFFIX__VERSION_2_1; - -#endif /* CL_VERSION_2_1 */ - -CLLD_DEF(clRetainProgram); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clRetainProgram(cl_program program) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clReleaseProgram); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clReleaseProgram(cl_program program) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clBuildProgram); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clBuildProgram(cl_program program, - cl_uint num_devices, - const cl_device_id * device_list, - const char * options, - void (CL_CALLBACK * pfn_notify)(cl_program program, - void * user_data), - void * user_data) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -CLLD_DEF(clCompileProgram); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clCompileProgram(cl_program program, - cl_uint num_devices, - const cl_device_id * device_list, - const char * options, - cl_uint num_input_headers, - const cl_program * input_headers, - const char ** header_include_names, - void (CL_CALLBACK * pfn_notify)(cl_program program, - void * user_data), - void * user_data) CL_API_SUFFIX__VERSION_1_2; - -CLLD_DEF(clLinkProgram); -extern inline CL_API_ENTRY cl_program CL_API_CALL -clLinkProgram(cl_context context, - cl_uint num_devices, - const cl_device_id * device_list, - const char * options, - cl_uint num_input_programs, - const cl_program * input_programs, - void (CL_CALLBACK * pfn_notify)(cl_program program, - void * user_data), - void * user_data, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -#endif /* CL_VERSION_1_2 */ - -#ifdef CL_VERSION_2_2 - -CLLD_DEF(clSetProgramReleaseCallback); -extern inline CL_API_ENTRY CL_API_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_DEPRECATED; - -CLLD_DEF(clSetProgramSpecializationConstant); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clSetProgramSpecializationConstant(cl_program program, - cl_uint spec_id, - size_t spec_size, - const void* spec_value) CL_API_SUFFIX__VERSION_2_2; - -#endif /* CL_VERSION_2_2 */ - -#ifdef CL_VERSION_1_2 - -CLLD_DEF(clUnloadPlatformCompiler); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clUnloadPlatformCompiler(cl_platform_id platform) CL_API_SUFFIX__VERSION_1_2; - -#endif /* CL_VERSION_1_2 */ - -CLLD_DEF(clGetProgramInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetProgramInfo(cl_program program, - cl_program_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clGetProgramBuildInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetProgramBuildInfo(cl_program program, - cl_device_id device, - cl_program_build_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -/* Kernel Object APIs */ - -CLLD_DEF(clCreateKernel); -extern inline CL_API_ENTRY cl_kernel CL_API_CALL -clCreateKernel(cl_program program, - const char * kernel_name, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clCreateKernelsInProgram); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clCreateKernelsInProgram(cl_program program, - cl_uint num_kernels, - cl_kernel * kernels, - cl_uint * num_kernels_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_2_1 - -CLLD_DEF(clCloneKernel); -extern inline CL_API_ENTRY cl_kernel CL_API_CALL -clCloneKernel(cl_kernel source_kernel, - cl_int* errcode_ret) CL_API_SUFFIX__VERSION_2_1; - -#endif /* CL_VERSION_2_1 */ - -CLLD_DEF(clRetainKernel); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clRetainKernel(cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clReleaseKernel); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clReleaseKernel(cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clSetKernelArg); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clSetKernelArg(cl_kernel kernel, - cl_uint arg_index, - size_t arg_size, - const void * arg_value) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_2_0 - -CLLD_DEF(clSetKernelArgSVMPointer); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clSetKernelArgSVMPointer(cl_kernel kernel, - cl_uint arg_index, - const void * arg_value) CL_API_SUFFIX__VERSION_2_0; - -CLLD_DEF(clSetKernelExecInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clSetKernelExecInfo(cl_kernel kernel, - cl_kernel_exec_info param_name, - size_t param_value_size, - const void * param_value) CL_API_SUFFIX__VERSION_2_0; - -#endif /* CL_VERSION_2_0 */ - -CLLD_DEF(clGetKernelInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetKernelInfo(cl_kernel kernel, - cl_kernel_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -CLLD_DEF(clGetKernelArgInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetKernelArgInfo(cl_kernel kernel, - cl_uint arg_indx, - cl_kernel_arg_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_2; - -#endif /* CL_VERSION_1_2 */ - -CLLD_DEF(clGetKernelWorkGroupInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetKernelWorkGroupInfo(cl_kernel kernel, - cl_device_id device, - cl_kernel_work_group_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_2_1 - -CLLD_DEF(clGetKernelSubGroupInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetKernelSubGroupInfo(cl_kernel kernel, - cl_device_id device, - cl_kernel_sub_group_info param_name, - size_t input_value_size, - const void* input_value, - size_t param_value_size, - void* param_value, - size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_2_1; - -#endif /* CL_VERSION_2_1 */ - -/* Event Object APIs */ - -CLLD_DEF(clWaitForEvents); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clWaitForEvents(cl_uint num_events, - const cl_event * event_list) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clGetEventInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetEventInfo(cl_event event, - cl_event_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_1 - -CLLD_DEF(clCreateUserEvent); -extern inline CL_API_ENTRY cl_event CL_API_CALL -clCreateUserEvent(cl_context context, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1; - -#endif /* CL_VERSION_1_1 */ - -CLLD_DEF(clRetainEvent); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clRetainEvent(cl_event event) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clReleaseEvent); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clReleaseEvent(cl_event event) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_1 - -CLLD_DEF(clSetUserEventStatus); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clSetUserEventStatus(cl_event event, - cl_int execution_status) CL_API_SUFFIX__VERSION_1_1; - -CLLD_DEF(clSetEventCallback); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clSetEventCallback(cl_event event, - cl_int command_exec_callback_type, - void (CL_CALLBACK * pfn_notify)(cl_event event, - cl_int event_command_status, - void * user_data), - void * user_data) CL_API_SUFFIX__VERSION_1_1; - -#endif /* CL_VERSION_1_1 */ - -/* Profiling APIs */ - -CLLD_DEF(clGetEventProfilingInfo); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clGetEventProfilingInfo(cl_event event, - cl_profiling_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; - -/* Flush and Finish APIs */ - -CLLD_DEF(clFlush); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clFlush(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clFinish); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clFinish(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0; - -/* Enqueued Commands APIs */ - -CLLD_DEF(clEnqueueReadBuffer); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueReadBuffer(cl_command_queue command_queue, - cl_mem buffer, - cl_bool blocking_read, - size_t offset, - size_t size, - void * ptr, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_1 - -CLLD_DEF(clEnqueueReadBufferRect); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueReadBufferRect(cl_command_queue command_queue, - cl_mem buffer, - cl_bool blocking_read, - const size_t * buffer_origin, - const size_t * host_origin, - const size_t * region, - size_t buffer_row_pitch, - size_t buffer_slice_pitch, - size_t host_row_pitch, - size_t host_slice_pitch, - void * ptr, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_1; - -#endif /* CL_VERSION_1_1 */ - -CLLD_DEF(clEnqueueWriteBuffer); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueWriteBuffer(cl_command_queue command_queue, - cl_mem buffer, - cl_bool blocking_write, - size_t offset, - size_t size, - const void * ptr, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_1 - -CLLD_DEF(clEnqueueWriteBufferRect); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueWriteBufferRect(cl_command_queue command_queue, - cl_mem buffer, - cl_bool blocking_write, - const size_t * buffer_origin, - const size_t * host_origin, - const size_t * region, - size_t buffer_row_pitch, - size_t buffer_slice_pitch, - size_t host_row_pitch, - size_t host_slice_pitch, - const void * ptr, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_1; - -#endif /* CL_VERSION_1_1 */ - -#ifdef CL_VERSION_1_2 - -CLLD_DEF(clEnqueueFillBuffer); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueFillBuffer(cl_command_queue command_queue, - cl_mem buffer, - const void * pattern, - size_t pattern_size, - size_t offset, - size_t size, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_2; - -#endif /* CL_VERSION_1_2 */ - -CLLD_DEF(clEnqueueCopyBuffer); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueCopyBuffer(cl_command_queue command_queue, - cl_mem src_buffer, - cl_mem dst_buffer, - size_t src_offset, - size_t dst_offset, - size_t size, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_1 - -CLLD_DEF(clEnqueueCopyBufferRect); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueCopyBufferRect(cl_command_queue command_queue, - cl_mem src_buffer, - cl_mem dst_buffer, - const size_t * src_origin, - const size_t * dst_origin, - const size_t * region, - size_t src_row_pitch, - size_t src_slice_pitch, - size_t dst_row_pitch, - size_t dst_slice_pitch, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_1; - -#endif /* CL_VERSION_1_1 */ - -CLLD_DEF(clEnqueueReadImage); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueReadImage(cl_command_queue command_queue, - cl_mem image, - cl_bool blocking_read, - const size_t * origin, - const size_t * region, - size_t row_pitch, - size_t slice_pitch, - void * ptr, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clEnqueueWriteImage); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueWriteImage(cl_command_queue command_queue, - cl_mem image, - cl_bool blocking_write, - const size_t * origin, - const size_t * region, - size_t input_row_pitch, - size_t input_slice_pitch, - const void * ptr, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -CLLD_DEF(clEnqueueFillImage); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueFillImage(cl_command_queue command_queue, - cl_mem image, - const void * fill_color, - const size_t * origin, - const size_t * region, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_2; - -#endif /* CL_VERSION_1_2 */ - -CLLD_DEF(clEnqueueCopyImage); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueCopyImage(cl_command_queue command_queue, - cl_mem src_image, - cl_mem dst_image, - const size_t * src_origin, - const size_t * dst_origin, - const size_t * region, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clEnqueueCopyImageToBuffer); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueCopyImageToBuffer(cl_command_queue command_queue, - cl_mem src_image, - cl_mem dst_buffer, - const size_t * src_origin, - const size_t * region, - size_t dst_offset, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clEnqueueCopyBufferToImage); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueCopyBufferToImage(cl_command_queue command_queue, - cl_mem src_buffer, - cl_mem dst_image, - size_t src_offset, - const size_t * dst_origin, - const size_t * region, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clEnqueueMapBuffer); -extern inline CL_API_ENTRY void * CL_API_CALL -clEnqueueMapBuffer(cl_command_queue command_queue, - cl_mem buffer, - cl_bool blocking_map, - cl_map_flags map_flags, - size_t offset, - size_t size, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clEnqueueMapImage); -extern inline CL_API_ENTRY void * CL_API_CALL -clEnqueueMapImage(cl_command_queue command_queue, - cl_mem image, - cl_bool blocking_map, - cl_map_flags map_flags, - const size_t * origin, - const size_t * region, - size_t * image_row_pitch, - size_t * image_slice_pitch, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clEnqueueUnmapMemObject); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueUnmapMemObject(cl_command_queue command_queue, - cl_mem memobj, - void * mapped_ptr, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -CLLD_DEF(clEnqueueMigrateMemObjects); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueMigrateMemObjects(cl_command_queue command_queue, - cl_uint num_mem_objects, - const cl_mem * mem_objects, - cl_mem_migration_flags flags, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_2; - -#endif /* CL_VERSION_1_2 */ - -CLLD_DEF(clEnqueueNDRangeKernel); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueNDRangeKernel(cl_command_queue command_queue, - cl_kernel kernel, - cl_uint work_dim, - const size_t * global_work_offset, - const size_t * global_work_size, - const size_t * local_work_size, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_0; - -CLLD_DEF(clEnqueueNativeKernel); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueNativeKernel(cl_command_queue command_queue, - void (CL_CALLBACK * user_func)(void *), - void * args, - size_t cb_args, - cl_uint num_mem_objects, - const cl_mem * mem_list, - const void ** args_mem_loc, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -CLLD_DEF(clEnqueueMarkerWithWaitList); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueMarkerWithWaitList(cl_command_queue command_queue, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_2; - -CLLD_DEF(clEnqueueBarrierWithWaitList); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueBarrierWithWaitList(cl_command_queue command_queue, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_2; - -#endif /* CL_VERSION_1_2 */ - -#ifdef CL_VERSION_2_0 - -CLLD_DEF(clEnqueueSVMFree); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueSVMFree(cl_command_queue command_queue, - cl_uint num_svm_pointers, - void * svm_pointers[], - void (CL_CALLBACK * pfn_free_func)(cl_command_queue queue, - cl_uint num_svm_pointers, - void * svm_pointers[], - void * user_data), - void * user_data, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_2_0; - -CLLD_DEF(clEnqueueSVMMemcpy); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueSVMMemcpy(cl_command_queue command_queue, - cl_bool blocking_copy, - void * dst_ptr, - const void * src_ptr, - size_t size, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_2_0; - -CLLD_DEF(clEnqueueSVMMemFill); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueSVMMemFill(cl_command_queue command_queue, - void * svm_ptr, - const void * pattern, - size_t pattern_size, - size_t size, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_2_0; - -CLLD_DEF(clEnqueueSVMMap); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueSVMMap(cl_command_queue command_queue, - cl_bool blocking_map, - cl_map_flags flags, - void * svm_ptr, - size_t size, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_2_0; - -CLLD_DEF(clEnqueueSVMUnmap); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueSVMUnmap(cl_command_queue command_queue, - void * svm_ptr, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_2_0; - -#endif /* CL_VERSION_2_0 */ - -#ifdef CL_VERSION_2_1 - -CLLD_DEF(clEnqueueSVMMigrateMem); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clEnqueueSVMMigrateMem(cl_command_queue command_queue, - cl_uint num_svm_pointers, - const void ** svm_pointers, - const size_t * sizes, - cl_mem_migration_flags flags, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_2_1; - -#endif /* CL_VERSION_2_1 */ - -#ifdef CL_VERSION_1_2 - -CLLD_DEF(clGetExtensionFunctionAddressForPlatform); -extern inline CL_API_ENTRY void * CL_API_CALL -clGetExtensionFunctionAddressForPlatform(cl_platform_id platform, - const char * func_name) CL_API_SUFFIX__VERSION_1_2; - -#endif /* CL_VERSION_1_2 */ - -#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS - -CLLD_DEF(clSetCommandQueueProperty); -extern inline CL_API_ENTRY cl_int CL_API_CALL -clSetCommandQueueProperty(cl_command_queue command_queue, - cl_command_queue_properties properties, - cl_bool enable, - cl_command_queue_properties * old_properties) CL_API_SUFFIX__VERSION_1_0_DEPRECATED; - -#endif /* CL_USE_DEPRECATED_OPENCL_1_0_APIS */ - -CLLD_DEF(clCreateImage2D); -extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL -clCreateImage2D(cl_context context, - cl_mem_flags flags, - const cl_image_format * image_format, - size_t image_width, - size_t image_height, - size_t image_row_pitch, - void * host_ptr, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -CLLD_DEF(clCreateImage3D); -extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL -clCreateImage3D(cl_context context, - cl_mem_flags flags, - const cl_image_format * image_format, - size_t image_width, - size_t image_height, - size_t image_depth, - size_t image_row_pitch, - size_t image_slice_pitch, - void * host_ptr, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -CLLD_DEF(clEnqueueMarker); -extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL -clEnqueueMarker(cl_command_queue command_queue, - cl_event * event) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -CLLD_DEF(clEnqueueWaitForEvents); -extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL -clEnqueueWaitForEvents(cl_command_queue command_queue, - cl_uint num_events, - const cl_event * event_list) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -CLLD_DEF(clEnqueueBarrier); -extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL -clEnqueueBarrier(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -CLLD_DEF(clUnloadCompiler); -extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL -clUnloadCompiler(void) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -CLLD_DEF(clGetExtensionFunctionAddress); -extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED void * CL_API_CALL -clGetExtensionFunctionAddress(const char * func_name) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -CLLD_DEF(clCreateCommandQueue); -extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_command_queue CL_API_CALL -clCreateCommandQueue(cl_context context, - cl_device_id device, - cl_command_queue_properties properties, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2_DEPRECATED; - -CLLD_DEF(clCreateSampler); -extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_sampler CL_API_CALL -clCreateSampler(cl_context context, - cl_bool normalized_coords, - cl_addressing_mode addressing_mode, - cl_filter_mode filter_mode, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2_DEPRECATED; - -CLLD_DEF(clEnqueueTask); -extern inline CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_int CL_API_CALL -clEnqueueTask(cl_command_queue command_queue, - cl_kernel kernel, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) CL_API_SUFFIX__VERSION_1_2_DEPRECATED; - #endif /* OPENCL_LOAD */ #endif /* OPENCL_DLOPEN_lib_H */ From 3684c3768ab73a559b1bc17930b530de1c7e39e5 Mon Sep 17 00:00:00 2001 From: Brice Videau Date: Fri, 21 May 2021 13:08:10 -0500 Subject: [PATCH 3/4] Conform structure naming to the rest of the proposal. --- CL/opencl_load.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CL/opencl_load.h b/CL/opencl_load.h index 0878d211..e4dfaf98 100644 --- a/CL/opencl_load.h +++ b/CL/opencl_load.h @@ -40,7 +40,7 @@ extern HMODULE opencl_lib_handle; extern void * opencl_lib_handle; #endif -typedef struct _clopencl_load_dispatch { +typedef struct _opencl_load_dispatch { /* OpenCL 1.0 */ cl_api_clGetPlatformIDs clGetPlatformIDs; cl_api_clGetPlatformInfo clGetPlatformInfo; From 4ffdc5efcad792dda20be962b012831e84184a8c Mon Sep 17 00:00:00 2001 From: Brice Videau Date: Fri, 21 May 2021 13:11:18 -0500 Subject: [PATCH 4/4] Simplified/corrected Windows library loading, thanks to @jenatali --- CL/opencl_load_lib.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/CL/opencl_load_lib.h b/CL/opencl_load_lib.h index 47a3df95..e341ac8d 100644 --- a/CL/opencl_load_lib.h +++ b/CL/opencl_load_lib.h @@ -40,11 +40,7 @@ opencl_load_dispatch opencl_lib_dispatch; #ifdef _WIN32 static void extOpenOpenCL_impl(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContext) { (void)InitOnce; (void)Parameter; (void)lpContext; - opencl_lib_handle = LoadLibraryExA(libraryName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - if (!opencl_lib_handle && GetLastError() == ERROR_INVALID_PARAMETER) - { - opencl_lib_handle = LoadLibraryExA("OpencL", NULL, 0); - } + opencl_lib_handle = LoadLibraryA("OpenCL"); } #else static void extOpenOpenCL_impl() {