diff --git a/doxygen/doxygen.cfg b/doxygen/doxygen.cfg index 28942e98d4a..36bb2d4a8a7 100644 --- a/doxygen/doxygen.cfg +++ b/doxygen/doxygen.cfg @@ -2295,7 +2295,7 @@ INCLUDE_PATH = ./ \ lib/eigen_3.4.0 \ lib/sundials_6.1.1/include \ lib/sundials_6.1.1/src/sundials \ - lib/opencl_3.0.0 \ + lib/opencl_v2025.07.22 \ lib/benchmark_1.5.1/googletest/googletest/include \ lib/benchmark_1.5.1/googletest/googletest diff --git a/lib/opencl_3.0.0/CL/STAN_CHANGES b/lib/opencl_3.0.0/CL/STAN_CHANGES deleted file mode 100644 index 6fd8ff1fba6..00000000000 --- a/lib/opencl_3.0.0/CL/STAN_CHANGES +++ /dev/null @@ -1 +0,0 @@ -Added //! \cond DOXYGEN_DETAIL in front of details sections diff --git a/lib/opencl_3.0.0/CL/cl_d3d10.h b/lib/opencl_3.0.0/CL/cl_d3d10.h deleted file mode 100644 index 6adedb06163..00000000000 --- a/lib/opencl_3.0.0/CL/cl_d3d10.h +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * 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_D3D10_H -#define __OPENCL_CL_D3D10_H - -#if defined(_MSC_VER) -#if _MSC_VER >=1500 -#pragma warning( push ) -#pragma warning( disable : 4201 ) -#endif -#endif -#include -#if defined(_MSC_VER) -#if _MSC_VER >=1500 -#pragma warning( pop ) -#endif -#endif -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/****************************************************************************** - * cl_khr_d3d10_sharing */ -#define cl_khr_d3d10_sharing 1 - -typedef cl_uint cl_d3d10_device_source_khr; -typedef cl_uint cl_d3d10_device_set_khr; - -/******************************************************************************/ - -/* Error Codes */ -#define CL_INVALID_D3D10_DEVICE_KHR -1002 -#define CL_INVALID_D3D10_RESOURCE_KHR -1003 -#define CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR -1004 -#define CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR -1005 - -/* cl_d3d10_device_source_nv */ -#define CL_D3D10_DEVICE_KHR 0x4010 -#define CL_D3D10_DXGI_ADAPTER_KHR 0x4011 - -/* cl_d3d10_device_set_nv */ -#define CL_PREFERRED_DEVICES_FOR_D3D10_KHR 0x4012 -#define CL_ALL_DEVICES_FOR_D3D10_KHR 0x4013 - -/* cl_context_info */ -#define CL_CONTEXT_D3D10_DEVICE_KHR 0x4014 -#define CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR 0x402C - -/* cl_mem_info */ -#define CL_MEM_D3D10_RESOURCE_KHR 0x4015 - -/* cl_image_info */ -#define CL_IMAGE_D3D10_SUBRESOURCE_KHR 0x4016 - -/* cl_command_type */ -#define CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR 0x4017 -#define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR 0x4018 - -/******************************************************************************/ - -typedef cl_int (CL_API_CALL *clGetDeviceIDsFromD3D10KHR_fn)( - cl_platform_id platform, - cl_d3d10_device_source_khr d3d_device_source, - void * d3d_object, - cl_d3d10_device_set_khr d3d_device_set, - cl_uint num_entries, - cl_device_id * devices, - cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_mem (CL_API_CALL *clCreateFromD3D10BufferKHR_fn)( - cl_context context, - cl_mem_flags flags, - ID3D10Buffer * resource, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_mem (CL_API_CALL *clCreateFromD3D10Texture2DKHR_fn)( - cl_context context, - cl_mem_flags flags, - ID3D10Texture2D * resource, - UINT subresource, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_mem (CL_API_CALL *clCreateFromD3D10Texture3DKHR_fn)( - cl_context context, - cl_mem_flags flags, - ID3D10Texture3D * resource, - UINT subresource, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int (CL_API_CALL *clEnqueueAcquireD3D10ObjectsKHR_fn)( - 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 *clEnqueueReleaseD3D10ObjectsKHR_fn)( - 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; - -#ifdef __cplusplus -} -#endif - -#endif /* __OPENCL_CL_D3D10_H */ - diff --git a/lib/opencl_3.0.0/CL/cl_d3d11.h b/lib/opencl_3.0.0/CL/cl_d3d11.h deleted file mode 100644 index 50ed906b3bb..00000000000 --- a/lib/opencl_3.0.0/CL/cl_d3d11.h +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * 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_D3D11_H -#define __OPENCL_CL_D3D11_H - -#if defined(_MSC_VER) -#if _MSC_VER >=1500 -#pragma warning( push ) -#pragma warning( disable : 4201 ) -#endif -#endif -#include -#if defined(_MSC_VER) -#if _MSC_VER >=1500 -#pragma warning( pop ) -#endif -#endif -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/****************************************************************************** - * cl_khr_d3d11_sharing */ -#define cl_khr_d3d11_sharing 1 - -typedef cl_uint cl_d3d11_device_source_khr; -typedef cl_uint cl_d3d11_device_set_khr; - -/******************************************************************************/ - -/* Error Codes */ -#define CL_INVALID_D3D11_DEVICE_KHR -1006 -#define CL_INVALID_D3D11_RESOURCE_KHR -1007 -#define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR -1008 -#define CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR -1009 - -/* cl_d3d11_device_source */ -#define CL_D3D11_DEVICE_KHR 0x4019 -#define CL_D3D11_DXGI_ADAPTER_KHR 0x401A - -/* cl_d3d11_device_set */ -#define CL_PREFERRED_DEVICES_FOR_D3D11_KHR 0x401B -#define CL_ALL_DEVICES_FOR_D3D11_KHR 0x401C - -/* cl_context_info */ -#define CL_CONTEXT_D3D11_DEVICE_KHR 0x401D -#define CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR 0x402D - -/* cl_mem_info */ -#define CL_MEM_D3D11_RESOURCE_KHR 0x401E - -/* cl_image_info */ -#define CL_IMAGE_D3D11_SUBRESOURCE_KHR 0x401F - -/* cl_command_type */ -#define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR 0x4020 -#define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR 0x4021 - -/******************************************************************************/ - -typedef cl_int (CL_API_CALL *clGetDeviceIDsFromD3D11KHR_fn)( - cl_platform_id platform, - cl_d3d11_device_source_khr d3d_device_source, - void * d3d_object, - cl_d3d11_device_set_khr d3d_device_set, - cl_uint num_entries, - cl_device_id * devices, - cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_mem (CL_API_CALL *clCreateFromD3D11BufferKHR_fn)( - cl_context context, - cl_mem_flags flags, - ID3D11Buffer * resource, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_mem (CL_API_CALL *clCreateFromD3D11Texture2DKHR_fn)( - cl_context context, - cl_mem_flags flags, - ID3D11Texture2D * resource, - UINT subresource, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_mem (CL_API_CALL *clCreateFromD3D11Texture3DKHR_fn)( - cl_context context, - cl_mem_flags flags, - ID3D11Texture3D * resource, - UINT subresource, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_int (CL_API_CALL *clEnqueueAcquireD3D11ObjectsKHR_fn)( - 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_2; - -typedef cl_int (CL_API_CALL *clEnqueueReleaseD3D11ObjectsKHR_fn)( - 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_2; - -#ifdef __cplusplus -} -#endif - -#endif /* __OPENCL_CL_D3D11_H */ - diff --git a/lib/opencl_3.0.0/CL/cl_dx9_media_sharing.h b/lib/opencl_3.0.0/CL/cl_dx9_media_sharing.h deleted file mode 100644 index b0d2b23401c..00000000000 --- a/lib/opencl_3.0.0/CL/cl_dx9_media_sharing.h +++ /dev/null @@ -1,229 +0,0 @@ -/******************************************************************************* - * 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_DX9_MEDIA_SHARING_H -#define __OPENCL_CL_DX9_MEDIA_SHARING_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************/ -/* cl_khr_dx9_media_sharing */ -#define cl_khr_dx9_media_sharing 1 - -typedef cl_uint cl_dx9_media_adapter_type_khr; -typedef cl_uint cl_dx9_media_adapter_set_khr; - -#if defined(_WIN32) -#include -typedef struct _cl_dx9_surface_info_khr -{ - IDirect3DSurface9 *resource; - HANDLE shared_handle; -} cl_dx9_surface_info_khr; -#endif - - -/******************************************************************************/ - -/* Error Codes */ -#define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010 -#define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011 -#define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012 -#define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013 - -/* cl_media_adapter_type_khr */ -#define CL_ADAPTER_D3D9_KHR 0x2020 -#define CL_ADAPTER_D3D9EX_KHR 0x2021 -#define CL_ADAPTER_DXVA_KHR 0x2022 - -/* cl_media_adapter_set_khr */ -#define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023 -#define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024 - -/* cl_context_info */ -#define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025 -#define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026 -#define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027 - -/* cl_mem_info */ -#define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028 -#define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029 - -/* cl_image_info */ -#define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A - -/* cl_command_type */ -#define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B -#define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C - -/******************************************************************************/ - -typedef cl_int (CL_API_CALL *clGetDeviceIDsFromDX9MediaAdapterKHR_fn)( - cl_platform_id platform, - cl_uint num_media_adapters, - cl_dx9_media_adapter_type_khr * media_adapter_type, - void * media_adapters, - cl_dx9_media_adapter_set_khr media_adapter_set, - cl_uint num_entries, - cl_device_id * devices, - cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceKHR_fn)( - cl_context context, - cl_mem_flags flags, - cl_dx9_media_adapter_type_khr adapter_type, - void * surface_info, - cl_uint plane, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_int (CL_API_CALL *clEnqueueAcquireDX9MediaSurfacesKHR_fn)( - 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_2; - -typedef cl_int (CL_API_CALL *clEnqueueReleaseDX9MediaSurfacesKHR_fn)( - 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_2; - -/*************************************** -* cl_intel_dx9_media_sharing extension * -****************************************/ - -#define cl_intel_dx9_media_sharing 1 - -typedef cl_uint cl_dx9_device_source_intel; -typedef cl_uint cl_dx9_device_set_intel; - -/* error codes */ -#define CL_INVALID_DX9_DEVICE_INTEL -1010 -#define CL_INVALID_DX9_RESOURCE_INTEL -1011 -#define CL_DX9_RESOURCE_ALREADY_ACQUIRED_INTEL -1012 -#define CL_DX9_RESOURCE_NOT_ACQUIRED_INTEL -1013 - -/* cl_dx9_device_source_intel */ -#define CL_D3D9_DEVICE_INTEL 0x4022 -#define CL_D3D9EX_DEVICE_INTEL 0x4070 -#define CL_DXVA_DEVICE_INTEL 0x4071 - -/* cl_dx9_device_set_intel */ -#define CL_PREFERRED_DEVICES_FOR_DX9_INTEL 0x4024 -#define CL_ALL_DEVICES_FOR_DX9_INTEL 0x4025 - -/* cl_context_info */ -#define CL_CONTEXT_D3D9_DEVICE_INTEL 0x4026 -#define CL_CONTEXT_D3D9EX_DEVICE_INTEL 0x4072 -#define CL_CONTEXT_DXVA_DEVICE_INTEL 0x4073 - -/* cl_mem_info */ -#define CL_MEM_DX9_RESOURCE_INTEL 0x4027 -#define CL_MEM_DX9_SHARED_HANDLE_INTEL 0x4074 - -/* cl_image_info */ -#define CL_IMAGE_DX9_PLANE_INTEL 0x4075 - -/* cl_command_type */ -#define CL_COMMAND_ACQUIRE_DX9_OBJECTS_INTEL 0x402A -#define CL_COMMAND_RELEASE_DX9_OBJECTS_INTEL 0x402B -/******************************************************************************/ - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetDeviceIDsFromDX9INTEL( - cl_platform_id platform, - cl_dx9_device_source_intel dx9_device_source, - void* dx9_object, - cl_dx9_device_set_intel dx9_device_set, - cl_uint num_entries, - cl_device_id* devices, - cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_1; - -typedef cl_int (CL_API_CALL* clGetDeviceIDsFromDX9INTEL_fn)( - cl_platform_id platform, - cl_dx9_device_source_intel dx9_device_source, - void* dx9_object, - cl_dx9_device_set_intel dx9_device_set, - cl_uint num_entries, - cl_device_id* devices, - cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_1; - -extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateFromDX9MediaSurfaceINTEL( - cl_context context, - cl_mem_flags flags, - IDirect3DSurface9* resource, - HANDLE sharedHandle, - UINT plane, - cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1; - -typedef cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceINTEL_fn)( - cl_context context, - cl_mem_flags flags, - IDirect3DSurface9* resource, - HANDLE sharedHandle, - UINT plane, - cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueAcquireDX9ObjectsINTEL( - 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_1; - -typedef cl_int (CL_API_CALL *clEnqueueAcquireDX9ObjectsINTEL_fn)( - 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_1; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueReleaseDX9ObjectsINTEL( - cl_command_queue command_queue, - cl_uint num_objects, - 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_1; - -typedef cl_int (CL_API_CALL *clEnqueueReleaseDX9ObjectsINTEL_fn)( - cl_command_queue command_queue, - cl_uint num_objects, - 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_1; - -#ifdef __cplusplus -} -#endif - -#endif /* __OPENCL_CL_DX9_MEDIA_SHARING_H */ - diff --git a/lib/opencl_3.0.0/CL/cl_egl.h b/lib/opencl_3.0.0/CL/cl_egl.h deleted file mode 100644 index 357a37c021c..00000000000 --- a/lib/opencl_3.0.0/CL/cl_egl.h +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * 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_H -#define __OPENCL_CL_EGL_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Command type for events created with clEnqueueAcquireEGLObjectsKHR */ -#define CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR 0x202F -#define CL_COMMAND_ACQUIRE_EGL_OBJECTS_KHR 0x202D -#define CL_COMMAND_RELEASE_EGL_OBJECTS_KHR 0x202E - -/* Error type for clCreateFromEGLImageKHR */ -#define CL_INVALID_EGL_OBJECT_KHR -1093 -#define CL_EGL_RESOURCE_NOT_ACQUIRED_KHR -1092 - -/* CLeglImageKHR is an opaque handle to an EGLImage */ -typedef void* CLeglImageKHR; - -/* CLeglDisplayKHR is an opaque handle to an EGLDisplay */ -typedef void* CLeglDisplayKHR; - -/* CLeglSyncKHR is an opaque handle to an EGLSync object */ -typedef void* CLeglSyncKHR; - -/* properties passed to clCreateFromEGLImageKHR */ -typedef intptr_t cl_egl_image_properties_khr; - - -#define cl_khr_egl_image 1 - -extern 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) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_mem (CL_API_CALL *clCreateFromEGLImageKHR_fn)( - cl_context context, - CLeglDisplayKHR egldisplay, - CLeglImageKHR eglimage, - cl_mem_flags flags, - const cl_egl_image_properties_khr * properties, - cl_int * errcode_ret); - - -extern 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) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int (CL_API_CALL *clEnqueueAcquireEGLObjectsKHR_fn)( - 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); - - -extern 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) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_int (CL_API_CALL *clEnqueueReleaseEGLObjectsKHR_fn)( - 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); - - -#define cl_khr_egl_event 1 - -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; - -typedef cl_event (CL_API_CALL *clCreateEventFromEGLSyncKHR_fn)( - cl_context context, - CLeglSyncKHR sync, - CLeglDisplayKHR display, - cl_int * errcode_ret); - -#ifdef __cplusplus -} -#endif - -#endif /* __OPENCL_CL_EGL_H */ diff --git a/lib/opencl_3.0.0/CL/cl_ext.h b/lib/opencl_3.0.0/CL/cl_ext.h deleted file mode 100644 index 36d0256843f..00000000000 --- a/lib/opencl_3.0.0/CL/cl_ext.h +++ /dev/null @@ -1,1723 +0,0 @@ -/******************************************************************************* - * 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. - ******************************************************************************/ - -/* cl_ext.h contains OpenCL extensions which don't have external */ -/* (OpenGL, D3D) dependencies. */ - -#ifndef __CL_EXT_H -#define __CL_EXT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* cl_khr_fp64 extension - no extension #define since it has no functions */ -/* CL_DEVICE_DOUBLE_FP_CONFIG is defined in CL.h for OpenCL >= 120 */ - -#if CL_TARGET_OPENCL_VERSION <= 110 -#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032 -#endif - -/* cl_khr_fp16 extension - no extension #define since it has no functions */ -#define CL_DEVICE_HALF_FP_CONFIG 0x1033 - -/* Memory object destruction - * - * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR - * - * Registers a user callback function that will be called when the memory object is deleted and its resources - * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback - * stack associated with memobj. The registered user callback functions are called in the reverse order in - * which they were registered. The user callback functions are called and then the memory object is deleted - * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be - * notified when the memory referenced by host_ptr, specified when the memory object is created and used as - * the storage bits for the memory object, can be reused or freed. - * - * The application may not call CL api's with the cl_mem object passed to the pfn_notify. - * - * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) - * before using. - */ -#define cl_APPLE_SetMemObjectDestructor 1 -extern CL_API_ENTRY cl_int CL_API_CALL clSetMemObjectDestructorAPPLE( cl_mem memobj, - void (* pfn_notify)(cl_mem memobj, void * user_data), - void * user_data) CL_API_SUFFIX__VERSION_1_0; - - -/* Context Logging Functions - * - * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext(). - * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) - * before using. - * - * clLogMessagesToSystemLog forwards on all log messages to the Apple System Logger - */ -#define cl_APPLE_ContextLoggingFunctions 1 -extern CL_API_ENTRY void CL_API_CALL clLogMessagesToSystemLogAPPLE( const char * errstr, - const void * private_info, - size_t cb, - void * user_data) CL_API_SUFFIX__VERSION_1_0; - -/* clLogMessagesToStdout sends all log messages to the file descriptor stdout */ -extern CL_API_ENTRY void CL_API_CALL clLogMessagesToStdoutAPPLE( const char * errstr, - const void * private_info, - size_t cb, - void * user_data) CL_API_SUFFIX__VERSION_1_0; - -/* clLogMessagesToStderr sends all log messages to the file descriptor stderr */ -extern CL_API_ENTRY void CL_API_CALL clLogMessagesToStderrAPPLE( const char * errstr, - const void * private_info, - size_t cb, - void * user_data) CL_API_SUFFIX__VERSION_1_0; - - -/************************ -* cl_khr_icd extension * -************************/ -#define cl_khr_icd 1 - -/* cl_platform_info */ -#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920 - -/* Additional Error Codes */ -#define CL_PLATFORM_NOT_FOUND_KHR -1001 - -extern CL_API_ENTRY cl_int CL_API_CALL -clIcdGetPlatformIDsKHR(cl_uint num_entries, - cl_platform_id * platforms, - cl_uint * num_platforms); - -typedef cl_int -(CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(cl_uint num_entries, - cl_platform_id * platforms, - cl_uint * num_platforms); - - -/******************************* - * cl_khr_il_program extension * - *******************************/ -#define cl_khr_il_program 1 - -/* New property to clGetDeviceInfo for retrieving supported intermediate - * languages - */ -#define CL_DEVICE_IL_VERSION_KHR 0x105B - -/* New property to clGetProgramInfo for retrieving for retrieving the IL of a - * program - */ -#define CL_PROGRAM_IL_KHR 0x1169 - -extern CL_API_ENTRY cl_program CL_API_CALL -clCreateProgramWithILKHR(cl_context context, - const void * il, - size_t length, - cl_int * errcode_ret); - -typedef cl_program -(CL_API_CALL *clCreateProgramWithILKHR_fn)(cl_context context, - const void * il, - size_t length, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -/* Extension: cl_khr_image2d_from_buffer - * - * This extension allows a 2D image to be created from a cl_mem buffer without - * a copy. The type associated with a 2D image created from a buffer in an - * OpenCL program is image2d_t. Both the sampler and sampler-less read_image - * built-in functions are supported for 2D images and 2D images created from - * a buffer. Similarly, the write_image built-ins are also supported for 2D - * images created from a buffer. - * - * When the 2D image from buffer is created, the client must specify the - * width, height, image format (i.e. channel order and channel data type) - * and optionally the row pitch. - * - * The pitch specified must be a multiple of - * CL_DEVICE_IMAGE_PITCH_ALIGNMENT_KHR pixels. - * The base address of the buffer must be aligned to - * CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR pixels. - */ - -#define CL_DEVICE_IMAGE_PITCH_ALIGNMENT_KHR 0x104A -#define CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR 0x104B - - -/************************************** - * cl_khr_initialize_memory extension * - **************************************/ - -#define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x2030 - - -/************************************** - * cl_khr_terminate_context extension * - **************************************/ - -#define CL_CONTEXT_TERMINATED_KHR -1121 - -#define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x2031 -#define CL_CONTEXT_TERMINATE_KHR 0x2032 - -#define cl_khr_terminate_context 1 -extern CL_API_ENTRY cl_int CL_API_CALL -clTerminateContextKHR(cl_context context) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_int -(CL_API_CALL *clTerminateContextKHR_fn)(cl_context context) CL_API_SUFFIX__VERSION_1_2; - - -/* - * Extension: cl_khr_spir - * - * This extension adds support to create an OpenCL program object from a - * Standard Portable Intermediate Representation (SPIR) instance - */ - -#define CL_DEVICE_SPIR_VERSIONS 0x40E0 -#define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE 0x40E1 - - -/***************************************** - * cl_khr_create_command_queue extension * - *****************************************/ -#define cl_khr_create_command_queue 1 - -typedef cl_properties cl_queue_properties_khr; - -extern CL_API_ENTRY cl_command_queue CL_API_CALL -clCreateCommandQueueWithPropertiesKHR(cl_context context, - cl_device_id device, - const cl_queue_properties_khr* properties, - cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_command_queue -(CL_API_CALL *clCreateCommandQueueWithPropertiesKHR_fn)(cl_context context, - cl_device_id device, - const cl_queue_properties_khr* properties, - cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; - - -/****************************************** -* cl_nv_device_attribute_query extension * -******************************************/ - -/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */ -#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000 -#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001 -#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002 -#define CL_DEVICE_WARP_SIZE_NV 0x4003 -#define CL_DEVICE_GPU_OVERLAP_NV 0x4004 -#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005 -#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006 - - -/********************************* -* cl_amd_device_attribute_query * -*********************************/ - -#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036 -#define CL_DEVICE_TOPOLOGY_AMD 0x4037 -#define CL_DEVICE_BOARD_NAME_AMD 0x4038 -#define CL_DEVICE_GLOBAL_FREE_MEMORY_AMD 0x4039 -#define CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD 0x4040 -#define CL_DEVICE_SIMD_WIDTH_AMD 0x4041 -#define CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD 0x4042 -#define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043 -#define CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD 0x4044 -#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD 0x4045 -#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD 0x4046 -#define CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD 0x4047 -#define CL_DEVICE_LOCAL_MEM_BANKS_AMD 0x4048 -#define CL_DEVICE_THREAD_TRACE_SUPPORTED_AMD 0x4049 -#define CL_DEVICE_GFXIP_MAJOR_AMD 0x404A -#define CL_DEVICE_GFXIP_MINOR_AMD 0x404B -#define CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD 0x404C -#define CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_AMD 0x4030 -#define CL_DEVICE_MAX_WORK_GROUP_SIZE_AMD 0x4031 -#define CL_DEVICE_PREFERRED_CONSTANT_BUFFER_SIZE_AMD 0x4033 -#define CL_DEVICE_PCIE_ID_AMD 0x4034 - - -/********************************* -* cl_arm_printf extension -*********************************/ - -#define CL_PRINTF_CALLBACK_ARM 0x40B0 -#define CL_PRINTF_BUFFERSIZE_ARM 0x40B1 - - -/*********************************** -* cl_ext_device_fission extension -***********************************/ -#define cl_ext_device_fission 1 - -extern CL_API_ENTRY cl_int CL_API_CALL -clReleaseDeviceEXT(cl_device_id device) CL_API_SUFFIX__VERSION_1_1; - -typedef cl_int -(CL_API_CALL *clReleaseDeviceEXT_fn)(cl_device_id device) CL_API_SUFFIX__VERSION_1_1; - -extern CL_API_ENTRY cl_int CL_API_CALL -clRetainDeviceEXT(cl_device_id device) CL_API_SUFFIX__VERSION_1_1; - -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; -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; - -typedef cl_int -(CL_API_CALL * clCreateSubDevicesEXT_fn)(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; - -/* cl_device_partition_property_ext */ -#define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050 -#define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051 -#define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052 -#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053 - -/* clDeviceGetInfo selectors */ -#define CL_DEVICE_PARENT_DEVICE_EXT 0x4054 -#define CL_DEVICE_PARTITION_TYPES_EXT 0x4055 -#define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056 -#define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057 -#define CL_DEVICE_PARTITION_STYLE_EXT 0x4058 - -/* error codes */ -#define CL_DEVICE_PARTITION_FAILED_EXT -1057 -#define CL_INVALID_PARTITION_COUNT_EXT -1058 -#define CL_INVALID_PARTITION_NAME_EXT -1059 - -/* CL_AFFINITY_DOMAINs */ -#define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1 -#define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2 -#define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3 -#define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4 -#define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10 -#define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100 - -/* cl_device_partition_property_ext list terminators */ -#define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0) -#define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0) -#define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1) - - -/*********************************** - * cl_ext_migrate_memobject extension definitions - ***********************************/ -#define cl_ext_migrate_memobject 1 - -typedef cl_bitfield cl_mem_migration_flags_ext; - -#define CL_MIGRATE_MEM_OBJECT_HOST_EXT 0x1 - -#define CL_COMMAND_MIGRATE_MEM_OBJECT_EXT 0x4040 - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueMigrateMemObjectEXT(cl_command_queue command_queue, - cl_uint num_mem_objects, - const cl_mem * mem_objects, - cl_mem_migration_flags_ext flags, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event); - -typedef cl_int -(CL_API_CALL *clEnqueueMigrateMemObjectEXT_fn)(cl_command_queue command_queue, - cl_uint num_mem_objects, - const cl_mem * mem_objects, - cl_mem_migration_flags_ext flags, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event); - - -/********************************* -* cl_ext_cxx_for_opencl extension -*********************************/ -#define cl_ext_cxx_for_opencl 1 - -#define CL_DEVICE_CXX_FOR_OPENCL_NUMERIC_VERSION_EXT 0x4230 - -/********************************* -* cl_qcom_ext_host_ptr extension -*********************************/ -#define cl_qcom_ext_host_ptr 1 - -#define CL_MEM_EXT_HOST_PTR_QCOM (1 << 29) - -#define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM 0x40A0 -#define CL_DEVICE_PAGE_SIZE_QCOM 0x40A1 -#define CL_IMAGE_ROW_ALIGNMENT_QCOM 0x40A2 -#define CL_IMAGE_SLICE_ALIGNMENT_QCOM 0x40A3 -#define CL_MEM_HOST_UNCACHED_QCOM 0x40A4 -#define CL_MEM_HOST_WRITEBACK_QCOM 0x40A5 -#define CL_MEM_HOST_WRITETHROUGH_QCOM 0x40A6 -#define CL_MEM_HOST_WRITE_COMBINING_QCOM 0x40A7 - -typedef cl_uint cl_image_pitch_info_qcom; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetDeviceImageInfoQCOM(cl_device_id device, - size_t image_width, - size_t image_height, - const cl_image_format *image_format, - cl_image_pitch_info_qcom param_name, - size_t param_value_size, - void *param_value, - size_t *param_value_size_ret); - -typedef struct _cl_mem_ext_host_ptr -{ - /* Type of external memory allocation. */ - /* Legal values will be defined in layered extensions. */ - cl_uint allocation_type; - - /* Host cache policy for this external memory allocation. */ - cl_uint host_cache_policy; - -} cl_mem_ext_host_ptr; - - -/******************************************* -* cl_qcom_ext_host_ptr_iocoherent extension -********************************************/ - -/* Cache policy specifying io-coherence */ -#define CL_MEM_HOST_IOCOHERENT_QCOM 0x40A9 - - -/********************************* -* cl_qcom_ion_host_ptr extension -*********************************/ - -#define CL_MEM_ION_HOST_PTR_QCOM 0x40A8 - -typedef struct _cl_mem_ion_host_ptr -{ - /* Type of external memory allocation. */ - /* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */ - cl_mem_ext_host_ptr ext_host_ptr; - - /* ION file descriptor */ - int ion_filedesc; - - /* Host pointer to the ION allocated memory */ - void* ion_hostptr; - -} cl_mem_ion_host_ptr; - - -/********************************* -* cl_qcom_android_native_buffer_host_ptr extension -*********************************/ - -#define CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM 0x40C6 - -typedef struct _cl_mem_android_native_buffer_host_ptr -{ - /* Type of external memory allocation. */ - /* Must be CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM for Android native buffers. */ - cl_mem_ext_host_ptr ext_host_ptr; - - /* Virtual pointer to the android native buffer */ - void* anb_ptr; - -} cl_mem_android_native_buffer_host_ptr; - - -/****************************************** - * cl_img_yuv_image extension * - ******************************************/ - -/* Image formats used in clCreateImage */ -#define CL_NV21_IMG 0x40D0 -#define CL_YV12_IMG 0x40D1 - - -/****************************************** - * cl_img_cached_allocations extension * - ******************************************/ - -/* Flag values used by clCreateBuffer */ -#define CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG (1 << 26) -#define CL_MEM_USE_CACHED_CPU_MEMORY_IMG (1 << 27) - - -/****************************************** - * cl_img_use_gralloc_ptr extension * - ******************************************/ -#define cl_img_use_gralloc_ptr 1 - -/* Flag values used by clCreateBuffer */ -#define CL_MEM_USE_GRALLOC_PTR_IMG (1 << 28) - -/* To be used by clGetEventInfo: */ -#define CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG 0x40D2 -#define CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG 0x40D3 - -/* Error codes from clEnqueueAcquireGrallocObjectsIMG and clEnqueueReleaseGrallocObjectsIMG */ -#define CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG 0x40D4 -#define CL_INVALID_GRALLOC_OBJECT_IMG 0x40D5 - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueAcquireGrallocObjectsIMG(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_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueReleaseGrallocObjectsIMG(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_2; - -/****************************************** - * cl_img_generate_mipmap extension * - ******************************************/ -#define cl_img_generate_mipmap 1 - -typedef cl_uint cl_mipmap_filter_mode_img; - -/* To be used by clEnqueueGenerateMipmapIMG */ -#define CL_MIPMAP_FILTER_ANY_IMG 0x0 -#define CL_MIPMAP_FILTER_BOX_IMG 0x1 - -/* To be used by clGetEventInfo */ -#define CL_COMMAND_GENERATE_MIPMAP_IMG 0x40D6 - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueGenerateMipmapIMG(cl_command_queue command_queue, - cl_mem src_image, - cl_mem dst_image, - cl_mipmap_filter_mode_img mipmap_filter_mode, - const size_t *array_region, - const size_t *mip_region, - cl_uint num_events_in_wait_list, - const cl_event *event_wait_list, - cl_event *event) CL_API_SUFFIX__VERSION_1_2; - -/****************************************** - * cl_img_mem_properties extension * - ******************************************/ -#define cl_img_mem_properties 1 - -/* To be used by clCreateBufferWithProperties */ -#define CL_MEM_ALLOC_FLAGS_IMG 0x40D7 - -/* To be used wiith the CL_MEM_ALLOC_FLAGS_IMG property */ -typedef cl_bitfield cl_mem_alloc_flags_img; - -/* To be used with cl_mem_alloc_flags_img */ -#define CL_MEM_ALLOC_RELAX_REQUIREMENTS_IMG (1 << 0) - -/********************************* -* cl_khr_subgroups extension -*********************************/ -#define cl_khr_subgroups 1 - -#if !defined(CL_VERSION_2_1) -/* For OpenCL 2.1 and newer, cl_kernel_sub_group_info is declared in CL.h. - In hindsight, there should have been a khr suffix on this type for - the extension, but keeping it un-suffixed to maintain backwards - compatibility. */ -typedef cl_uint cl_kernel_sub_group_info; -#endif - -/* 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 - -extern 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) CL_API_SUFFIX__VERSION_2_0_DEPRECATED; - -typedef cl_int -(CL_API_CALL * clGetKernelSubGroupInfoKHR_fn)(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_DEPRECATED; - - -/********************************* -* cl_khr_mipmap_image extension -*********************************/ - -/* cl_sampler_properties */ -#define CL_SAMPLER_MIP_FILTER_MODE_KHR 0x1155 -#define CL_SAMPLER_LOD_MIN_KHR 0x1156 -#define CL_SAMPLER_LOD_MAX_KHR 0x1157 - - -/********************************* -* cl_khr_priority_hints extension -*********************************/ -/* This extension define is for backwards compatibility. - It shouldn't be required since this extension has no new functions. */ -#define cl_khr_priority_hints 1 - -typedef cl_uint cl_queue_priority_khr; - -/* cl_command_queue_properties */ -#define CL_QUEUE_PRIORITY_KHR 0x1096 - -/* cl_queue_priority_khr */ -#define CL_QUEUE_PRIORITY_HIGH_KHR (1<<0) -#define CL_QUEUE_PRIORITY_MED_KHR (1<<1) -#define CL_QUEUE_PRIORITY_LOW_KHR (1<<2) - - -/********************************* -* cl_khr_throttle_hints extension -*********************************/ -/* This extension define is for backwards compatibility. - It shouldn't be required since this extension has no new functions. */ -#define cl_khr_throttle_hints 1 - -typedef cl_uint cl_queue_throttle_khr; - -/* cl_command_queue_properties */ -#define CL_QUEUE_THROTTLE_KHR 0x1097 - -/* cl_queue_throttle_khr */ -#define CL_QUEUE_THROTTLE_HIGH_KHR (1<<0) -#define CL_QUEUE_THROTTLE_MED_KHR (1<<1) -#define CL_QUEUE_THROTTLE_LOW_KHR (1<<2) - - -/********************************* -* cl_khr_subgroup_named_barrier -*********************************/ -/* This extension define is for backwards compatibility. - It shouldn't be required since this extension has no new functions. */ -#define cl_khr_subgroup_named_barrier 1 - -/* cl_device_info */ -#define CL_DEVICE_MAX_NAMED_BARRIER_COUNT_KHR 0x2035 - - -/********************************* -* cl_khr_extended_versioning -*********************************/ - -#define cl_khr_extended_versioning 1 - -#define CL_VERSION_MAJOR_BITS_KHR (10) -#define CL_VERSION_MINOR_BITS_KHR (10) -#define CL_VERSION_PATCH_BITS_KHR (12) - -#define CL_VERSION_MAJOR_MASK_KHR ((1 << CL_VERSION_MAJOR_BITS_KHR) - 1) -#define CL_VERSION_MINOR_MASK_KHR ((1 << CL_VERSION_MINOR_BITS_KHR) - 1) -#define CL_VERSION_PATCH_MASK_KHR ((1 << CL_VERSION_PATCH_BITS_KHR) - 1) - -#define CL_VERSION_MAJOR_KHR(version) ((version) >> (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR)) -#define CL_VERSION_MINOR_KHR(version) (((version) >> CL_VERSION_PATCH_BITS_KHR) & CL_VERSION_MINOR_MASK_KHR) -#define CL_VERSION_PATCH_KHR(version) ((version) & CL_VERSION_PATCH_MASK_KHR) - -#define CL_MAKE_VERSION_KHR(major, minor, patch) \ - ((((major) & CL_VERSION_MAJOR_MASK_KHR) << (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR)) | \ - (((minor) & CL_VERSION_MINOR_MASK_KHR) << CL_VERSION_PATCH_BITS_KHR) | \ - ((patch) & CL_VERSION_PATCH_MASK_KHR)) - -typedef cl_uint cl_version_khr; - -#define CL_NAME_VERSION_MAX_NAME_SIZE_KHR 64 - -typedef struct _cl_name_version_khr -{ - cl_version_khr version; - char name[CL_NAME_VERSION_MAX_NAME_SIZE_KHR]; -} cl_name_version_khr; - -/* cl_platform_info */ -#define CL_PLATFORM_NUMERIC_VERSION_KHR 0x0906 -#define CL_PLATFORM_EXTENSIONS_WITH_VERSION_KHR 0x0907 - -/* cl_device_info */ -#define CL_DEVICE_NUMERIC_VERSION_KHR 0x105E -#define CL_DEVICE_OPENCL_C_NUMERIC_VERSION_KHR 0x105F -#define CL_DEVICE_EXTENSIONS_WITH_VERSION_KHR 0x1060 -#define CL_DEVICE_ILS_WITH_VERSION_KHR 0x1061 -#define CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION_KHR 0x1062 - - -/********************************* -* cl_khr_device_uuid extension -*********************************/ -#define cl_khr_device_uuid 1 - -#define CL_UUID_SIZE_KHR 16 -#define CL_LUID_SIZE_KHR 8 - -#define CL_DEVICE_UUID_KHR 0x106A -#define CL_DRIVER_UUID_KHR 0x106B -#define CL_DEVICE_LUID_VALID_KHR 0x106C -#define CL_DEVICE_LUID_KHR 0x106D -#define CL_DEVICE_NODE_MASK_KHR 0x106E - - -/*************************************************************** -* cl_khr_pci_bus_info -***************************************************************/ -#define cl_khr_pci_bus_info 1 - -typedef struct _cl_device_pci_bus_info_khr { - cl_uint pci_domain; - cl_uint pci_bus; - cl_uint pci_device; - cl_uint pci_function; -} cl_device_pci_bus_info_khr; - -/* cl_device_info */ -#define CL_DEVICE_PCI_BUS_INFO_KHR 0x410F - - -/*************************************************************** -* cl_khr_suggested_local_work_size -***************************************************************/ -#define cl_khr_suggested_local_work_size 1 - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetKernelSuggestedLocalWorkSizeKHR( - cl_command_queue command_queue, - cl_kernel kernel, - cl_uint work_dim, - const size_t* global_work_offset, - const size_t* global_work_size, - size_t* suggested_local_work_size) CL_API_SUFFIX__VERSION_3_0; - -typedef cl_int (CL_API_CALL * -clGetKernelSuggestedLocalWorkSizeKHR_fn)( - cl_command_queue command_queue, - cl_kernel kernel, - cl_uint work_dim, - const size_t* global_work_offset, - const size_t* global_work_size, - size_t* suggested_local_work_size) CL_API_SUFFIX__VERSION_3_0; - - -/*************************************************************** -* cl_khr_integer_dot_product -***************************************************************/ -#define cl_khr_integer_dot_product 1 - -typedef cl_bitfield cl_device_integer_dot_product_capabilities_khr; - -/* cl_device_integer_dot_product_capabilities_khr */ -#define CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED_KHR (1 << 0) -#define CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_KHR (1 << 1) - -/* cl_device_info */ -#define CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIES_KHR 0x1073 - - -/********************************** - * cl_arm_import_memory extension * - **********************************/ -#define cl_arm_import_memory 1 - -typedef intptr_t cl_import_properties_arm; - -/* Default and valid proporties name for cl_arm_import_memory */ -#define CL_IMPORT_TYPE_ARM 0x40B2 - -/* Host process memory type default value for CL_IMPORT_TYPE_ARM property */ -#define CL_IMPORT_TYPE_HOST_ARM 0x40B3 - -/* DMA BUF memory type value for CL_IMPORT_TYPE_ARM property */ -#define CL_IMPORT_TYPE_DMA_BUF_ARM 0x40B4 - -/* Protected memory property */ -#define CL_IMPORT_TYPE_PROTECTED_ARM 0x40B5 - -/* Android hardware buffer type value for CL_IMPORT_TYPE_ARM property */ -#define CL_IMPORT_TYPE_ANDROID_HARDWARE_BUFFER_ARM 0x41E2 - -/* Data consistency with host property */ -#define CL_IMPORT_DMA_BUF_DATA_CONSISTENCY_WITH_HOST_ARM 0x41E3 - -/* Index of plane in a multiplanar hardware buffer */ -#define CL_IMPORT_ANDROID_HARDWARE_BUFFER_PLANE_INDEX_ARM 0x41EF - -/* Index of layer in a multilayer hardware buffer */ -#define CL_IMPORT_ANDROID_HARDWARE_BUFFER_LAYER_INDEX_ARM 0x41F0 - -/* Import memory size value to indicate a size for the whole buffer */ -#define CL_IMPORT_MEMORY_WHOLE_ALLOCATION_ARM SIZE_MAX - -/* This extension adds a new function that allows for direct memory import into - * OpenCL via the clImportMemoryARM function. - * - * Memory imported through this interface will be mapped into the device's page - * tables directly, providing zero copy access. It will never fall back to copy - * operations and aliased buffers. - * - * Types of memory supported for import are specified as additional extension - * strings. - * - * This extension produces cl_mem allocations which are compatible with all other - * users of cl_mem in the standard API. - * - * This extension maps pages with the same properties as the normal buffer creation - * function clCreateBuffer. - */ -extern CL_API_ENTRY cl_mem CL_API_CALL -clImportMemoryARM( cl_context context, - cl_mem_flags flags, - const cl_import_properties_arm *properties, - void *memory, - size_t size, - cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - - -/****************************************** - * cl_arm_shared_virtual_memory extension * - ******************************************/ -#define cl_arm_shared_virtual_memory 1 - -/* Used by clGetDeviceInfo */ -#define CL_DEVICE_SVM_CAPABILITIES_ARM 0x40B6 - -/* Used by clGetMemObjectInfo */ -#define CL_MEM_USES_SVM_POINTER_ARM 0x40B7 - -/* Used by clSetKernelExecInfoARM: */ -#define CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM 0x40B8 -#define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM 0x40B9 - -/* To be used by clGetEventInfo: */ -#define CL_COMMAND_SVM_FREE_ARM 0x40BA -#define CL_COMMAND_SVM_MEMCPY_ARM 0x40BB -#define CL_COMMAND_SVM_MEMFILL_ARM 0x40BC -#define CL_COMMAND_SVM_MAP_ARM 0x40BD -#define CL_COMMAND_SVM_UNMAP_ARM 0x40BE - -/* Flag values returned by clGetDeviceInfo with CL_DEVICE_SVM_CAPABILITIES_ARM as the param_name. */ -#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM (1 << 0) -#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM (1 << 1) -#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM (1 << 2) -#define CL_DEVICE_SVM_ATOMICS_ARM (1 << 3) - -/* Flag values used by clSVMAllocARM: */ -#define CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM (1 << 10) -#define CL_MEM_SVM_ATOMICS_ARM (1 << 11) - -typedef cl_bitfield cl_svm_mem_flags_arm; -typedef cl_uint cl_kernel_exec_info_arm; -typedef cl_bitfield cl_device_svm_capabilities_arm; - -extern CL_API_ENTRY void * CL_API_CALL -clSVMAllocARM(cl_context context, - cl_svm_mem_flags_arm flags, - size_t size, - cl_uint alignment) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY void CL_API_CALL -clSVMFreeARM(cl_context context, - void * svm_pointer) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueSVMFreeARM(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_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueSVMMemcpyARM(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_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueSVMMemFillARM(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_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueSVMMapARM(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_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueSVMUnmapARM(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_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clSetKernelArgSVMPointerARM(cl_kernel kernel, - cl_uint arg_index, - const void * arg_value) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clSetKernelExecInfoARM(cl_kernel kernel, - cl_kernel_exec_info_arm param_name, - size_t param_value_size, - const void * param_value) CL_API_SUFFIX__VERSION_1_2; - -/******************************** - * cl_arm_get_core_id extension * - ********************************/ - -#ifdef CL_VERSION_1_2 - -#define cl_arm_get_core_id 1 - -/* Device info property for bitfield of cores present */ -#define CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM 0x40BF - -#endif /* CL_VERSION_1_2 */ - -/********************************* -* cl_arm_job_slot_selection -*********************************/ - -#define cl_arm_job_slot_selection 1 - -/* cl_device_info */ -#define CL_DEVICE_JOB_SLOTS_ARM 0x41E0 - -/* cl_command_queue_properties */ -#define CL_QUEUE_JOB_SLOT_ARM 0x41E1 - -/********************************* -* cl_arm_scheduling_controls -*********************************/ - -#define cl_arm_scheduling_controls 1 - -typedef cl_bitfield cl_device_scheduling_controls_capabilities_arm; - -/* cl_device_info */ -#define CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM 0x41E4 - -#define CL_DEVICE_SCHEDULING_KERNEL_BATCHING_ARM (1 << 0) -#define CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_ARM (1 << 1) -#define CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_MODIFIER_ARM (1 << 2) -#define CL_DEVICE_SCHEDULING_DEFERRED_FLUSH_ARM (1 << 3) -#define CL_DEVICE_SCHEDULING_REGISTER_ALLOCATION_ARM (1 << 4) - -#define CL_DEVICE_SUPPORTED_REGISTER_ALLOCATIONS_ARM 0x41EB - -/* cl_kernel_info */ -#define CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_ARM 0x41E5 -#define CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_MODIFIER_ARM 0x41E6 - -/* cl_queue_properties */ -#define CL_QUEUE_KERNEL_BATCHING_ARM 0x41E7 -#define CL_QUEUE_DEFERRED_FLUSH_ARM 0x41EC - -/************************************** -* cl_arm_controlled_kernel_termination -***************************************/ - -#define cl_arm_controlled_kernel_termination 1 - -/* Error code to indicate kernel terminated with failure */ -#define CL_COMMAND_TERMINATED_ITSELF_WITH_FAILURE_ARM -1108 - -/* cl_device_info */ -#define CL_DEVICE_CONTROLLED_TERMINATION_CAPABILITIES_ARM 0x41EE - -/* Bit fields for controlled termination feature query */ -typedef cl_bitfield cl_device_controlled_termination_capabilities_arm; - -#define CL_DEVICE_CONTROLLED_TERMINATION_SUCCESS_ARM (1 << 0) -#define CL_DEVICE_CONTROLLED_TERMINATION_FAILURE_ARM (1 << 1) -#define CL_DEVICE_CONTROLLED_TERMINATION_QUERY_ARM (1 << 2) - -/* cl_event_info */ -#define CL_EVENT_COMMAND_TERMINATION_REASON_ARM 0x41ED - -/* Values returned for event termination reason query */ -typedef cl_uint cl_command_termination_reason_arm; - -#define CL_COMMAND_TERMINATION_COMPLETION_ARM 0 -#define CL_COMMAND_TERMINATION_CONTROLLED_SUCCESS_ARM 1 -#define CL_COMMAND_TERMINATION_CONTROLLED_FAILURE_ARM 2 -#define CL_COMMAND_TERMINATION_ERROR_ARM 3 - -/*************************************** -* cl_intel_thread_local_exec extension * -****************************************/ - -#define cl_intel_thread_local_exec 1 - -#define CL_QUEUE_THREAD_LOCAL_EXEC_ENABLE_INTEL (((cl_bitfield)1) << 31) - -/*********************************************** -* cl_intel_device_partition_by_names extension * -************************************************/ - -#define cl_intel_device_partition_by_names 1 - -#define CL_DEVICE_PARTITION_BY_NAMES_INTEL 0x4052 -#define CL_PARTITION_BY_NAMES_LIST_END_INTEL -1 - -/************************************************ -* cl_intel_accelerator extension * -* cl_intel_motion_estimation extension * -* cl_intel_advanced_motion_estimation extension * -*************************************************/ - -#define cl_intel_accelerator 1 -#define cl_intel_motion_estimation 1 -#define cl_intel_advanced_motion_estimation 1 - -typedef struct _cl_accelerator_intel* cl_accelerator_intel; -typedef cl_uint cl_accelerator_type_intel; -typedef cl_uint cl_accelerator_info_intel; - -typedef struct _cl_motion_estimation_desc_intel { - cl_uint mb_block_type; - cl_uint subpixel_mode; - cl_uint sad_adjust_mode; - cl_uint search_path_type; -} cl_motion_estimation_desc_intel; - -/* error codes */ -#define CL_INVALID_ACCELERATOR_INTEL -1094 -#define CL_INVALID_ACCELERATOR_TYPE_INTEL -1095 -#define CL_INVALID_ACCELERATOR_DESCRIPTOR_INTEL -1096 -#define CL_ACCELERATOR_TYPE_NOT_SUPPORTED_INTEL -1097 - -/* cl_accelerator_type_intel */ -#define CL_ACCELERATOR_TYPE_MOTION_ESTIMATION_INTEL 0x0 - -/* cl_accelerator_info_intel */ -#define CL_ACCELERATOR_DESCRIPTOR_INTEL 0x4090 -#define CL_ACCELERATOR_REFERENCE_COUNT_INTEL 0x4091 -#define CL_ACCELERATOR_CONTEXT_INTEL 0x4092 -#define CL_ACCELERATOR_TYPE_INTEL 0x4093 - -/* cl_motion_detect_desc_intel flags */ -#define CL_ME_MB_TYPE_16x16_INTEL 0x0 -#define CL_ME_MB_TYPE_8x8_INTEL 0x1 -#define CL_ME_MB_TYPE_4x4_INTEL 0x2 - -#define CL_ME_SUBPIXEL_MODE_INTEGER_INTEL 0x0 -#define CL_ME_SUBPIXEL_MODE_HPEL_INTEL 0x1 -#define CL_ME_SUBPIXEL_MODE_QPEL_INTEL 0x2 - -#define CL_ME_SAD_ADJUST_MODE_NONE_INTEL 0x0 -#define CL_ME_SAD_ADJUST_MODE_HAAR_INTEL 0x1 - -#define CL_ME_SEARCH_PATH_RADIUS_2_2_INTEL 0x0 -#define CL_ME_SEARCH_PATH_RADIUS_4_4_INTEL 0x1 -#define CL_ME_SEARCH_PATH_RADIUS_16_12_INTEL 0x5 - -#define CL_ME_SKIP_BLOCK_TYPE_16x16_INTEL 0x0 -#define CL_ME_CHROMA_INTRA_PREDICT_ENABLED_INTEL 0x1 -#define CL_ME_LUMA_INTRA_PREDICT_ENABLED_INTEL 0x2 -#define CL_ME_SKIP_BLOCK_TYPE_8x8_INTEL 0x4 - -#define CL_ME_FORWARD_INPUT_MODE_INTEL 0x1 -#define CL_ME_BACKWARD_INPUT_MODE_INTEL 0x2 -#define CL_ME_BIDIRECTION_INPUT_MODE_INTEL 0x3 - -#define CL_ME_BIDIR_WEIGHT_QUARTER_INTEL 16 -#define CL_ME_BIDIR_WEIGHT_THIRD_INTEL 21 -#define CL_ME_BIDIR_WEIGHT_HALF_INTEL 32 -#define CL_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL 43 -#define CL_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL 48 - -#define CL_ME_COST_PENALTY_NONE_INTEL 0x0 -#define CL_ME_COST_PENALTY_LOW_INTEL 0x1 -#define CL_ME_COST_PENALTY_NORMAL_INTEL 0x2 -#define CL_ME_COST_PENALTY_HIGH_INTEL 0x3 - -#define CL_ME_COST_PRECISION_QPEL_INTEL 0x0 -#define CL_ME_COST_PRECISION_HPEL_INTEL 0x1 -#define CL_ME_COST_PRECISION_PEL_INTEL 0x2 -#define CL_ME_COST_PRECISION_DPEL_INTEL 0x3 - -#define CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL 0x0 -#define CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1 -#define CL_ME_LUMA_PREDICTOR_MODE_DC_INTEL 0x2 -#define CL_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL 0x3 - -#define CL_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL 0x4 -#define CL_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL 0x4 -#define CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL 0x5 -#define CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL 0x6 -#define CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL 0x7 -#define CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL 0x8 - -#define CL_ME_CHROMA_PREDICTOR_MODE_DC_INTEL 0x0 -#define CL_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1 -#define CL_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL 0x2 -#define CL_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL 0x3 - -/* cl_device_info */ -#define CL_DEVICE_ME_VERSION_INTEL 0x407E - -#define CL_ME_VERSION_LEGACY_INTEL 0x0 -#define CL_ME_VERSION_ADVANCED_VER_1_INTEL 0x1 -#define CL_ME_VERSION_ADVANCED_VER_2_INTEL 0x2 - -extern CL_API_ENTRY cl_accelerator_intel CL_API_CALL -clCreateAcceleratorINTEL( - cl_context context, - cl_accelerator_type_intel accelerator_type, - size_t descriptor_size, - const void* descriptor, - cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_accelerator_intel (CL_API_CALL *clCreateAcceleratorINTEL_fn)( - cl_context context, - cl_accelerator_type_intel accelerator_type, - size_t descriptor_size, - const void* descriptor, - cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetAcceleratorInfoINTEL( - cl_accelerator_intel accelerator, - cl_accelerator_info_intel param_name, - size_t param_value_size, - void* param_value, - size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_int (CL_API_CALL *clGetAcceleratorInfoINTEL_fn)( - cl_accelerator_intel accelerator, - cl_accelerator_info_intel param_name, - size_t param_value_size, - void* param_value, - size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clRetainAcceleratorINTEL( - cl_accelerator_intel accelerator) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_int (CL_API_CALL *clRetainAcceleratorINTEL_fn)( - cl_accelerator_intel accelerator) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clReleaseAcceleratorINTEL( - cl_accelerator_intel accelerator) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_int (CL_API_CALL *clReleaseAcceleratorINTEL_fn)( - cl_accelerator_intel accelerator) CL_API_SUFFIX__VERSION_1_2; - -/****************************************** -* cl_intel_simultaneous_sharing extension * -*******************************************/ - -#define cl_intel_simultaneous_sharing 1 - -#define CL_DEVICE_SIMULTANEOUS_INTEROPS_INTEL 0x4104 -#define CL_DEVICE_NUM_SIMULTANEOUS_INTEROPS_INTEL 0x4105 - -/*********************************** -* cl_intel_egl_image_yuv extension * -************************************/ - -#define cl_intel_egl_image_yuv 1 - -#define CL_EGL_YUV_PLANE_INTEL 0x4107 - -/******************************** -* cl_intel_packed_yuv extension * -*********************************/ - -#define cl_intel_packed_yuv 1 - -#define CL_YUYV_INTEL 0x4076 -#define CL_UYVY_INTEL 0x4077 -#define CL_YVYU_INTEL 0x4078 -#define CL_VYUY_INTEL 0x4079 - -/******************************************** -* cl_intel_required_subgroup_size extension * -*********************************************/ - -#define cl_intel_required_subgroup_size 1 - -#define CL_DEVICE_SUB_GROUP_SIZES_INTEL 0x4108 -#define CL_KERNEL_SPILL_MEM_SIZE_INTEL 0x4109 -#define CL_KERNEL_COMPILE_SUB_GROUP_SIZE_INTEL 0x410A - -/**************************************** -* cl_intel_driver_diagnostics extension * -*****************************************/ - -#define cl_intel_driver_diagnostics 1 - -typedef cl_uint cl_diagnostics_verbose_level; - -#define CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL 0x4106 - -#define CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL ( 0xff ) -#define CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL ( 1 ) -#define CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL ( 1 << 1 ) -#define CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL ( 1 << 2 ) - -/******************************** -* cl_intel_planar_yuv extension * -*********************************/ - -#define CL_NV12_INTEL 0x410E - -#define CL_MEM_NO_ACCESS_INTEL ( 1 << 24 ) -#define CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL ( 1 << 25 ) - -#define CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL 0x417E -#define CL_DEVICE_PLANAR_YUV_MAX_HEIGHT_INTEL 0x417F - -/******************************************************* -* cl_intel_device_side_avc_motion_estimation extension * -********************************************************/ - -#define CL_DEVICE_AVC_ME_VERSION_INTEL 0x410B -#define CL_DEVICE_AVC_ME_SUPPORTS_TEXTURE_SAMPLER_USE_INTEL 0x410C -#define CL_DEVICE_AVC_ME_SUPPORTS_PREEMPTION_INTEL 0x410D - -#define CL_AVC_ME_VERSION_0_INTEL 0x0 /* No support. */ -#define CL_AVC_ME_VERSION_1_INTEL 0x1 /* First supported version. */ - -#define CL_AVC_ME_MAJOR_16x16_INTEL 0x0 -#define CL_AVC_ME_MAJOR_16x8_INTEL 0x1 -#define CL_AVC_ME_MAJOR_8x16_INTEL 0x2 -#define CL_AVC_ME_MAJOR_8x8_INTEL 0x3 - -#define CL_AVC_ME_MINOR_8x8_INTEL 0x0 -#define CL_AVC_ME_MINOR_8x4_INTEL 0x1 -#define CL_AVC_ME_MINOR_4x8_INTEL 0x2 -#define CL_AVC_ME_MINOR_4x4_INTEL 0x3 - -#define CL_AVC_ME_MAJOR_FORWARD_INTEL 0x0 -#define CL_AVC_ME_MAJOR_BACKWARD_INTEL 0x1 -#define CL_AVC_ME_MAJOR_BIDIRECTIONAL_INTEL 0x2 - -#define CL_AVC_ME_PARTITION_MASK_ALL_INTEL 0x0 -#define CL_AVC_ME_PARTITION_MASK_16x16_INTEL 0x7E -#define CL_AVC_ME_PARTITION_MASK_16x8_INTEL 0x7D -#define CL_AVC_ME_PARTITION_MASK_8x16_INTEL 0x7B -#define CL_AVC_ME_PARTITION_MASK_8x8_INTEL 0x77 -#define CL_AVC_ME_PARTITION_MASK_8x4_INTEL 0x6F -#define CL_AVC_ME_PARTITION_MASK_4x8_INTEL 0x5F -#define CL_AVC_ME_PARTITION_MASK_4x4_INTEL 0x3F - -#define CL_AVC_ME_SEARCH_WINDOW_EXHAUSTIVE_INTEL 0x0 -#define CL_AVC_ME_SEARCH_WINDOW_SMALL_INTEL 0x1 -#define CL_AVC_ME_SEARCH_WINDOW_TINY_INTEL 0x2 -#define CL_AVC_ME_SEARCH_WINDOW_EXTRA_TINY_INTEL 0x3 -#define CL_AVC_ME_SEARCH_WINDOW_DIAMOND_INTEL 0x4 -#define CL_AVC_ME_SEARCH_WINDOW_LARGE_DIAMOND_INTEL 0x5 -#define CL_AVC_ME_SEARCH_WINDOW_RESERVED0_INTEL 0x6 -#define CL_AVC_ME_SEARCH_WINDOW_RESERVED1_INTEL 0x7 -#define CL_AVC_ME_SEARCH_WINDOW_CUSTOM_INTEL 0x8 -#define CL_AVC_ME_SEARCH_WINDOW_16x12_RADIUS_INTEL 0x9 -#define CL_AVC_ME_SEARCH_WINDOW_4x4_RADIUS_INTEL 0x2 -#define CL_AVC_ME_SEARCH_WINDOW_2x2_RADIUS_INTEL 0xa - -#define CL_AVC_ME_SAD_ADJUST_MODE_NONE_INTEL 0x0 -#define CL_AVC_ME_SAD_ADJUST_MODE_HAAR_INTEL 0x2 - -#define CL_AVC_ME_SUBPIXEL_MODE_INTEGER_INTEL 0x0 -#define CL_AVC_ME_SUBPIXEL_MODE_HPEL_INTEL 0x1 -#define CL_AVC_ME_SUBPIXEL_MODE_QPEL_INTEL 0x3 - -#define CL_AVC_ME_COST_PRECISION_QPEL_INTEL 0x0 -#define CL_AVC_ME_COST_PRECISION_HPEL_INTEL 0x1 -#define CL_AVC_ME_COST_PRECISION_PEL_INTEL 0x2 -#define CL_AVC_ME_COST_PRECISION_DPEL_INTEL 0x3 - -#define CL_AVC_ME_BIDIR_WEIGHT_QUARTER_INTEL 0x10 -#define CL_AVC_ME_BIDIR_WEIGHT_THIRD_INTEL 0x15 -#define CL_AVC_ME_BIDIR_WEIGHT_HALF_INTEL 0x20 -#define CL_AVC_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL 0x2B -#define CL_AVC_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL 0x30 - -#define CL_AVC_ME_BORDER_REACHED_LEFT_INTEL 0x0 -#define CL_AVC_ME_BORDER_REACHED_RIGHT_INTEL 0x2 -#define CL_AVC_ME_BORDER_REACHED_TOP_INTEL 0x4 -#define CL_AVC_ME_BORDER_REACHED_BOTTOM_INTEL 0x8 - -#define CL_AVC_ME_SKIP_BLOCK_PARTITION_16x16_INTEL 0x0 -#define CL_AVC_ME_SKIP_BLOCK_PARTITION_8x8_INTEL 0x4000 - -#define CL_AVC_ME_SKIP_BLOCK_16x16_FORWARD_ENABLE_INTEL ( 0x1 << 24 ) -#define CL_AVC_ME_SKIP_BLOCK_16x16_BACKWARD_ENABLE_INTEL ( 0x2 << 24 ) -#define CL_AVC_ME_SKIP_BLOCK_16x16_DUAL_ENABLE_INTEL ( 0x3 << 24 ) -#define CL_AVC_ME_SKIP_BLOCK_8x8_FORWARD_ENABLE_INTEL ( 0x55 << 24 ) -#define CL_AVC_ME_SKIP_BLOCK_8x8_BACKWARD_ENABLE_INTEL ( 0xAA << 24 ) -#define CL_AVC_ME_SKIP_BLOCK_8x8_DUAL_ENABLE_INTEL ( 0xFF << 24 ) -#define CL_AVC_ME_SKIP_BLOCK_8x8_0_FORWARD_ENABLE_INTEL ( 0x1 << 24 ) -#define CL_AVC_ME_SKIP_BLOCK_8x8_0_BACKWARD_ENABLE_INTEL ( 0x2 << 24 ) -#define CL_AVC_ME_SKIP_BLOCK_8x8_1_FORWARD_ENABLE_INTEL ( 0x1 << 26 ) -#define CL_AVC_ME_SKIP_BLOCK_8x8_1_BACKWARD_ENABLE_INTEL ( 0x2 << 26 ) -#define CL_AVC_ME_SKIP_BLOCK_8x8_2_FORWARD_ENABLE_INTEL ( 0x1 << 28 ) -#define CL_AVC_ME_SKIP_BLOCK_8x8_2_BACKWARD_ENABLE_INTEL ( 0x2 << 28 ) -#define CL_AVC_ME_SKIP_BLOCK_8x8_3_FORWARD_ENABLE_INTEL ( 0x1 << 30 ) -#define CL_AVC_ME_SKIP_BLOCK_8x8_3_BACKWARD_ENABLE_INTEL ( 0x2 << 30 ) - -#define CL_AVC_ME_BLOCK_BASED_SKIP_4x4_INTEL 0x00 -#define CL_AVC_ME_BLOCK_BASED_SKIP_8x8_INTEL 0x80 - -#define CL_AVC_ME_INTRA_16x16_INTEL 0x0 -#define CL_AVC_ME_INTRA_8x8_INTEL 0x1 -#define CL_AVC_ME_INTRA_4x4_INTEL 0x2 - -#define CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_16x16_INTEL 0x6 -#define CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_8x8_INTEL 0x5 -#define CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_4x4_INTEL 0x3 - -#define CL_AVC_ME_INTRA_NEIGHBOR_LEFT_MASK_ENABLE_INTEL 0x60 -#define CL_AVC_ME_INTRA_NEIGHBOR_UPPER_MASK_ENABLE_INTEL 0x10 -#define CL_AVC_ME_INTRA_NEIGHBOR_UPPER_RIGHT_MASK_ENABLE_INTEL 0x8 -#define CL_AVC_ME_INTRA_NEIGHBOR_UPPER_LEFT_MASK_ENABLE_INTEL 0x4 - -#define CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL 0x0 -#define CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1 -#define CL_AVC_ME_LUMA_PREDICTOR_MODE_DC_INTEL 0x2 -#define CL_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL 0x3 -#define CL_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL 0x4 -#define CL_AVC_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL 0x4 -#define CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL 0x5 -#define CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL 0x6 -#define CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL 0x7 -#define CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL 0x8 -#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_DC_INTEL 0x0 -#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1 -#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL 0x2 -#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL 0x3 - -#define CL_AVC_ME_FRAME_FORWARD_INTEL 0x1 -#define CL_AVC_ME_FRAME_BACKWARD_INTEL 0x2 -#define CL_AVC_ME_FRAME_DUAL_INTEL 0x3 - -#define CL_AVC_ME_SLICE_TYPE_PRED_INTEL 0x0 -#define CL_AVC_ME_SLICE_TYPE_BPRED_INTEL 0x1 -#define CL_AVC_ME_SLICE_TYPE_INTRA_INTEL 0x2 - -#define CL_AVC_ME_INTERLACED_SCAN_TOP_FIELD_INTEL 0x0 -#define CL_AVC_ME_INTERLACED_SCAN_BOTTOM_FIELD_INTEL 0x1 - -/******************************************* -* cl_intel_unified_shared_memory extension * -********************************************/ - -/* These APIs are in sync with Revision Q of the cl_intel_unified_shared_memory spec! */ - -#define cl_intel_unified_shared_memory 1 - -/* cl_device_info */ -#define CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL 0x4190 -#define CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL 0x4191 -#define CL_DEVICE_SINGLE_DEVICE_SHARED_MEM_CAPABILITIES_INTEL 0x4192 -#define CL_DEVICE_CROSS_DEVICE_SHARED_MEM_CAPABILITIES_INTEL 0x4193 -#define CL_DEVICE_SHARED_SYSTEM_MEM_CAPABILITIES_INTEL 0x4194 - -typedef cl_bitfield cl_device_unified_shared_memory_capabilities_intel; - -/* cl_device_unified_shared_memory_capabilities_intel - bitfield */ -#define CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL (1 << 0) -#define CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL (1 << 1) -#define CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL (1 << 2) -#define CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL (1 << 3) - -typedef cl_properties cl_mem_properties_intel; - -/* cl_mem_properties_intel */ -#define CL_MEM_ALLOC_FLAGS_INTEL 0x4195 - -typedef cl_bitfield cl_mem_alloc_flags_intel; - -/* cl_mem_alloc_flags_intel - bitfield */ -#define CL_MEM_ALLOC_WRITE_COMBINED_INTEL (1 << 0) - -typedef cl_uint cl_mem_info_intel; - -/* cl_mem_alloc_info_intel */ -#define CL_MEM_ALLOC_TYPE_INTEL 0x419A -#define CL_MEM_ALLOC_BASE_PTR_INTEL 0x419B -#define CL_MEM_ALLOC_SIZE_INTEL 0x419C -#define CL_MEM_ALLOC_DEVICE_INTEL 0x419D -/* Enum values 0x419E-0x419F are reserved for future queries. */ - -typedef cl_uint cl_unified_shared_memory_type_intel; - -/* cl_unified_shared_memory_type_intel */ -#define CL_MEM_TYPE_UNKNOWN_INTEL 0x4196 -#define CL_MEM_TYPE_HOST_INTEL 0x4197 -#define CL_MEM_TYPE_DEVICE_INTEL 0x4198 -#define CL_MEM_TYPE_SHARED_INTEL 0x4199 - -typedef cl_uint cl_mem_advice_intel; - -/* cl_mem_advice_intel */ -/* Enum values 0x4208-0x420F are reserved for future memory advices. */ - -/* cl_kernel_exec_info */ -#define CL_KERNEL_EXEC_INFO_INDIRECT_HOST_ACCESS_INTEL 0x4200 -#define CL_KERNEL_EXEC_INFO_INDIRECT_DEVICE_ACCESS_INTEL 0x4201 -#define CL_KERNEL_EXEC_INFO_INDIRECT_SHARED_ACCESS_INTEL 0x4202 -#define CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL 0x4203 - -/* cl_command_type */ -#define CL_COMMAND_MEMFILL_INTEL 0x4204 -#define CL_COMMAND_MEMCPY_INTEL 0x4205 -#define CL_COMMAND_MIGRATEMEM_INTEL 0x4206 -#define CL_COMMAND_MEMADVISE_INTEL 0x4207 - -extern CL_API_ENTRY void* CL_API_CALL -clHostMemAllocINTEL( - cl_context context, - const cl_mem_properties_intel* properties, - size_t size, - cl_uint alignment, - cl_int* errcode_ret); - -typedef void* (CL_API_CALL * -clHostMemAllocINTEL_fn)( - cl_context context, - const cl_mem_properties_intel* properties, - size_t size, - cl_uint alignment, - cl_int* errcode_ret); - -extern CL_API_ENTRY void* CL_API_CALL -clDeviceMemAllocINTEL( - cl_context context, - cl_device_id device, - const cl_mem_properties_intel* properties, - size_t size, - cl_uint alignment, - cl_int* errcode_ret); - -typedef void* (CL_API_CALL * -clDeviceMemAllocINTEL_fn)( - cl_context context, - cl_device_id device, - const cl_mem_properties_intel* properties, - size_t size, - cl_uint alignment, - cl_int* errcode_ret); - -extern CL_API_ENTRY void* CL_API_CALL -clSharedMemAllocINTEL( - cl_context context, - cl_device_id device, - const cl_mem_properties_intel* properties, - size_t size, - cl_uint alignment, - cl_int* errcode_ret); - -typedef void* (CL_API_CALL * -clSharedMemAllocINTEL_fn)( - cl_context context, - cl_device_id device, - const cl_mem_properties_intel* properties, - size_t size, - cl_uint alignment, - cl_int* errcode_ret); - -extern CL_API_ENTRY cl_int CL_API_CALL -clMemFreeINTEL( - cl_context context, - void* ptr); - -typedef cl_int (CL_API_CALL * -clMemFreeINTEL_fn)( - cl_context context, - void* ptr); - -extern CL_API_ENTRY cl_int CL_API_CALL -clMemBlockingFreeINTEL( - cl_context context, - void* ptr); - -typedef cl_int (CL_API_CALL * -clMemBlockingFreeINTEL_fn)( - cl_context context, - void* ptr); - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetMemAllocInfoINTEL( - cl_context context, - const void* ptr, - cl_mem_info_intel param_name, - size_t param_value_size, - void* param_value, - size_t* param_value_size_ret); - -typedef cl_int (CL_API_CALL * -clGetMemAllocInfoINTEL_fn)( - cl_context context, - const void* ptr, - cl_mem_info_intel param_name, - size_t param_value_size, - void* param_value, - size_t* param_value_size_ret); - -extern CL_API_ENTRY cl_int CL_API_CALL -clSetKernelArgMemPointerINTEL( - cl_kernel kernel, - cl_uint arg_index, - const void* arg_value); - -typedef cl_int (CL_API_CALL * -clSetKernelArgMemPointerINTEL_fn)( - cl_kernel kernel, - cl_uint arg_index, - const void* arg_value); - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueMemsetINTEL( /* Deprecated */ - cl_command_queue command_queue, - void* dst_ptr, - cl_int value, - size_t size, - cl_uint num_events_in_wait_list, - const cl_event* event_wait_list, - cl_event* event); - -typedef cl_int (CL_API_CALL * -clEnqueueMemsetINTEL_fn)( /* Deprecated */ - cl_command_queue command_queue, - void* dst_ptr, - cl_int value, - size_t size, - cl_uint num_events_in_wait_list, - const cl_event* event_wait_list, - cl_event* event); - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueMemFillINTEL( - cl_command_queue command_queue, - void* dst_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); - -typedef cl_int (CL_API_CALL * -clEnqueueMemFillINTEL_fn)( - cl_command_queue command_queue, - void* dst_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); - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueMemcpyINTEL( - cl_command_queue command_queue, - cl_bool blocking, - 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); - -typedef cl_int (CL_API_CALL * -clEnqueueMemcpyINTEL_fn)( - cl_command_queue command_queue, - cl_bool blocking, - 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); - -#ifdef CL_VERSION_1_2 - -/* Because these APIs use cl_mem_migration_flags, they require - OpenCL 1.2: */ - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueMigrateMemINTEL( - cl_command_queue command_queue, - const void* ptr, - size_t size, - cl_mem_migration_flags flags, - cl_uint num_events_in_wait_list, - const cl_event* event_wait_list, - cl_event* event); - -typedef cl_int (CL_API_CALL * -clEnqueueMigrateMemINTEL_fn)( - cl_command_queue command_queue, - const void* ptr, - size_t size, - cl_mem_migration_flags flags, - cl_uint num_events_in_wait_list, - const cl_event* event_wait_list, - cl_event* event); - -#endif - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueMemAdviseINTEL( - cl_command_queue command_queue, - const void* ptr, - size_t size, - cl_mem_advice_intel advice, - cl_uint num_events_in_wait_list, - const cl_event* event_wait_list, - cl_event* event); - -typedef cl_int (CL_API_CALL * -clEnqueueMemAdviseINTEL_fn)( - cl_command_queue command_queue, - const void* ptr, - size_t size, - cl_mem_advice_intel advice, - cl_uint num_events_in_wait_list, - const cl_event* event_wait_list, - cl_event* event); - -/*************************************************** -* cl_intel_create_buffer_with_properties extension * -****************************************************/ - -#define cl_intel_create_buffer_with_properties 1 - -extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateBufferWithPropertiesINTEL( - cl_context context, - const cl_mem_properties_intel* properties, - cl_mem_flags flags, - size_t size, - void * host_ptr, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_mem (CL_API_CALL * -clCreateBufferWithPropertiesINTEL_fn)( - cl_context context, - const cl_mem_properties_intel* properties, - cl_mem_flags flags, - size_t size, - void * host_ptr, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -/****************************************** -* cl_intel_mem_channel_property extension * -*******************************************/ - -#define CL_MEM_CHANNEL_INTEL 0x4213 - -/********************************* -* cl_intel_mem_force_host_memory * -**********************************/ - -#define cl_intel_mem_force_host_memory 1 - -/* cl_mem_flags */ -#define CL_MEM_FORCE_HOST_MEMORY_INTEL (1 << 20) - -/*************************************************************** -* cl_intel_command_queue_families -***************************************************************/ -#define cl_intel_command_queue_families 1 - -typedef cl_bitfield cl_command_queue_capabilities_intel; - -#define CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL 64 - -typedef struct _cl_queue_family_properties_intel { - cl_command_queue_properties properties; - cl_command_queue_capabilities_intel capabilities; - cl_uint count; - char name[CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL]; -} cl_queue_family_properties_intel; - -/* cl_device_info */ -#define CL_DEVICE_QUEUE_FAMILY_PROPERTIES_INTEL 0x418B - -/* cl_queue_properties */ -#define CL_QUEUE_FAMILY_INTEL 0x418C -#define CL_QUEUE_INDEX_INTEL 0x418D - -/* cl_command_queue_capabilities_intel */ -#define CL_QUEUE_DEFAULT_CAPABILITIES_INTEL 0 -#define CL_QUEUE_CAPABILITY_CREATE_SINGLE_QUEUE_EVENTS_INTEL (1 << 0) -#define CL_QUEUE_CAPABILITY_CREATE_CROSS_QUEUE_EVENTS_INTEL (1 << 1) -#define CL_QUEUE_CAPABILITY_SINGLE_QUEUE_EVENT_WAIT_LIST_INTEL (1 << 2) -#define CL_QUEUE_CAPABILITY_CROSS_QUEUE_EVENT_WAIT_LIST_INTEL (1 << 3) -#define CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_INTEL (1 << 8) -#define CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_RECT_INTEL (1 << 9) -#define CL_QUEUE_CAPABILITY_MAP_BUFFER_INTEL (1 << 10) -#define CL_QUEUE_CAPABILITY_FILL_BUFFER_INTEL (1 << 11) -#define CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_INTEL (1 << 12) -#define CL_QUEUE_CAPABILITY_MAP_IMAGE_INTEL (1 << 13) -#define CL_QUEUE_CAPABILITY_FILL_IMAGE_INTEL (1 << 14) -#define CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_IMAGE_INTEL (1 << 15) -#define CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_BUFFER_INTEL (1 << 16) -#define CL_QUEUE_CAPABILITY_MARKER_INTEL (1 << 24) -#define CL_QUEUE_CAPABILITY_BARRIER_INTEL (1 << 25) -#define CL_QUEUE_CAPABILITY_KERNEL_INTEL (1 << 26) - -#ifdef __cplusplus -} -#endif - - -#endif /* __CL_EXT_H */ diff --git a/lib/opencl_3.0.0/CL/cl_gl.h b/lib/opencl_3.0.0/CL/cl_gl.h deleted file mode 100644 index 5ea0fd8b7f4..00000000000 --- a/lib/opencl_3.0.0/CL/cl_gl.h +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * 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_GL_H -#define __OPENCL_CL_GL_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef cl_uint cl_gl_object_type; -typedef cl_uint cl_gl_texture_info; -typedef cl_uint cl_gl_platform_info; -typedef struct __GLsync *cl_GLsync; - -/* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken */ -#define CL_GL_OBJECT_BUFFER 0x2000 -#define CL_GL_OBJECT_TEXTURE2D 0x2001 -#define CL_GL_OBJECT_TEXTURE3D 0x2002 -#define CL_GL_OBJECT_RENDERBUFFER 0x2003 -#ifdef CL_VERSION_1_2 -#define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E -#define CL_GL_OBJECT_TEXTURE1D 0x200F -#define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010 -#define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011 -#endif - -/* cl_gl_texture_info */ -#define CL_GL_TEXTURE_TARGET 0x2004 -#define CL_GL_MIPMAP_LEVEL 0x2005 -#ifdef CL_VERSION_1_2 -#define CL_GL_NUM_SAMPLES 0x2012 -#endif - - -extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateFromGLBuffer(cl_context context, - cl_mem_flags flags, - cl_GLuint bufobj, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -#ifdef CL_VERSION_1_2 - -extern 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) CL_API_SUFFIX__VERSION_1_2; - -#endif - -extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateFromGLRenderbuffer(cl_context context, - cl_mem_flags flags, - cl_GLuint renderbuffer, - cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetGLObjectInfo(cl_mem memobj, - cl_gl_object_type * gl_object_type, - cl_GLuint * gl_object_name) CL_API_SUFFIX__VERSION_1_0; - -extern 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) CL_API_SUFFIX__VERSION_1_0; - -extern 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) CL_API_SUFFIX__VERSION_1_0; - -extern 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) CL_API_SUFFIX__VERSION_1_0; - - -/* Deprecated OpenCL 1.1 APIs */ -extern 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) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -extern 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) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; - -/* cl_khr_gl_sharing extension */ - -#define cl_khr_gl_sharing 1 - -typedef cl_uint cl_gl_context_info; - -/* Additional Error Codes */ -#define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000 - -/* cl_gl_context_info */ -#define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006 -#define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007 - -/* Additional cl_context_properties */ -#define CL_GL_CONTEXT_KHR 0x2008 -#define CL_EGL_DISPLAY_KHR 0x2009 -#define CL_GLX_DISPLAY_KHR 0x200A -#define CL_WGL_HDC_KHR 0x200B -#define CL_CGL_SHAREGROUP_KHR 0x200C - -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; - -typedef cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)( - 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 extension - */ -#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D - -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; - -#ifdef __cplusplus -} -#endif - -#endif /* __OPENCL_CL_GL_H */ diff --git a/lib/opencl_3.0.0/CL/cl_icd.h b/lib/opencl_3.0.0/CL/cl_icd.h deleted file mode 100644 index d5ac1de0990..00000000000 --- a/lib/opencl_3.0.0/CL/cl_icd.h +++ /dev/null @@ -1,1294 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019-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_ICD_H -#define OPENCL_CL_ICD_H - -#include -#include -#include -#include - -#if defined(_WIN32) -#include -#include -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This file contains pointer type definitions for each of the CL API calls as - * well as a type definition for the dispatch table used by the Khronos ICD - * loader (see cl_khr_icd extension specification for background). - */ - -/* 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; - -#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, - 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 */ - -typedef cl_int(CL_API_CALL *cl_api_clGetDeviceIDsFromD3D10KHR)( - cl_platform_id platform, cl_d3d10_device_source_khr d3d_device_source, - void *d3d_object, cl_d3d10_device_set_khr d3d_device_set, - cl_uint num_entries, cl_device_id *devices, - cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_mem(CL_API_CALL *cl_api_clCreateFromD3D10BufferKHR)( - cl_context context, cl_mem_flags flags, ID3D10Buffer *resource, - cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_mem(CL_API_CALL *cl_api_clCreateFromD3D10Texture2DKHR)( - cl_context context, cl_mem_flags flags, ID3D10Texture2D *resource, - UINT subresource, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef cl_mem(CL_API_CALL *cl_api_clCreateFromD3D10Texture3DKHR)( - cl_context context, cl_mem_flags flags, ID3D10Texture3D *resource, - UINT subresource, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0; - -typedef -cl_int(CL_API_CALL *cl_api_clEnqueueAcquireD3D10ObjectsKHR)( - 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_clEnqueueReleaseD3D10ObjectsKHR)( - 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; - -extern CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDsFromD3D10KHR( - cl_platform_id platform, cl_d3d10_device_source_khr d3d_device_source, - void *d3d_object, cl_d3d10_device_set_khr d3d_device_set, - cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices); - -extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateFromD3D10BufferKHR(cl_context context, cl_mem_flags flags, - ID3D10Buffer *resource, cl_int *errcode_ret); - -extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D10Texture2DKHR( - cl_context context, cl_mem_flags flags, ID3D10Texture2D *resource, - UINT subresource, cl_int *errcode_ret); - -extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D10Texture3DKHR( - cl_context context, cl_mem_flags flags, ID3D10Texture3D *resource, - UINT subresource, cl_int *errcode_ret); - -extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireD3D10ObjectsKHR( - 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); - -extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseD3D10ObjectsKHR( - 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_d3d11_sharing */ -typedef cl_int(CL_API_CALL *cl_api_clGetDeviceIDsFromD3D11KHR)( - cl_platform_id platform, cl_d3d11_device_source_khr d3d_device_source, - void *d3d_object, cl_d3d11_device_set_khr d3d_device_set, - cl_uint num_entries, cl_device_id *devices, - cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_mem(CL_API_CALL *cl_api_clCreateFromD3D11BufferKHR)( - cl_context context, cl_mem_flags flags, ID3D11Buffer *resource, - cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_mem(CL_API_CALL *cl_api_clCreateFromD3D11Texture2DKHR)( - cl_context context, cl_mem_flags flags, ID3D11Texture2D *resource, - UINT subresource, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_mem(CL_API_CALL *cl_api_clCreateFromD3D11Texture3DKHR)( - cl_context context, cl_mem_flags flags, ID3D11Texture3D *resource, - UINT subresource, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -typedef -cl_int(CL_API_CALL *cl_api_clEnqueueAcquireD3D11ObjectsKHR)( - 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_2; - -typedef -cl_int(CL_API_CALL *cl_api_clEnqueueReleaseD3D11ObjectsKHR)( - 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_2; - -/* cl_khr_dx9_media_sharing */ -typedef -cl_int(CL_API_CALL *cl_api_clGetDeviceIDsFromDX9MediaAdapterKHR)( - cl_platform_id platform, cl_uint num_media_adapters, - cl_dx9_media_adapter_type_khr *media_adapters_type, void *media_adapters, - cl_dx9_media_adapter_set_khr media_adapter_set, cl_uint num_entries, - cl_device_id *devices, cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_mem(CL_API_CALL *cl_api_clCreateFromDX9MediaSurfaceKHR)( - cl_context context, cl_mem_flags flags, - cl_dx9_media_adapter_type_khr adapter_type, void *surface_info, - cl_uint plane, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -typedef -cl_int(CL_API_CALL *cl_api_clEnqueueAcquireDX9MediaSurfacesKHR)( - 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_2; - -typedef -cl_int(CL_API_CALL *cl_api_clEnqueueReleaseDX9MediaSurfacesKHR)( - 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_2; - -/* cl_khr_d3d11_sharing */ -extern CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDsFromD3D11KHR( - cl_platform_id platform, cl_d3d11_device_source_khr d3d_device_source, - void *d3d_object, cl_d3d11_device_set_khr d3d_device_set, - cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices); - -extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateFromD3D11BufferKHR(cl_context context, cl_mem_flags flags, - ID3D11Buffer *resource, cl_int *errcode_ret); - -extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D11Texture2DKHR( - cl_context context, cl_mem_flags flags, ID3D11Texture2D *resource, - UINT subresource, cl_int *errcode_ret); - -extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D11Texture3DKHR( - cl_context context, cl_mem_flags flags, ID3D11Texture3D *resource, - UINT subresource, cl_int *errcode_ret); - -extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireD3D11ObjectsKHR( - 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); - -extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseD3D11ObjectsKHR( - 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_dx9_media_sharing */ -extern CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDsFromDX9MediaAdapterKHR( - cl_platform_id platform, cl_uint num_media_adapters, - cl_dx9_media_adapter_type_khr *media_adapter_type, void *media_adapters, - cl_dx9_media_adapter_set_khr media_adapter_set, cl_uint num_entries, - cl_device_id *devices, cl_uint *num_devices); - -extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromDX9MediaSurfaceKHR( - cl_context context, cl_mem_flags flags, - cl_dx9_media_adapter_type_khr adapter_type, void *surface_info, - cl_uint plane, cl_int *errcode_ret); - -extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireDX9MediaSurfacesKHR( - 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); - -extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseDX9MediaSurfacesKHR( - 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); - -#else - -/* cl_khr_d3d10_sharing */ -typedef void *cl_api_clGetDeviceIDsFromD3D10KHR; -typedef void *cl_api_clCreateFromD3D10BufferKHR; -typedef void *cl_api_clCreateFromD3D10Texture2DKHR; -typedef void *cl_api_clCreateFromD3D10Texture3DKHR; -typedef void *cl_api_clEnqueueAcquireD3D10ObjectsKHR; -typedef void *cl_api_clEnqueueReleaseD3D10ObjectsKHR; - -/* cl_khr_d3d11_sharing */ -typedef void *cl_api_clGetDeviceIDsFromD3D11KHR; -typedef void *cl_api_clCreateFromD3D11BufferKHR; -typedef void *cl_api_clCreateFromD3D11Texture2DKHR; -typedef void *cl_api_clCreateFromD3D11Texture3DKHR; -typedef void *cl_api_clEnqueueAcquireD3D11ObjectsKHR; -typedef void *cl_api_clEnqueueReleaseD3D11ObjectsKHR; - -/* cl_khr_dx9_media_sharing */ -typedef void *cl_api_clCreateFromDX9MediaSurfaceKHR; -typedef void *cl_api_clEnqueueAcquireDX9MediaSurfacesKHR; -typedef void *cl_api_clEnqueueReleaseDX9MediaSurfacesKHR; -typedef void *cl_api_clGetDeviceIDsFromDX9MediaAdapterKHR; - -#endif - -/* 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, - 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); - -#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 { - /* 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; - - /* cl_khr_d3d10_sharing */ - cl_api_clGetDeviceIDsFromD3D10KHR clGetDeviceIDsFromD3D10KHR; - cl_api_clCreateFromD3D10BufferKHR clCreateFromD3D10BufferKHR; - cl_api_clCreateFromD3D10Texture2DKHR clCreateFromD3D10Texture2DKHR; - cl_api_clCreateFromD3D10Texture3DKHR clCreateFromD3D10Texture3DKHR; - cl_api_clEnqueueAcquireD3D10ObjectsKHR clEnqueueAcquireD3D10ObjectsKHR; - cl_api_clEnqueueReleaseD3D10ObjectsKHR clEnqueueReleaseD3D10ObjectsKHR; - - /* 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_d3d11_sharing */ - cl_api_clGetDeviceIDsFromD3D11KHR clGetDeviceIDsFromD3D11KHR; - cl_api_clCreateFromD3D11BufferKHR clCreateFromD3D11BufferKHR; - cl_api_clCreateFromD3D11Texture2DKHR clCreateFromD3D11Texture2DKHR; - cl_api_clCreateFromD3D11Texture3DKHR clCreateFromD3D11Texture3DKHR; - cl_api_clCreateFromDX9MediaSurfaceKHR clCreateFromDX9MediaSurfaceKHR; - cl_api_clEnqueueAcquireD3D11ObjectsKHR clEnqueueAcquireD3D11ObjectsKHR; - cl_api_clEnqueueReleaseD3D11ObjectsKHR clEnqueueReleaseD3D11ObjectsKHR; - - /* cl_khr_dx9_media_sharing */ - cl_api_clGetDeviceIDsFromDX9MediaAdapterKHR - clGetDeviceIDsFromDX9MediaAdapterKHR; - cl_api_clEnqueueAcquireDX9MediaSurfacesKHR - clEnqueueAcquireDX9MediaSurfacesKHR; - cl_api_clEnqueueReleaseDX9MediaSurfacesKHR - clEnqueueReleaseDX9MediaSurfacesKHR; - - /* 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; - -} cl_icd_dispatch; - -#ifdef __cplusplus -} -#endif - -#endif /* #ifndef OPENCL_CL_ICD_H */ diff --git a/lib/opencl_3.0.0/CL/cl_layer.h b/lib/opencl_3.0.0/CL/cl_layer.h deleted file mode 100644 index 59dae7506fd..00000000000 --- a/lib/opencl_3.0.0/CL/cl_layer.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 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. - * - * OpenCL is a trademark of Apple Inc. used under license by Khronos. - */ - -#ifndef OPENCL_CL_LAYER_H -#define OPENCL_CL_LAYER_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef cl_uint cl_layer_info; -typedef cl_uint cl_layer_api_version; -#define CL_LAYER_API_VERSION 0x4240 -#define CL_LAYER_API_VERSION_100 100 - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetLayerInfo(cl_layer_info param_name, - size_t param_value_size, - void *param_value, - size_t *param_value_size_ret); - -typedef cl_int -(CL_API_CALL *pfn_clGetLayerInfo)(cl_layer_info param_name, - size_t param_value_size, - void *param_value, - size_t *param_value_size_ret); - -extern CL_API_ENTRY cl_int CL_API_CALL -clInitLayer(cl_uint num_entries, - const cl_icd_dispatch *target_dispatch, - cl_uint *num_entries_ret, - const cl_icd_dispatch **layer_dispatch_ret); - -typedef cl_int -(CL_API_CALL *pfn_clInitLayer)(cl_uint num_entries, - const cl_icd_dispatch *target_dispatch, - cl_uint *num_entries_ret, - const cl_icd_dispatch **layer_dispatch_ret); - -#ifdef __cplusplus -} -#endif - -#endif /* OPENCL_CL_LAYER_H */ diff --git a/lib/opencl_3.0.0/CL/cl_va_api_media_sharing_intel.h b/lib/opencl_3.0.0/CL/cl_va_api_media_sharing_intel.h deleted file mode 100644 index 7ba2ec83d1d..00000000000 --- a/lib/opencl_3.0.0/CL/cl_va_api_media_sharing_intel.h +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * 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_VA_API_MEDIA_SHARING_INTEL_H -#define __OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/****************************************** -* cl_intel_va_api_media_sharing extension * -*******************************************/ - -#define cl_intel_va_api_media_sharing 1 - -/* error codes */ -#define CL_INVALID_VA_API_MEDIA_ADAPTER_INTEL -1098 -#define CL_INVALID_VA_API_MEDIA_SURFACE_INTEL -1099 -#define CL_VA_API_MEDIA_SURFACE_ALREADY_ACQUIRED_INTEL -1100 -#define CL_VA_API_MEDIA_SURFACE_NOT_ACQUIRED_INTEL -1101 - -/* cl_va_api_device_source_intel */ -#define CL_VA_API_DISPLAY_INTEL 0x4094 - -/* cl_va_api_device_set_intel */ -#define CL_PREFERRED_DEVICES_FOR_VA_API_INTEL 0x4095 -#define CL_ALL_DEVICES_FOR_VA_API_INTEL 0x4096 - -/* cl_context_info */ -#define CL_CONTEXT_VA_API_DISPLAY_INTEL 0x4097 - -/* cl_mem_info */ -#define CL_MEM_VA_API_MEDIA_SURFACE_INTEL 0x4098 - -/* cl_image_info */ -#define CL_IMAGE_VA_API_PLANE_INTEL 0x4099 - -/* cl_command_type */ -#define CL_COMMAND_ACQUIRE_VA_API_MEDIA_SURFACES_INTEL 0x409A -#define CL_COMMAND_RELEASE_VA_API_MEDIA_SURFACES_INTEL 0x409B - -typedef cl_uint cl_va_api_device_source_intel; -typedef cl_uint cl_va_api_device_set_intel; - -extern CL_API_ENTRY cl_int CL_API_CALL -clGetDeviceIDsFromVA_APIMediaAdapterINTEL( - cl_platform_id platform, - cl_va_api_device_source_intel media_adapter_type, - void* media_adapter, - cl_va_api_device_set_intel media_adapter_set, - cl_uint num_entries, - cl_device_id* devices, - cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_int (CL_API_CALL * clGetDeviceIDsFromVA_APIMediaAdapterINTEL_fn)( - cl_platform_id platform, - cl_va_api_device_source_intel media_adapter_type, - void* media_adapter, - cl_va_api_device_set_intel media_adapter_set, - cl_uint num_entries, - cl_device_id* devices, - cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateFromVA_APIMediaSurfaceINTEL( - cl_context context, - cl_mem_flags flags, - VASurfaceID* surface, - cl_uint plane, - cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -typedef cl_mem (CL_API_CALL * clCreateFromVA_APIMediaSurfaceINTEL_fn)( - cl_context context, - cl_mem_flags flags, - VASurfaceID* surface, - cl_uint plane, - cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueAcquireVA_APIMediaSurfacesINTEL( - 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_2; - -typedef cl_int (CL_API_CALL *clEnqueueAcquireVA_APIMediaSurfacesINTEL_fn)( - 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_2; - -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueReleaseVA_APIMediaSurfacesINTEL( - 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_2; - -typedef cl_int (CL_API_CALL *clEnqueueReleaseVA_APIMediaSurfacesINTEL_fn)( - 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_2; - -#ifdef __cplusplus -} -#endif - -#endif /* __OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H */ - diff --git a/lib/opencl_v2025.07.22/CL/STAN_CHANGES b/lib/opencl_v2025.07.22/CL/STAN_CHANGES new file mode 100644 index 00000000000..1d8e427f0fa --- /dev/null +++ b/lib/opencl_v2025.07.22/CL/STAN_CHANGES @@ -0,0 +1,4 @@ +Synchronized from KhronosGroup/OpenCL-Headers v2025.07.22 and +KhronosGroup/OpenCL-CLHPP v2025.07.22. + +No Stan-local edits are applied on top of those upstream files. diff --git a/lib/opencl_3.0.0/CL/cl.h b/lib/opencl_v2025.07.22/CL/cl.h similarity index 98% rename from lib/opencl_3.0.0/CL/cl.h rename to lib/opencl_v2025.07.22/CL/cl.h index 0018a0f420a..d557720194f 100644 --- a/lib/opencl_3.0.0/CL/cl.h +++ b/lib/opencl_v2025.07.22/CL/cl.h @@ -24,6 +24,12 @@ extern "C" { #endif +#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__ + /* Disable warning C4201: nonstandard extension used : nameless struct/union */ + #pragma warning( push ) + #pragma warning( disable : 4201 ) +#endif + /******************************************************************************/ typedef struct _cl_platform_id * cl_platform_id; @@ -112,9 +118,9 @@ typedef cl_uint cl_kernel_exec_info; typedef cl_bitfield cl_device_atomic_capabilities; typedef cl_bitfield cl_device_device_enqueue_capabilities; typedef cl_uint cl_khronos_vendor_id; -typedef cl_properties cl_mem_properties; -typedef cl_uint cl_version; +typedef cl_properties cl_mem_properties; #endif +typedef cl_uint cl_version; typedef struct _cl_image_format { cl_channel_order image_channel_order; @@ -133,32 +139,14 @@ typedef struct _cl_image_desc { size_t image_slice_pitch; cl_uint num_mip_levels; cl_uint num_samples; -#ifdef CL_VERSION_2_0 -#if defined(__GNUC__) - __extension__ /* Prevents warnings about anonymous union in -pedantic builds */ -#endif -#if defined(_MSC_VER) && !defined(__STDC__) -#pragma warning( push ) -#pragma warning( disable : 4201 ) /* Prevents warning about nameless struct/union in /W4 builds */ -#endif -#if defined(_MSC_VER) && defined(__STDC__) - /* Anonymous unions are not supported in /Za builds */ -#else - union { -#endif +#if defined(CL_VERSION_2_0) && __CL_HAS_ANON_STRUCT__ + __CL_ANON_STRUCT__ union { #endif cl_mem buffer; -#ifdef CL_VERSION_2_0 -#if defined(_MSC_VER) && defined(__STDC__) - /* Anonymous unions are not supported in /Za builds */ -#else +#if defined(CL_VERSION_2_0) && __CL_HAS_ANON_STRUCT__ cl_mem mem_object; }; #endif -#if defined(_MSC_VER) && !defined(__STDC__) -#pragma warning( pop ) -#endif -#endif } cl_image_desc; #endif @@ -562,11 +550,8 @@ typedef struct _cl_name_version { #define CL_RGx 0x10BB #define CL_RGBx 0x10BC #endif -#ifdef CL_VERSION_1_2 -#define CL_DEPTH 0x10BD -#define CL_DEPTH_STENCIL 0x10BE -#endif #ifdef CL_VERSION_2_0 +#define CL_DEPTH 0x10BD #define CL_sRGB 0x10BF #define CL_sRGBx 0x10C0 #define CL_sRGBA 0x10C1 @@ -590,9 +575,6 @@ typedef struct _cl_name_version { #define CL_UNSIGNED_INT32 0x10DC #define CL_HALF_FLOAT 0x10DD #define CL_FLOAT 0x10DE -#ifdef CL_VERSION_1_2 -#define CL_UNORM_INT24 0x10DF -#endif #ifdef CL_VERSION_2_1 #define CL_UNORM_INT_101010_2 0x10E0 #endif @@ -913,8 +895,6 @@ typedef struct _cl_name_version { /* cl_khronos_vendor_id */ #define CL_KHRONOS_VENDOR_ID_CODEPLAY 0x10004 -#ifdef CL_VERSION_3_0 - /* cl_version */ #define CL_VERSION_MAJOR_BITS (10) #define CL_VERSION_MINOR_BITS (10) @@ -938,9 +918,14 @@ typedef struct _cl_name_version { (((minor) & CL_VERSION_MINOR_MASK) << CL_VERSION_PATCH_BITS) | \ ((patch) & CL_VERSION_PATCH_MASK)) +/********************************************************************************************************/ + +/* CL_NO_PROTOTYPES implies CL_NO_CORE_PROTOTYPES: */ +#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_CORE_PROTOTYPES) +#define CL_NO_CORE_PROTOTYPES #endif -/********************************************************************************************************/ +#if !defined(CL_NO_CORE_PROTOTYPES) /* Platform API */ extern CL_API_ENTRY cl_int CL_API_CALL @@ -1922,8 +1907,14 @@ clEnqueueTask(cl_command_queue command_queue, const cl_event * event_wait_list, cl_event * event) CL_API_SUFFIX__VERSION_1_2_DEPRECATED; +#endif /* !defined(CL_NO_CORE_PROTOTYPES) */ + #ifdef __cplusplus } #endif +#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__ + #pragma warning( pop ) +#endif + #endif /* __OPENCL_CL_H */ diff --git a/lib/opencl_3.0.0/CL/cl2.hpp b/lib/opencl_v2025.07.22/CL/cl2.hpp similarity index 100% rename from lib/opencl_3.0.0/CL/cl2.hpp rename to lib/opencl_v2025.07.22/CL/cl2.hpp diff --git a/lib/opencl_v2025.07.22/CL/cl_d3d10.h b/lib/opencl_v2025.07.22/CL/cl_d3d10.h new file mode 100644 index 00000000000..6b56c775bf8 --- /dev/null +++ b/lib/opencl_v2025.07.22/CL/cl_d3d10.h @@ -0,0 +1,268 @@ +/******************************************************************************* + * Copyright (c) 2008-2023 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_D3D10_H_ +#define OPENCL_CL_D3D10_H_ + +/* +** This header is generated from the Khronos OpenCL XML API Registry. +*/ + +#if defined(_MSC_VER) +#if _MSC_VER >=1500 +#pragma warning( push ) +#pragma warning( disable : 4201 ) +#pragma warning( disable : 5105 ) +#endif +#endif +#include +#if defined(_MSC_VER) +#if _MSC_VER >=1500 +#pragma warning( pop ) +#endif +#endif + +#include + +/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES) +#define CL_NO_EXTENSION_PROTOTYPES +#endif + +/* CL_NO_EXTENSION_PROTOTYPES implies + CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and + CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************** +* cl_khr_d3d10_sharing +***************************************************************/ +#define cl_khr_d3d10_sharing 1 +#define CL_KHR_D3D10_SHARING_EXTENSION_NAME \ + "cl_khr_d3d10_sharing" + + +#define CL_KHR_D3D10_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef cl_uint cl_d3d10_device_source_khr; +typedef cl_uint cl_d3d10_device_set_khr; + +/* Error codes */ +#define CL_INVALID_D3D10_DEVICE_KHR -1002 +#define CL_INVALID_D3D10_RESOURCE_KHR -1003 +#define CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR -1004 +#define CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR -1005 + +/* cl_d3d10_device_source_khr */ +#define CL_D3D10_DEVICE_KHR 0x4010 +#define CL_D3D10_DXGI_ADAPTER_KHR 0x4011 + +/* cl_d3d10_device_set_khr */ +#define CL_PREFERRED_DEVICES_FOR_D3D10_KHR 0x4012 +#define CL_ALL_DEVICES_FOR_D3D10_KHR 0x4013 + +/* cl_context_info */ +#define CL_CONTEXT_D3D10_DEVICE_KHR 0x4014 +#define CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR 0x402C + +/* cl_mem_info */ +#define CL_MEM_D3D10_RESOURCE_KHR 0x4015 + +/* cl_image_info */ +#define CL_IMAGE_D3D10_SUBRESOURCE_KHR 0x4016 + +/* cl_command_type */ +#define CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR 0x4017 +#define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR 0x4018 + + +typedef cl_int CL_API_CALL +clGetDeviceIDsFromD3D10KHR_t( + cl_platform_id platform, + cl_d3d10_device_source_khr d3d_device_source, + void* d3d_object, + cl_d3d10_device_set_khr d3d_device_set, + cl_uint num_entries, + cl_device_id* devices, + cl_uint* num_devices); + +typedef clGetDeviceIDsFromD3D10KHR_t * +clGetDeviceIDsFromD3D10KHR_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_mem CL_API_CALL +clCreateFromD3D10BufferKHR_t( + cl_context context, + cl_mem_flags flags, + ID3D10Buffer* resource, + cl_int* errcode_ret); + +typedef clCreateFromD3D10BufferKHR_t * +clCreateFromD3D10BufferKHR_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_mem CL_API_CALL +clCreateFromD3D10Texture2DKHR_t( + cl_context context, + cl_mem_flags flags, + ID3D10Texture2D* resource, + UINT subresource, + cl_int* errcode_ret); + +typedef clCreateFromD3D10Texture2DKHR_t * +clCreateFromD3D10Texture2DKHR_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_mem CL_API_CALL +clCreateFromD3D10Texture3DKHR_t( + cl_context context, + cl_mem_flags flags, + ID3D10Texture3D* resource, + UINT subresource, + cl_int* errcode_ret); + +typedef clCreateFromD3D10Texture3DKHR_t * +clCreateFromD3D10Texture3DKHR_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL +clEnqueueAcquireD3D10ObjectsKHR_t( + 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 clEnqueueAcquireD3D10ObjectsKHR_t * +clEnqueueAcquireD3D10ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL +clEnqueueReleaseD3D10ObjectsKHR_t( + 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 clEnqueueReleaseD3D10ObjectsKHR_t * +clEnqueueReleaseD3D10ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0; + +#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetDeviceIDsFromD3D10KHR( + cl_platform_id platform, + cl_d3d10_device_source_khr d3d_device_source, + void* d3d_object, + cl_d3d10_device_set_khr d3d_device_set, + cl_uint num_entries, + cl_device_id* devices, + cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_0; + +extern CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromD3D10BufferKHR( + cl_context context, + cl_mem_flags flags, + ID3D10Buffer* resource, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +extern CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromD3D10Texture2DKHR( + cl_context context, + cl_mem_flags flags, + ID3D10Texture2D* resource, + UINT subresource, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +extern CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromD3D10Texture3DKHR( + cl_context context, + cl_mem_flags flags, + ID3D10Texture3D* resource, + UINT subresource, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueAcquireD3D10ObjectsKHR( + 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; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReleaseD3D10ObjectsKHR( + 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; + +#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_intel_sharing_format_query_d3d10 +***************************************************************/ +#define cl_intel_sharing_format_query_d3d10 1 +#define CL_INTEL_SHARING_FORMAT_QUERY_D3D10_EXTENSION_NAME \ + "cl_intel_sharing_format_query_d3d10" + + +#define CL_INTEL_SHARING_FORMAT_QUERY_D3D10_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* when cl_khr_d3d10_sharing is supported */ + +typedef cl_int CL_API_CALL +clGetSupportedD3D10TextureFormatsINTEL_t( + cl_context context, + cl_mem_flags flags, + cl_mem_object_type image_type, + cl_uint num_entries, + DXGI_FORMAT* d3d10_formats, + cl_uint* num_texture_formats); + +typedef clGetSupportedD3D10TextureFormatsINTEL_t * +clGetSupportedD3D10TextureFormatsINTEL_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetSupportedD3D10TextureFormatsINTEL( + cl_context context, + cl_mem_flags flags, + cl_mem_object_type image_type, + cl_uint num_entries, + DXGI_FORMAT* d3d10_formats, + cl_uint* num_texture_formats) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_CL_D3D10_H_ */ diff --git a/lib/opencl_v2025.07.22/CL/cl_d3d11.h b/lib/opencl_v2025.07.22/CL/cl_d3d11.h new file mode 100644 index 00000000000..384c8f428fc --- /dev/null +++ b/lib/opencl_v2025.07.22/CL/cl_d3d11.h @@ -0,0 +1,270 @@ +/******************************************************************************* + * Copyright (c) 2008-2023 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_D3D11_H_ +#define OPENCL_CL_D3D11_H_ + +/* +** This header is generated from the Khronos OpenCL XML API Registry. +*/ + +#if defined(_MSC_VER) +#if _MSC_VER >=1500 +#pragma warning( push ) +#pragma warning( disable : 4201 ) +#pragma warning( disable : 5105 ) +#endif +#endif +#include +#if defined(_MSC_VER) +#if _MSC_VER >=1500 +#pragma warning( pop ) +#endif +#endif + +#include + +/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES) +#define CL_NO_EXTENSION_PROTOTYPES +#endif + +/* CL_NO_EXTENSION_PROTOTYPES implies + CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and + CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************** +* cl_khr_d3d11_sharing +***************************************************************/ +#define cl_khr_d3d11_sharing 1 +#define CL_KHR_D3D11_SHARING_EXTENSION_NAME \ + "cl_khr_d3d11_sharing" + + +#define CL_KHR_D3D11_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef cl_uint cl_d3d11_device_source_khr; +typedef cl_uint cl_d3d11_device_set_khr; + +/* Error codes */ +#define CL_INVALID_D3D11_DEVICE_KHR -1006 +#define CL_INVALID_D3D11_RESOURCE_KHR -1007 +#define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR -1008 +#define CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR -1009 + +/* cl_d3d11_device_source_khr */ +#define CL_D3D11_DEVICE_KHR 0x4019 +#define CL_D3D11_DXGI_ADAPTER_KHR 0x401A + +/* cl_d3d11_device_set_khr */ +#define CL_PREFERRED_DEVICES_FOR_D3D11_KHR 0x401B +#define CL_ALL_DEVICES_FOR_D3D11_KHR 0x401C + +/* cl_context_info */ +#define CL_CONTEXT_D3D11_DEVICE_KHR 0x401D +#define CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR 0x402D + +/* cl_mem_info */ +#define CL_MEM_D3D11_RESOURCE_KHR 0x401E + +/* cl_image_info */ +#define CL_IMAGE_D3D11_SUBRESOURCE_KHR 0x401F + +/* cl_command_type */ +#define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR 0x4020 +#define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR 0x4021 + + +typedef cl_int CL_API_CALL +clGetDeviceIDsFromD3D11KHR_t( + cl_platform_id platform, + cl_d3d11_device_source_khr d3d_device_source, + void* d3d_object, + cl_d3d11_device_set_khr d3d_device_set, + cl_uint num_entries, + cl_device_id* devices, + cl_uint* num_devices); + +typedef clGetDeviceIDsFromD3D11KHR_t * +clGetDeviceIDsFromD3D11KHR_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_mem CL_API_CALL +clCreateFromD3D11BufferKHR_t( + cl_context context, + cl_mem_flags flags, + ID3D11Buffer* resource, + cl_int* errcode_ret); + +typedef clCreateFromD3D11BufferKHR_t * +clCreateFromD3D11BufferKHR_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_mem CL_API_CALL +clCreateFromD3D11Texture2DKHR_t( + cl_context context, + cl_mem_flags flags, + ID3D11Texture2D* resource, + UINT subresource, + cl_int* errcode_ret); + +typedef clCreateFromD3D11Texture2DKHR_t * +clCreateFromD3D11Texture2DKHR_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_mem CL_API_CALL +clCreateFromD3D11Texture3DKHR_t( + cl_context context, + cl_mem_flags flags, + ID3D11Texture3D* resource, + UINT subresource, + cl_int* errcode_ret); + +typedef clCreateFromD3D11Texture3DKHR_t * +clCreateFromD3D11Texture3DKHR_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clEnqueueAcquireD3D11ObjectsKHR_t( + 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 clEnqueueAcquireD3D11ObjectsKHR_t * +clEnqueueAcquireD3D11ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clEnqueueReleaseD3D11ObjectsKHR_t( + 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 clEnqueueReleaseD3D11ObjectsKHR_t * +clEnqueueReleaseD3D11ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_2; + +#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetDeviceIDsFromD3D11KHR( + cl_platform_id platform, + cl_d3d11_device_source_khr d3d_device_source, + void* d3d_object, + cl_d3d11_device_set_khr d3d_device_set, + cl_uint num_entries, + cl_device_id* devices, + cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromD3D11BufferKHR( + cl_context context, + cl_mem_flags flags, + ID3D11Buffer* resource, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromD3D11Texture2DKHR( + cl_context context, + cl_mem_flags flags, + ID3D11Texture2D* resource, + UINT subresource, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromD3D11Texture3DKHR( + cl_context context, + cl_mem_flags flags, + ID3D11Texture3D* resource, + UINT subresource, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueAcquireD3D11ObjectsKHR( + 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_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReleaseD3D11ObjectsKHR( + 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_2; + +#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_intel_sharing_format_query_d3d11 +***************************************************************/ +#define cl_intel_sharing_format_query_d3d11 1 +#define CL_INTEL_SHARING_FORMAT_QUERY_D3D11_EXTENSION_NAME \ + "cl_intel_sharing_format_query_d3d11" + + +#define CL_INTEL_SHARING_FORMAT_QUERY_D3D11_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* when cl_khr_d3d11_sharing is supported */ + +typedef cl_int CL_API_CALL +clGetSupportedD3D11TextureFormatsINTEL_t( + cl_context context, + cl_mem_flags flags, + cl_mem_object_type image_type, + cl_uint plane, + cl_uint num_entries, + DXGI_FORMAT* d3d11_formats, + cl_uint* num_texture_formats); + +typedef clGetSupportedD3D11TextureFormatsINTEL_t * +clGetSupportedD3D11TextureFormatsINTEL_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetSupportedD3D11TextureFormatsINTEL( + cl_context context, + cl_mem_flags flags, + cl_mem_object_type image_type, + cl_uint plane, + cl_uint num_entries, + DXGI_FORMAT* d3d11_formats, + cl_uint* num_texture_formats) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_CL_D3D11_H_ */ diff --git a/lib/opencl_v2025.07.22/CL/cl_dx9_media_sharing.h b/lib/opencl_v2025.07.22/CL/cl_dx9_media_sharing.h new file mode 100644 index 00000000000..b079379d0a7 --- /dev/null +++ b/lib/opencl_v2025.07.22/CL/cl_dx9_media_sharing.h @@ -0,0 +1,386 @@ +/******************************************************************************* + * Copyright (c) 2008-2023 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_DX9_MEDIA_SHARING_H_ +#define OPENCL_CL_DX9_MEDIA_SHARING_H_ + +/* +** This header is generated from the Khronos OpenCL XML API Registry. +*/ + +#if defined(_WIN32) +#if defined(_MSC_VER) +#if _MSC_VER >=1500 +#pragma warning( push ) +#pragma warning( disable : 4201 ) +#pragma warning( disable : 5105 ) +#endif +#endif +#include +#if defined(_MSC_VER) +#if _MSC_VER >=1500 +#pragma warning( pop ) +#endif +#endif +#endif + +#include + +/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES) +#define CL_NO_EXTENSION_PROTOTYPES +#endif + +/* CL_NO_EXTENSION_PROTOTYPES implies + CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and + CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************** +* cl_khr_dx9_media_sharing +***************************************************************/ +#define cl_khr_dx9_media_sharing 1 +#define CL_KHR_DX9_MEDIA_SHARING_EXTENSION_NAME \ + "cl_khr_dx9_media_sharing" + + +#define CL_KHR_DX9_MEDIA_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef cl_uint cl_dx9_media_adapter_type_khr; +typedef cl_uint cl_dx9_media_adapter_set_khr; + +#if defined(_WIN32) +typedef struct _cl_dx9_surface_info_khr { + IDirect3DSurface9* resource; + HANDLE shared_handle; +} cl_dx9_surface_info_khr; + +#endif /* defined(_WIN32) */ + +/* Error codes */ +#define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010 +#define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011 +#define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012 +#define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013 + +/* cl_media_adapter_type_khr */ +#define CL_ADAPTER_D3D9_KHR 0x2020 +#define CL_ADAPTER_D3D9EX_KHR 0x2021 +#define CL_ADAPTER_DXVA_KHR 0x2022 + +/* cl_media_adapter_set_khr */ +#define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023 +#define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024 + +/* cl_context_info */ +#define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025 +#define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026 +#define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027 + +/* cl_mem_info */ +#define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028 +#define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029 + +/* cl_image_info */ +#define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A + +/* cl_command_type */ +#define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B +#define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C + + +typedef cl_int CL_API_CALL +clGetDeviceIDsFromDX9MediaAdapterKHR_t( + cl_platform_id platform, + cl_uint num_media_adapters, + cl_dx9_media_adapter_type_khr* media_adapter_type, + void* media_adapters, + cl_dx9_media_adapter_set_khr media_adapter_set, + cl_uint num_entries, + cl_device_id* devices, + cl_uint* num_devices); + +typedef clGetDeviceIDsFromDX9MediaAdapterKHR_t * +clGetDeviceIDsFromDX9MediaAdapterKHR_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_mem CL_API_CALL +clCreateFromDX9MediaSurfaceKHR_t( + cl_context context, + cl_mem_flags flags, + cl_dx9_media_adapter_type_khr adapter_type, + void* surface_info, + cl_uint plane, + cl_int* errcode_ret); + +typedef clCreateFromDX9MediaSurfaceKHR_t * +clCreateFromDX9MediaSurfaceKHR_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clEnqueueAcquireDX9MediaSurfacesKHR_t( + 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 clEnqueueAcquireDX9MediaSurfacesKHR_t * +clEnqueueAcquireDX9MediaSurfacesKHR_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clEnqueueReleaseDX9MediaSurfacesKHR_t( + 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 clEnqueueReleaseDX9MediaSurfacesKHR_t * +clEnqueueReleaseDX9MediaSurfacesKHR_fn CL_API_SUFFIX__VERSION_1_2; + +#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetDeviceIDsFromDX9MediaAdapterKHR( + cl_platform_id platform, + cl_uint num_media_adapters, + cl_dx9_media_adapter_type_khr* media_adapter_type, + void* media_adapters, + cl_dx9_media_adapter_set_khr media_adapter_set, + cl_uint num_entries, + cl_device_id* devices, + cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromDX9MediaSurfaceKHR( + cl_context context, + cl_mem_flags flags, + cl_dx9_media_adapter_type_khr adapter_type, + void* surface_info, + cl_uint plane, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueAcquireDX9MediaSurfacesKHR( + 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_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReleaseDX9MediaSurfacesKHR( + 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_2; + +#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_intel_dx9_media_sharing +***************************************************************/ +#define cl_intel_dx9_media_sharing 1 +#define CL_INTEL_DX9_MEDIA_SHARING_EXTENSION_NAME \ + "cl_intel_dx9_media_sharing" + + +#define CL_INTEL_DX9_MEDIA_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +typedef cl_uint cl_dx9_device_source_intel; +typedef cl_uint cl_dx9_device_set_intel; + +/* Error codes */ +#define CL_INVALID_DX9_DEVICE_INTEL -1010 +#define CL_INVALID_DX9_RESOURCE_INTEL -1011 +#define CL_DX9_RESOURCE_ALREADY_ACQUIRED_INTEL -1012 +#define CL_DX9_RESOURCE_NOT_ACQUIRED_INTEL -1013 + +/* cl_dx9_device_source_intel */ +#define CL_D3D9_DEVICE_INTEL 0x4022 +#define CL_D3D9EX_DEVICE_INTEL 0x4070 +#define CL_DXVA_DEVICE_INTEL 0x4071 + +/* cl_dx9_device_set_intel */ +#define CL_PREFERRED_DEVICES_FOR_DX9_INTEL 0x4024 +#define CL_ALL_DEVICES_FOR_DX9_INTEL 0x4025 + +/* cl_context_info */ +#define CL_CONTEXT_D3D9_DEVICE_INTEL 0x4026 +#define CL_CONTEXT_D3D9EX_DEVICE_INTEL 0x4072 +#define CL_CONTEXT_DXVA_DEVICE_INTEL 0x4073 + +/* cl_mem_info */ +#define CL_MEM_DX9_RESOURCE_INTEL 0x4027 +#define CL_MEM_DX9_SHARED_HANDLE_INTEL 0x4074 + +/* cl_image_info */ +#define CL_IMAGE_DX9_PLANE_INTEL 0x4075 + +/* cl_command_type */ +#define CL_COMMAND_ACQUIRE_DX9_OBJECTS_INTEL 0x402A +#define CL_COMMAND_RELEASE_DX9_OBJECTS_INTEL 0x402B + + +typedef cl_int CL_API_CALL +clGetDeviceIDsFromDX9INTEL_t( + cl_platform_id platform, + cl_dx9_device_source_intel dx9_device_source, + void* dx9_object, + cl_dx9_device_set_intel dx9_device_set, + cl_uint num_entries, + cl_device_id* devices, + cl_uint* num_devices); + +typedef clGetDeviceIDsFromDX9INTEL_t * +clGetDeviceIDsFromDX9INTEL_fn CL_API_SUFFIX__VERSION_1_1; + +typedef cl_mem CL_API_CALL +clCreateFromDX9MediaSurfaceINTEL_t( + cl_context context, + cl_mem_flags flags, + IDirect3DSurface9* resource, + HANDLE sharedHandle, + UINT plane, + cl_int* errcode_ret); + +typedef clCreateFromDX9MediaSurfaceINTEL_t * +clCreateFromDX9MediaSurfaceINTEL_fn CL_API_SUFFIX__VERSION_1_1; + +typedef cl_int CL_API_CALL +clEnqueueAcquireDX9ObjectsINTEL_t( + 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 clEnqueueAcquireDX9ObjectsINTEL_t * +clEnqueueAcquireDX9ObjectsINTEL_fn CL_API_SUFFIX__VERSION_1_1; + +typedef cl_int CL_API_CALL +clEnqueueReleaseDX9ObjectsINTEL_t( + cl_command_queue command_queue, + cl_uint num_objects, + cl_mem* mem_objects, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueReleaseDX9ObjectsINTEL_t * +clEnqueueReleaseDX9ObjectsINTEL_fn CL_API_SUFFIX__VERSION_1_1; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetDeviceIDsFromDX9INTEL( + cl_platform_id platform, + cl_dx9_device_source_intel dx9_device_source, + void* dx9_object, + cl_dx9_device_set_intel dx9_device_set, + cl_uint num_entries, + cl_device_id* devices, + cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_1; + +extern CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromDX9MediaSurfaceINTEL( + cl_context context, + cl_mem_flags flags, + IDirect3DSurface9* resource, + HANDLE sharedHandle, + UINT plane, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueAcquireDX9ObjectsINTEL( + 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_1; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReleaseDX9ObjectsINTEL( + cl_command_queue command_queue, + cl_uint num_objects, + 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_1; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_intel_sharing_format_query_dx9 +***************************************************************/ +#define cl_intel_sharing_format_query_dx9 1 +#define CL_INTEL_SHARING_FORMAT_QUERY_DX9_EXTENSION_NAME \ + "cl_intel_sharing_format_query_dx9" + + +#define CL_INTEL_SHARING_FORMAT_QUERY_DX9_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* when cl_khr_dx9_media_sharing or cl_intel_dx9_media_sharing is supported */ + +typedef cl_int CL_API_CALL +clGetSupportedDX9MediaSurfaceFormatsINTEL_t( + cl_context context, + cl_mem_flags flags, + cl_mem_object_type image_type, + cl_uint plane, + cl_uint num_entries, + D3DFORMAT* dx9_formats, + cl_uint* num_surface_formats); + +typedef clGetSupportedDX9MediaSurfaceFormatsINTEL_t * +clGetSupportedDX9MediaSurfaceFormatsINTEL_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetSupportedDX9MediaSurfaceFormatsINTEL( + cl_context context, + cl_mem_flags flags, + cl_mem_object_type image_type, + cl_uint plane, + cl_uint num_entries, + D3DFORMAT* dx9_formats, + cl_uint* num_surface_formats) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_CL_DX9_MEDIA_SHARING_H_ */ diff --git a/lib/opencl_3.0.0/CL/cl_dx9_media_sharing_intel.h b/lib/opencl_v2025.07.22/CL/cl_dx9_media_sharing_intel.h similarity index 100% rename from lib/opencl_3.0.0/CL/cl_dx9_media_sharing_intel.h rename to lib/opencl_v2025.07.22/CL/cl_dx9_media_sharing_intel.h diff --git a/lib/opencl_v2025.07.22/CL/cl_egl.h b/lib/opencl_v2025.07.22/CL/cl_egl.h new file mode 100644 index 00000000000..68aefec7619 --- /dev/null +++ b/lib/opencl_v2025.07.22/CL/cl_egl.h @@ -0,0 +1,185 @@ +/******************************************************************************* + * Copyright (c) 2008-2023 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_H_ +#define OPENCL_CL_EGL_H_ + +/* +** This header is generated from the Khronos OpenCL XML API Registry. +*/ + +#include + +/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES) +#define CL_NO_EXTENSION_PROTOTYPES +#endif + +/* CL_NO_EXTENSION_PROTOTYPES implies + CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and + CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************** +* cl_khr_egl_image +***************************************************************/ +#define cl_khr_egl_image 1 +#define CL_KHR_EGL_IMAGE_EXTENSION_NAME \ + "cl_khr_egl_image" + + +#define CL_KHR_EGL_IMAGE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* Command type for events created with clEnqueueAcquireEGLObjectsKHR */ +#define CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR 0x202F +#define CL_COMMAND_ACQUIRE_EGL_OBJECTS_KHR 0x202D +#define CL_COMMAND_RELEASE_EGL_OBJECTS_KHR 0x202E + +/* Error type for clCreateFromEGLImageKHR */ +#define CL_INVALID_EGL_OBJECT_KHR -1093 +#define CL_EGL_RESOURCE_NOT_ACQUIRED_KHR -1092 + +/* CLeglImageKHR is an opaque handle to an EGLImage */ +typedef void* CLeglImageKHR; + +/* CLeglDisplayKHR is an opaque handle to an EGLDisplay */ +typedef void* CLeglDisplayKHR; + +/* properties passed to clCreateFromEGLImageKHR */ +typedef intptr_t cl_egl_image_properties_khr; + + +typedef cl_mem CL_API_CALL +clCreateFromEGLImageKHR_t( + cl_context context, + CLeglDisplayKHR egldisplay, + CLeglImageKHR eglimage, + cl_mem_flags flags, + const cl_egl_image_properties_khr* properties, + cl_int* errcode_ret); + +typedef clCreateFromEGLImageKHR_t * +clCreateFromEGLImageKHR_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL +clEnqueueAcquireEGLObjectsKHR_t( + 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 clEnqueueAcquireEGLObjectsKHR_t * +clEnqueueAcquireEGLObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL +clEnqueueReleaseEGLObjectsKHR_t( + 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 clEnqueueReleaseEGLObjectsKHR_t * +clEnqueueReleaseEGLObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0; + +#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern 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) CL_API_SUFFIX__VERSION_1_0; + +extern 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) CL_API_SUFFIX__VERSION_1_0; + +extern 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) CL_API_SUFFIX__VERSION_1_0; + +#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_khr_egl_event +***************************************************************/ +#define cl_khr_egl_event 1 +#define CL_KHR_EGL_EVENT_EXTENSION_NAME \ + "cl_khr_egl_event" + + +#define CL_KHR_EGL_EVENT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* CLeglDisplayKHR is an opaque handle to an EGLDisplay */ +/* type CLeglDisplayKHR */ + +/* CLeglSyncKHR is an opaque handle to an EGLSync object */ +typedef void* CLeglSyncKHR; + + +typedef cl_event CL_API_CALL +clCreateEventFromEGLSyncKHR_t( + cl_context context, + CLeglSyncKHR sync, + CLeglDisplayKHR display, + cl_int* errcode_ret); + +typedef clCreateEventFromEGLSyncKHR_t * +clCreateEventFromEGLSyncKHR_fn CL_API_SUFFIX__VERSION_1_0; + +#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +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 /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_CL_EGL_H_ */ diff --git a/lib/opencl_v2025.07.22/CL/cl_ext.h b/lib/opencl_v2025.07.22/CL/cl_ext.h new file mode 100644 index 00000000000..688e2431616 --- /dev/null +++ b/lib/opencl_v2025.07.22/CL/cl_ext.h @@ -0,0 +1,4435 @@ +/******************************************************************************* + * Copyright (c) 2008-2023 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_H_ +#define OPENCL_CL_EXT_H_ + +/* +** This header is generated from the Khronos OpenCL XML API Registry. +*/ + +#include + +/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES) +#define CL_NO_EXTENSION_PROTOTYPES +#endif + +/* CL_NO_EXTENSION_PROTOTYPES implies + CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and + CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************** +* cl_khr_command_buffer (beta) +***************************************************************/ +#if defined(CL_ENABLE_BETA_EXTENSIONS) + +#define cl_khr_command_buffer 1 +#define CL_KHR_COMMAND_BUFFER_EXTENSION_NAME \ + "cl_khr_command_buffer" + + +#define CL_KHR_COMMAND_BUFFER_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 7) + +typedef cl_bitfield cl_device_command_buffer_capabilities_khr; +typedef struct _cl_command_buffer_khr* cl_command_buffer_khr; +typedef cl_uint cl_sync_point_khr; +typedef cl_uint cl_command_buffer_info_khr; +typedef cl_uint cl_command_buffer_state_khr; +typedef cl_properties cl_command_buffer_properties_khr; +typedef cl_bitfield cl_command_buffer_flags_khr; +typedef cl_properties cl_command_properties_khr; +typedef struct _cl_mutable_command_khr* cl_mutable_command_khr; + +/* cl_device_info */ +#define CL_DEVICE_COMMAND_BUFFER_CAPABILITIES_KHR 0x12A9 +#define CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR 0x129A +#define CL_DEVICE_COMMAND_BUFFER_REQUIRED_QUEUE_PROPERTIES_KHR 0x12AA + +/* cl_device_command_buffer_capabilities_khr - bitfield */ +#define CL_COMMAND_BUFFER_CAPABILITY_KERNEL_PRINTF_KHR (1 << 0) +#define CL_COMMAND_BUFFER_CAPABILITY_DEVICE_SIDE_ENQUEUE_KHR (1 << 1) +#define CL_COMMAND_BUFFER_CAPABILITY_SIMULTANEOUS_USE_KHR (1 << 2) + +/* cl_command_buffer_properties_khr */ +#define CL_COMMAND_BUFFER_FLAGS_KHR 0x1293 + +/* cl_command_buffer_flags_khr - bitfield */ +#define CL_COMMAND_BUFFER_SIMULTANEOUS_USE_KHR (1 << 0) + +/* Error codes */ +#define CL_INVALID_COMMAND_BUFFER_KHR -1138 +#define CL_INVALID_SYNC_POINT_WAIT_LIST_KHR -1139 +#define CL_INCOMPATIBLE_COMMAND_QUEUE_KHR -1140 + +/* cl_command_buffer_info_khr */ +#define CL_COMMAND_BUFFER_QUEUES_KHR 0x1294 +#define CL_COMMAND_BUFFER_NUM_QUEUES_KHR 0x1295 +#define CL_COMMAND_BUFFER_REFERENCE_COUNT_KHR 0x1296 +#define CL_COMMAND_BUFFER_STATE_KHR 0x1297 +#define CL_COMMAND_BUFFER_PROPERTIES_ARRAY_KHR 0x1298 +#define CL_COMMAND_BUFFER_CONTEXT_KHR 0x1299 + +/* cl_command_buffer_state_khr */ +#define CL_COMMAND_BUFFER_STATE_RECORDING_KHR 0 +#define CL_COMMAND_BUFFER_STATE_EXECUTABLE_KHR 1 +#define CL_COMMAND_BUFFER_STATE_PENDING_KHR 2 + +/* cl_command_type */ +#define CL_COMMAND_COMMAND_BUFFER_KHR 0x12A8 + + +typedef cl_command_buffer_khr CL_API_CALL +clCreateCommandBufferKHR_t( + cl_uint num_queues, + const cl_command_queue* queues, + const cl_command_buffer_properties_khr* properties, + cl_int* errcode_ret); + +typedef clCreateCommandBufferKHR_t * +clCreateCommandBufferKHR_fn ; + +typedef cl_int CL_API_CALL +clFinalizeCommandBufferKHR_t( + cl_command_buffer_khr command_buffer); + +typedef clFinalizeCommandBufferKHR_t * +clFinalizeCommandBufferKHR_fn ; + +typedef cl_int CL_API_CALL +clRetainCommandBufferKHR_t( + cl_command_buffer_khr command_buffer); + +typedef clRetainCommandBufferKHR_t * +clRetainCommandBufferKHR_fn ; + +typedef cl_int CL_API_CALL +clReleaseCommandBufferKHR_t( + cl_command_buffer_khr command_buffer); + +typedef clReleaseCommandBufferKHR_t * +clReleaseCommandBufferKHR_fn ; + +typedef cl_int CL_API_CALL +clEnqueueCommandBufferKHR_t( + cl_uint num_queues, + cl_command_queue* queues, + cl_command_buffer_khr command_buffer, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueCommandBufferKHR_t * +clEnqueueCommandBufferKHR_fn ; + +typedef cl_int CL_API_CALL +clCommandBarrierWithWaitListKHR_t( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle); + +typedef clCommandBarrierWithWaitListKHR_t * +clCommandBarrierWithWaitListKHR_fn ; + +typedef cl_int CL_API_CALL +clCommandCopyBufferKHR_t( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + cl_mem src_buffer, + cl_mem dst_buffer, + size_t src_offset, + size_t dst_offset, + size_t size, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle); + +typedef clCommandCopyBufferKHR_t * +clCommandCopyBufferKHR_fn ; + +typedef cl_int CL_API_CALL +clCommandCopyBufferRectKHR_t( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + 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_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle); + +typedef clCommandCopyBufferRectKHR_t * +clCommandCopyBufferRectKHR_fn ; + +typedef cl_int CL_API_CALL +clCommandCopyBufferToImageKHR_t( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + cl_mem src_buffer, + cl_mem dst_image, + size_t src_offset, + const size_t* dst_origin, + const size_t* region, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle); + +typedef clCommandCopyBufferToImageKHR_t * +clCommandCopyBufferToImageKHR_fn ; + +typedef cl_int CL_API_CALL +clCommandCopyImageKHR_t( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + 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_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle); + +typedef clCommandCopyImageKHR_t * +clCommandCopyImageKHR_fn ; + +typedef cl_int CL_API_CALL +clCommandCopyImageToBufferKHR_t( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + cl_mem src_image, + cl_mem dst_buffer, + const size_t* src_origin, + const size_t* region, + size_t dst_offset, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle); + +typedef clCommandCopyImageToBufferKHR_t * +clCommandCopyImageToBufferKHR_fn ; + +typedef cl_int CL_API_CALL +clCommandFillBufferKHR_t( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + cl_mem buffer, + const void* pattern, + size_t pattern_size, + size_t offset, + size_t size, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle); + +typedef clCommandFillBufferKHR_t * +clCommandFillBufferKHR_fn ; + +typedef cl_int CL_API_CALL +clCommandFillImageKHR_t( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + cl_mem image, + const void* fill_color, + const size_t* origin, + const size_t* region, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle); + +typedef clCommandFillImageKHR_t * +clCommandFillImageKHR_fn ; + +typedef cl_int CL_API_CALL +clCommandNDRangeKernelKHR_t( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + 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_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle); + +typedef clCommandNDRangeKernelKHR_t * +clCommandNDRangeKernelKHR_fn ; + +typedef cl_int CL_API_CALL +clGetCommandBufferInfoKHR_t( + cl_command_buffer_khr command_buffer, + cl_command_buffer_info_khr param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetCommandBufferInfoKHR_t * +clGetCommandBufferInfoKHR_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_command_buffer_khr CL_API_CALL +clCreateCommandBufferKHR( + cl_uint num_queues, + const cl_command_queue* queues, + const cl_command_buffer_properties_khr* properties, + cl_int* errcode_ret) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clFinalizeCommandBufferKHR( + cl_command_buffer_khr command_buffer) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clRetainCommandBufferKHR( + cl_command_buffer_khr command_buffer) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clReleaseCommandBufferKHR( + cl_command_buffer_khr command_buffer) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueCommandBufferKHR( + cl_uint num_queues, + cl_command_queue* queues, + cl_command_buffer_khr command_buffer, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clCommandBarrierWithWaitListKHR( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clCommandCopyBufferKHR( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + cl_mem src_buffer, + cl_mem dst_buffer, + size_t src_offset, + size_t dst_offset, + size_t size, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clCommandCopyBufferRectKHR( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + 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_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clCommandCopyBufferToImageKHR( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + cl_mem src_buffer, + cl_mem dst_image, + size_t src_offset, + const size_t* dst_origin, + const size_t* region, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clCommandCopyImageKHR( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + 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_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clCommandCopyImageToBufferKHR( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + cl_mem src_image, + cl_mem dst_buffer, + const size_t* src_origin, + const size_t* region, + size_t dst_offset, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clCommandFillBufferKHR( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + cl_mem buffer, + const void* pattern, + size_t pattern_size, + size_t offset, + size_t size, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clCommandFillImageKHR( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + cl_mem image, + const void* fill_color, + const size_t* origin, + const size_t* region, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clCommandNDRangeKernelKHR( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + 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_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetCommandBufferInfoKHR( + cl_command_buffer_khr command_buffer, + cl_command_buffer_info_khr param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/* From version 0.9.4 of the extension */ + +typedef cl_int CL_API_CALL +clCommandSVMMemcpyKHR_t( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + void* dst_ptr, + const void* src_ptr, + size_t size, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle); + +typedef clCommandSVMMemcpyKHR_t * +clCommandSVMMemcpyKHR_fn CL_API_SUFFIX__VERSION_2_0; + +typedef cl_int CL_API_CALL +clCommandSVMMemFillKHR_t( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + void* svm_ptr, + const void* pattern, + size_t pattern_size, + size_t size, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle); + +typedef clCommandSVMMemFillKHR_t * +clCommandSVMMemFillKHR_fn CL_API_SUFFIX__VERSION_2_0; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clCommandSVMMemcpyKHR( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + void* dst_ptr, + const void* src_ptr, + size_t size, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle) CL_API_SUFFIX__VERSION_2_0; + +extern CL_API_ENTRY cl_int CL_API_CALL +clCommandSVMMemFillKHR( + cl_command_buffer_khr command_buffer, + cl_command_queue command_queue, + const cl_command_properties_khr* properties, + void* svm_ptr, + const void* pattern, + size_t pattern_size, + size_t size, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr* sync_point_wait_list, + cl_sync_point_khr* sync_point, + cl_mutable_command_khr* mutable_handle) CL_API_SUFFIX__VERSION_2_0; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#endif /* defined(CL_ENABLE_BETA_EXTENSIONS) */ + +/*************************************************************** +* cl_khr_command_buffer_multi_device (beta) +***************************************************************/ +#if defined(CL_ENABLE_BETA_EXTENSIONS) + +#define cl_khr_command_buffer_multi_device 1 +#define CL_KHR_COMMAND_BUFFER_MULTI_DEVICE_EXTENSION_NAME \ + "cl_khr_command_buffer_multi_device" + + +#define CL_KHR_COMMAND_BUFFER_MULTI_DEVICE_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 2) + +typedef cl_bitfield cl_platform_command_buffer_capabilities_khr; + +/* cl_platform_info */ +#define CL_PLATFORM_COMMAND_BUFFER_CAPABILITIES_KHR 0x0908 + +/* cl_platform_command_buffer_capabilities_khr - bitfield */ +#define CL_COMMAND_BUFFER_PLATFORM_UNIVERSAL_SYNC_KHR (1 << 0) +#define CL_COMMAND_BUFFER_PLATFORM_REMAP_QUEUES_KHR (1 << 1) +#define CL_COMMAND_BUFFER_PLATFORM_AUTOMATIC_REMAP_KHR (1 << 2) + +/* cl_device_info */ +#define CL_DEVICE_COMMAND_BUFFER_NUM_SYNC_DEVICES_KHR 0x12AB +#define CL_DEVICE_COMMAND_BUFFER_SYNC_DEVICES_KHR 0x12AC + +/* cl_device_command_buffer_capabilities_khr - bitfield */ +#define CL_COMMAND_BUFFER_CAPABILITY_MULTIPLE_QUEUE_KHR (1 << 4) + +/* cl_command_buffer_flags_khr - bitfield */ +#define CL_COMMAND_BUFFER_DEVICE_SIDE_SYNC_KHR (1 << 2) + + +typedef cl_command_buffer_khr CL_API_CALL +clRemapCommandBufferKHR_t( + cl_command_buffer_khr command_buffer, + cl_bool automatic, + cl_uint num_queues, + const cl_command_queue* queues, + cl_uint num_handles, + const cl_mutable_command_khr* handles, + cl_mutable_command_khr* handles_ret, + cl_int* errcode_ret); + +typedef clRemapCommandBufferKHR_t * +clRemapCommandBufferKHR_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_command_buffer_khr CL_API_CALL +clRemapCommandBufferKHR( + cl_command_buffer_khr command_buffer, + cl_bool automatic, + cl_uint num_queues, + const cl_command_queue* queues, + cl_uint num_handles, + const cl_mutable_command_khr* handles, + cl_mutable_command_khr* handles_ret, + cl_int* errcode_ret) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#endif /* defined(CL_ENABLE_BETA_EXTENSIONS) */ + +/*************************************************************** +* cl_khr_command_buffer_mutable_dispatch (beta) +***************************************************************/ +#if defined(CL_ENABLE_BETA_EXTENSIONS) + +#define cl_khr_command_buffer_mutable_dispatch 1 +#define CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_NAME \ + "cl_khr_command_buffer_mutable_dispatch" + + +#define CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 3) + +typedef cl_uint cl_command_buffer_update_type_khr; +typedef cl_bitfield cl_mutable_dispatch_fields_khr; +typedef cl_uint cl_mutable_command_info_khr; +typedef struct _cl_mutable_dispatch_arg_khr { + cl_uint arg_index; + size_t arg_size; + const void* arg_value; +} cl_mutable_dispatch_arg_khr; +typedef struct _cl_mutable_dispatch_exec_info_khr { + cl_uint param_name; + size_t param_value_size; + const void* param_value; +} cl_mutable_dispatch_exec_info_khr; +typedef struct _cl_mutable_dispatch_config_khr { + cl_mutable_command_khr command; + cl_uint num_args; + cl_uint num_svm_args; + cl_uint num_exec_infos; + cl_uint work_dim; + const cl_mutable_dispatch_arg_khr* arg_list; + const cl_mutable_dispatch_arg_khr* arg_svm_list; + const cl_mutable_dispatch_exec_info_khr* exec_info_list; + const size_t* global_work_offset; + const size_t* global_work_size; + const size_t* local_work_size; +} cl_mutable_dispatch_config_khr; +typedef cl_bitfield cl_mutable_dispatch_asserts_khr; + +/* cl_command_buffer_flags_khr - bitfield */ +#define CL_COMMAND_BUFFER_MUTABLE_KHR (1 << 1) + +/* Error codes */ +#define CL_INVALID_MUTABLE_COMMAND_KHR -1141 + +/* cl_device_info */ +#define CL_DEVICE_MUTABLE_DISPATCH_CAPABILITIES_KHR 0x12B0 + +/* cl_command_properties_khr */ +#define CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR 0x12B1 + +/* cl_mutable_dispatch_fields_khr - bitfield */ +#define CL_MUTABLE_DISPATCH_GLOBAL_OFFSET_KHR (1 << 0) +#define CL_MUTABLE_DISPATCH_GLOBAL_SIZE_KHR (1 << 1) +#define CL_MUTABLE_DISPATCH_LOCAL_SIZE_KHR (1 << 2) +#define CL_MUTABLE_DISPATCH_ARGUMENTS_KHR (1 << 3) +#define CL_MUTABLE_DISPATCH_EXEC_INFO_KHR (1 << 4) + +/* cl_mutable_command_info_khr */ +#define CL_MUTABLE_COMMAND_COMMAND_QUEUE_KHR 0x12A0 +#define CL_MUTABLE_COMMAND_COMMAND_BUFFER_KHR 0x12A1 +#define CL_MUTABLE_COMMAND_COMMAND_TYPE_KHR 0x12AD +#define CL_MUTABLE_COMMAND_PROPERTIES_ARRAY_KHR 0x12A2 +#define CL_MUTABLE_DISPATCH_KERNEL_KHR 0x12A3 +#define CL_MUTABLE_DISPATCH_DIMENSIONS_KHR 0x12A4 +#define CL_MUTABLE_DISPATCH_GLOBAL_WORK_OFFSET_KHR 0x12A5 +#define CL_MUTABLE_DISPATCH_GLOBAL_WORK_SIZE_KHR 0x12A6 +#define CL_MUTABLE_DISPATCH_LOCAL_WORK_SIZE_KHR 0x12A7 + +/* cl_command_buffer_update_type_khr */ +#define CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR 0 + +/* cl_command_buffer_properties_khr */ +#define CL_COMMAND_BUFFER_MUTABLE_DISPATCH_ASSERTS_KHR 0x12B7 + +/* cl_command_properties_khr */ +#define CL_MUTABLE_DISPATCH_ASSERTS_KHR 0x12B8 + +/* cl_mutable_dispatch_asserts_khr - bitfield */ +#define CL_MUTABLE_DISPATCH_ASSERT_NO_ADDITIONAL_WORK_GROUPS_KHR (1 << 0) + + +typedef cl_int CL_API_CALL +clUpdateMutableCommandsKHR_t( + cl_command_buffer_khr command_buffer, + cl_uint num_configs, + const cl_command_buffer_update_type_khr* config_types, + const void** configs); + +typedef clUpdateMutableCommandsKHR_t * +clUpdateMutableCommandsKHR_fn ; + +typedef cl_int CL_API_CALL +clGetMutableCommandInfoKHR_t( + cl_mutable_command_khr command, + cl_mutable_command_info_khr param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetMutableCommandInfoKHR_t * +clGetMutableCommandInfoKHR_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clUpdateMutableCommandsKHR( + cl_command_buffer_khr command_buffer, + cl_uint num_configs, + const cl_command_buffer_update_type_khr* config_types, + const void** configs) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetMutableCommandInfoKHR( + cl_mutable_command_khr command, + cl_mutable_command_info_khr param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#endif /* defined(CL_ENABLE_BETA_EXTENSIONS) */ + +/*************************************************************** +* cl_khr_fp64 +***************************************************************/ +#define cl_khr_fp64 1 +#define CL_KHR_FP64_EXTENSION_NAME \ + "cl_khr_fp64" + + +#define CL_KHR_FP64_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +#if !defined(CL_VERSION_1_2) +/* cl_device_info - defined in CL.h for OpenCL 1.2 and newer */ +#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032 + +#endif /* !defined(CL_VERSION_1_2) */ + +/*************************************************************** +* cl_khr_fp16 +***************************************************************/ +#define cl_khr_fp16 1 +#define CL_KHR_FP16_EXTENSION_NAME \ + "cl_khr_fp16" + + +#define CL_KHR_FP16_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_HALF_FP_CONFIG 0x1033 + +/*************************************************************** +* cl_APPLE_SetMemObjectDestructor +***************************************************************/ +#define cl_APPLE_SetMemObjectDestructor 1 +#define CL_APPLE_SETMEMOBJECTDESTRUCTOR_EXTENSION_NAME \ + "cl_APPLE_SetMemObjectDestructor" + + +#define CL_APPLE_SETMEMOBJECTDESTRUCTOR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + + +typedef cl_int CL_API_CALL +clSetMemObjectDestructorAPPLE_t( + cl_mem memobj, + void (CL_CALLBACK* pfn_notify)(cl_mem memobj, void* user_data), + void* user_data); + +typedef clSetMemObjectDestructorAPPLE_t * +clSetMemObjectDestructorAPPLE_fn CL_API_SUFFIX__VERSION_1_0; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clSetMemObjectDestructorAPPLE( + cl_mem memobj, + void (CL_CALLBACK* pfn_notify)(cl_mem memobj, void* user_data), + void* user_data) CL_API_SUFFIX__VERSION_1_0; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_APPLE_ContextLoggingFunctions +***************************************************************/ +#define cl_APPLE_ContextLoggingFunctions 1 +#define CL_APPLE_CONTEXTLOGGINGFUNCTIONS_EXTENSION_NAME \ + "cl_APPLE_ContextLoggingFunctions" + + +#define CL_APPLE_CONTEXTLOGGINGFUNCTIONS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + + +typedef void CL_API_CALL +clLogMessagesToSystemLogAPPLE_t( + const char* errstr, + const void* private_info, + size_t cb, + void* user_data); + +typedef clLogMessagesToSystemLogAPPLE_t * +clLogMessagesToSystemLogAPPLE_fn CL_API_SUFFIX__VERSION_1_0; + +typedef void CL_API_CALL +clLogMessagesToStdoutAPPLE_t( + const char* errstr, + const void* private_info, + size_t cb, + void* user_data); + +typedef clLogMessagesToStdoutAPPLE_t * +clLogMessagesToStdoutAPPLE_fn CL_API_SUFFIX__VERSION_1_0; + +typedef void CL_API_CALL +clLogMessagesToStderrAPPLE_t( + const char* errstr, + const void* private_info, + size_t cb, + void* user_data); + +typedef clLogMessagesToStderrAPPLE_t * +clLogMessagesToStderrAPPLE_fn CL_API_SUFFIX__VERSION_1_0; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY void CL_API_CALL +clLogMessagesToSystemLogAPPLE( + const char* errstr, + const void* private_info, + size_t cb, + void* user_data) CL_API_SUFFIX__VERSION_1_0; + +extern CL_API_ENTRY void CL_API_CALL +clLogMessagesToStdoutAPPLE( + const char* errstr, + const void* private_info, + size_t cb, + void* user_data) CL_API_SUFFIX__VERSION_1_0; + +extern CL_API_ENTRY void CL_API_CALL +clLogMessagesToStderrAPPLE( + const char* errstr, + const void* private_info, + size_t cb, + void* user_data) CL_API_SUFFIX__VERSION_1_0; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_khr_icd +***************************************************************/ +#define cl_khr_icd 1 +#define CL_KHR_ICD_EXTENSION_NAME \ + "cl_khr_icd" + + +#define CL_KHR_ICD_EXTENSION_VERSION CL_MAKE_VERSION(2, 0, 0) + +/* cl_platform_info */ +#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920 + +/* Error codes */ +#define CL_PLATFORM_NOT_FOUND_KHR -1001 + +/* ICD 2 tag value */ +#if INTPTR_MAX == INT32_MAX +#define CL_ICD2_TAG_KHR ((intptr_t)0x434C3331) +#else +#define CL_ICD2_TAG_KHR ((intptr_t)0x4F50454E434C3331) +#endif + + +typedef cl_int CL_API_CALL +clIcdGetPlatformIDsKHR_t( + cl_uint num_entries, + cl_platform_id* platforms, + cl_uint* num_platforms); + +typedef clIcdGetPlatformIDsKHR_t * +clIcdGetPlatformIDsKHR_fn ; + +typedef void* CL_API_CALL +clIcdGetFunctionAddressForPlatformKHR_t( + cl_platform_id platform, + const char* func_name); + +typedef clIcdGetFunctionAddressForPlatformKHR_t * +clIcdGetFunctionAddressForPlatformKHR_fn ; + +typedef cl_int CL_API_CALL +clIcdSetPlatformDispatchDataKHR_t( + cl_platform_id platform, + void* dispatch_data); + +typedef clIcdSetPlatformDispatchDataKHR_t * +clIcdSetPlatformDispatchDataKHR_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clIcdGetPlatformIDsKHR( + cl_uint num_entries, + cl_platform_id* platforms, + cl_uint* num_platforms) ; + +extern CL_API_ENTRY void* CL_API_CALL +clIcdGetFunctionAddressForPlatformKHR( + cl_platform_id platform, + const char* func_name) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clIcdSetPlatformDispatchDataKHR( + cl_platform_id platform, + void* dispatch_data) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_khr_il_program +***************************************************************/ +#define cl_khr_il_program 1 +#define CL_KHR_IL_PROGRAM_EXTENSION_NAME \ + "cl_khr_il_program" + + +#define CL_KHR_IL_PROGRAM_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_IL_VERSION_KHR 0x105B + +/* cl_program_info */ +#define CL_PROGRAM_IL_KHR 0x1169 + + +typedef cl_program CL_API_CALL +clCreateProgramWithILKHR_t( + cl_context context, + const void* il, + size_t length, + cl_int* errcode_ret); + +typedef clCreateProgramWithILKHR_t * +clCreateProgramWithILKHR_fn CL_API_SUFFIX__VERSION_1_2; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithILKHR( + cl_context context, + const void* il, + size_t length, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_khr_image2d_from_buffer +***************************************************************/ +#define cl_khr_image2d_from_buffer 1 +#define CL_KHR_IMAGE2D_FROM_BUFFER_EXTENSION_NAME \ + "cl_khr_image2d_from_buffer" + + +#define CL_KHR_IMAGE2D_FROM_BUFFER_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_IMAGE_PITCH_ALIGNMENT_KHR 0x104A +#define CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR 0x104B + +/*************************************************************** +* cl_khr_initialize_memory +***************************************************************/ +#define cl_khr_initialize_memory 1 +#define CL_KHR_INITIALIZE_MEMORY_EXTENSION_NAME \ + "cl_khr_initialize_memory" + + +#define CL_KHR_INITIALIZE_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef cl_bitfield cl_context_memory_initialize_khr; + +/* cl_context_properties */ +#define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x2030 + +/* cl_context_memory_initialize_khr */ +#define CL_CONTEXT_MEMORY_INITIALIZE_LOCAL_KHR (1 << 0) +#define CL_CONTEXT_MEMORY_INITIALIZE_PRIVATE_KHR (1 << 1) + +/*************************************************************** +* cl_khr_terminate_context +***************************************************************/ +#define cl_khr_terminate_context 1 +#define CL_KHR_TERMINATE_CONTEXT_EXTENSION_NAME \ + "cl_khr_terminate_context" + + +#define CL_KHR_TERMINATE_CONTEXT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef cl_bitfield cl_device_terminate_capability_khr; + +/* cl_device_info */ +#define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x2031 + +/* cl_context_properties */ +#define CL_CONTEXT_TERMINATE_KHR 0x2032 + +/* cl_device_terminate_capability_khr */ +#define CL_DEVICE_TERMINATE_CAPABILITY_CONTEXT_KHR (1 << 0) + +/* Error codes */ +#define CL_CONTEXT_TERMINATED_KHR -1121 + + +typedef cl_int CL_API_CALL +clTerminateContextKHR_t( + cl_context context); + +typedef clTerminateContextKHR_t * +clTerminateContextKHR_fn CL_API_SUFFIX__VERSION_1_2; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clTerminateContextKHR( + cl_context context) CL_API_SUFFIX__VERSION_1_2; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_khr_spir +***************************************************************/ +#define cl_khr_spir 1 +#define CL_KHR_SPIR_EXTENSION_NAME \ + "cl_khr_spir" + + +#define CL_KHR_SPIR_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_SPIR_VERSIONS 0x40E0 + +/* cl_program_binary_type */ +#define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE 0x40E1 + +/*************************************************************** +* cl_khr_create_command_queue +***************************************************************/ +#define cl_khr_create_command_queue 1 +#define CL_KHR_CREATE_COMMAND_QUEUE_EXTENSION_NAME \ + "cl_khr_create_command_queue" + + +#define CL_KHR_CREATE_COMMAND_QUEUE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef cl_properties cl_queue_properties_khr; + + +typedef cl_command_queue CL_API_CALL +clCreateCommandQueueWithPropertiesKHR_t( + cl_context context, + cl_device_id device, + const cl_queue_properties_khr* properties, + cl_int* errcode_ret); + +typedef clCreateCommandQueueWithPropertiesKHR_t * +clCreateCommandQueueWithPropertiesKHR_fn CL_API_SUFFIX__VERSION_1_2; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_command_queue CL_API_CALL +clCreateCommandQueueWithPropertiesKHR( + cl_context context, + cl_device_id device, + const cl_queue_properties_khr* properties, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_nv_device_attribute_query +***************************************************************/ +#define cl_nv_device_attribute_query 1 +#define CL_NV_DEVICE_ATTRIBUTE_QUERY_EXTENSION_NAME \ + "cl_nv_device_attribute_query" + + +#define CL_NV_DEVICE_ATTRIBUTE_QUERY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000 +#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001 +#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002 +#define CL_DEVICE_WARP_SIZE_NV 0x4003 +#define CL_DEVICE_GPU_OVERLAP_NV 0x4004 +#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005 +#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006 + +/*************************************************************** +* cl_amd_device_attribute_query +***************************************************************/ +#define cl_amd_device_attribute_query 1 +#define CL_AMD_DEVICE_ATTRIBUTE_QUERY_EXTENSION_NAME \ + "cl_amd_device_attribute_query" + + +#define CL_AMD_DEVICE_ATTRIBUTE_QUERY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036 +#define CL_DEVICE_TOPOLOGY_AMD 0x4037 +#define CL_DEVICE_BOARD_NAME_AMD 0x4038 +#define CL_DEVICE_GLOBAL_FREE_MEMORY_AMD 0x4039 +#define CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD 0x4040 +#define CL_DEVICE_SIMD_WIDTH_AMD 0x4041 +#define CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD 0x4042 +#define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043 +#define CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD 0x4044 +#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD 0x4045 +#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD 0x4046 +#define CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD 0x4047 +#define CL_DEVICE_LOCAL_MEM_BANKS_AMD 0x4048 +#define CL_DEVICE_THREAD_TRACE_SUPPORTED_AMD 0x4049 +#define CL_DEVICE_GFXIP_MAJOR_AMD 0x404A +#define CL_DEVICE_GFXIP_MINOR_AMD 0x404B +#define CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD 0x404C +#define CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_AMD 0x4030 +#define CL_DEVICE_MAX_WORK_GROUP_SIZE_AMD 0x4031 +#define CL_DEVICE_PREFERRED_CONSTANT_BUFFER_SIZE_AMD 0x4033 +#define CL_DEVICE_PCIE_ID_AMD 0x4034 + +/*************************************************************** +* cl_arm_printf +***************************************************************/ +#define cl_arm_printf 1 +#define CL_ARM_PRINTF_EXTENSION_NAME \ + "cl_arm_printf" + + +#define CL_ARM_PRINTF_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_context_properties */ +#define CL_PRINTF_CALLBACK_ARM 0x40B0 +#define CL_PRINTF_BUFFERSIZE_ARM 0x40B1 + +/*************************************************************** +* cl_ext_device_fission +***************************************************************/ +#define cl_ext_device_fission 1 +#define CL_EXT_DEVICE_FISSION_EXTENSION_NAME \ + "cl_ext_device_fission" + + +#define CL_EXT_DEVICE_FISSION_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef cl_ulong cl_device_partition_property_ext; + +/* Error codes */ +#define CL_DEVICE_PARTITION_FAILED_EXT -1057 +#define CL_INVALID_PARTITION_COUNT_EXT -1058 +#define CL_INVALID_PARTITION_NAME_EXT -1059 + +/* cl_device_info */ +#define CL_DEVICE_PARENT_DEVICE_EXT 0x4054 +#define CL_DEVICE_PARTITION_TYPES_EXT 0x4055 +#define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056 +#define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057 +#define CL_DEVICE_PARTITION_STYLE_EXT 0x4058 + +/* cl_device_partition_property_ext */ +#define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050 +#define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051 +#define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052 +#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053 + +/* cl_device_partition_property_ext - affinity domains */ +#define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1 +#define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2 +#define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3 +#define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4 +#define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10 +#define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100 + +/* cl_device_partition_property_ext - list terminators */ +#define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext)0) +#define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext)0) +#define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext)0 - 1) + + +typedef cl_int CL_API_CALL +clReleaseDeviceEXT_t( + cl_device_id device); + +typedef clReleaseDeviceEXT_t * +clReleaseDeviceEXT_fn CL_API_SUFFIX__VERSION_1_1; + +typedef cl_int CL_API_CALL +clRetainDeviceEXT_t( + cl_device_id device); + +typedef clRetainDeviceEXT_t * +clRetainDeviceEXT_fn CL_API_SUFFIX__VERSION_1_1; + +typedef cl_int CL_API_CALL +clCreateSubDevicesEXT_t( + 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); + +typedef clCreateSubDevicesEXT_t * +clCreateSubDevicesEXT_fn CL_API_SUFFIX__VERSION_1_1; + +#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clReleaseDeviceEXT( + cl_device_id device) CL_API_SUFFIX__VERSION_1_1; + +extern CL_API_ENTRY cl_int CL_API_CALL +clRetainDeviceEXT( + cl_device_id device) CL_API_SUFFIX__VERSION_1_1; + +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 /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_ext_migrate_memobject +***************************************************************/ +#define cl_ext_migrate_memobject 1 +#define CL_EXT_MIGRATE_MEMOBJECT_EXTENSION_NAME \ + "cl_ext_migrate_memobject" + + +#define CL_EXT_MIGRATE_MEMOBJECT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef cl_bitfield cl_mem_migration_flags_ext; + +/* cl_mem_migration_flags_ext */ +#define CL_MIGRATE_MEM_OBJECT_HOST_EXT (1 << 0) + +/* cl_command_type */ +#define CL_COMMAND_MIGRATE_MEM_OBJECT_EXT 0x4040 + + +typedef cl_int CL_API_CALL +clEnqueueMigrateMemObjectEXT_t( + cl_command_queue command_queue, + cl_uint num_mem_objects, + const cl_mem* mem_objects, + cl_mem_migration_flags_ext flags, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueMigrateMemObjectEXT_t * +clEnqueueMigrateMemObjectEXT_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueMigrateMemObjectEXT( + cl_command_queue command_queue, + cl_uint num_mem_objects, + const cl_mem* mem_objects, + cl_mem_migration_flags_ext flags, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_ext_cxx_for_opencl +***************************************************************/ +#define cl_ext_cxx_for_opencl 1 +#define CL_EXT_CXX_FOR_OPENCL_EXTENSION_NAME \ + "cl_ext_cxx_for_opencl" + + +#define CL_EXT_CXX_FOR_OPENCL_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_CXX_FOR_OPENCL_NUMERIC_VERSION_EXT 0x4230 + +/*************************************************************** +* cl_qcom_ext_host_ptr +***************************************************************/ +#define cl_qcom_ext_host_ptr 1 +#define CL_QCOM_EXT_HOST_PTR_EXTENSION_NAME \ + "cl_qcom_ext_host_ptr" + + +#define CL_QCOM_EXT_HOST_PTR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +typedef cl_uint cl_image_pitch_info_qcom; +typedef struct _cl_mem_ext_host_ptr { + cl_uint allocation_type; + cl_uint host_cache_policy; +} cl_mem_ext_host_ptr; + +/* cl_mem_flags */ +#define CL_MEM_EXT_HOST_PTR_QCOM (1 << 29) + +/* cl_device_info */ +#define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM 0x40A0 +#define CL_DEVICE_PAGE_SIZE_QCOM 0x40A1 + +/* cl_image_pitch_info_qcom */ +#define CL_IMAGE_ROW_ALIGNMENT_QCOM 0x40A2 +#define CL_IMAGE_SLICE_ALIGNMENT_QCOM 0x40A3 + +/* cl_uint host_cache_policy */ +#define CL_MEM_HOST_UNCACHED_QCOM 0x40A4 +#define CL_MEM_HOST_WRITEBACK_QCOM 0x40A5 +#define CL_MEM_HOST_WRITETHROUGH_QCOM 0x40A6 +#define CL_MEM_HOST_WRITE_COMBINING_QCOM 0x40A7 + + +typedef cl_int CL_API_CALL +clGetDeviceImageInfoQCOM_t( + cl_device_id device, + size_t image_width, + size_t image_height, + const cl_image_format* image_format, + cl_image_pitch_info_qcom param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetDeviceImageInfoQCOM_t * +clGetDeviceImageInfoQCOM_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetDeviceImageInfoQCOM( + cl_device_id device, + size_t image_width, + size_t image_height, + const cl_image_format* image_format, + cl_image_pitch_info_qcom param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_qcom_ext_host_ptr_iocoherent +***************************************************************/ +#define cl_qcom_ext_host_ptr_iocoherent 1 +#define CL_QCOM_EXT_HOST_PTR_IOCOHERENT_EXTENSION_NAME \ + "cl_qcom_ext_host_ptr_iocoherent" + + +#define CL_QCOM_EXT_HOST_PTR_IOCOHERENT_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_uint host_cache_policy */ +#define CL_MEM_HOST_IOCOHERENT_QCOM 0x40A9 + +/*************************************************************** +* cl_qcom_ion_host_ptr +***************************************************************/ +#define cl_qcom_ion_host_ptr 1 +#define CL_QCOM_ION_HOST_PTR_EXTENSION_NAME \ + "cl_qcom_ion_host_ptr" + + +#define CL_QCOM_ION_HOST_PTR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* type cl_mem_ext_host_ptr */ +typedef struct _cl_mem_ion_host_ptr { + cl_mem_ext_host_ptr ext_host_ptr; + int ion_filedesc; + void* ion_hostptr; +} cl_mem_ion_host_ptr; + +/* cl_uint allocation_type */ +#define CL_MEM_ION_HOST_PTR_QCOM 0x40A8 + +/*************************************************************** +* cl_qcom_android_native_buffer_host_ptr +***************************************************************/ +#define cl_qcom_android_native_buffer_host_ptr 1 +#define CL_QCOM_ANDROID_NATIVE_BUFFER_HOST_PTR_EXTENSION_NAME \ + "cl_qcom_android_native_buffer_host_ptr" + + +#define CL_QCOM_ANDROID_NATIVE_BUFFER_HOST_PTR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* type cl_mem_ext_host_ptr */ +typedef struct _cl_mem_android_native_buffer_host_ptr { + cl_mem_ext_host_ptr ext_host_ptr; + void* anb_ptr; +} cl_mem_android_native_buffer_host_ptr; + +/* cl_uint allocation_type */ +#define CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM 0x40C6 + +/*************************************************************** +* cl_img_yuv_image +***************************************************************/ +#define cl_img_yuv_image 1 +#define CL_IMG_YUV_IMAGE_EXTENSION_NAME \ + "cl_img_yuv_image" + + +#define CL_IMG_YUV_IMAGE_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_channel_order */ +#define CL_NV21_IMG 0x40D0 +#define CL_YV12_IMG 0x40D1 + +/*************************************************************** +* cl_img_cached_allocations +***************************************************************/ +#define cl_img_cached_allocations 1 +#define CL_IMG_CACHED_ALLOCATIONS_EXTENSION_NAME \ + "cl_img_cached_allocations" + + +#define CL_IMG_CACHED_ALLOCATIONS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_mem_flags */ +#define CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG (1 << 26) +#define CL_MEM_USE_CACHED_CPU_MEMORY_IMG (1 << 27) + +/*************************************************************** +* cl_img_use_gralloc_ptr +***************************************************************/ +#define cl_img_use_gralloc_ptr 1 +#define CL_IMG_USE_GRALLOC_PTR_EXTENSION_NAME \ + "cl_img_use_gralloc_ptr" + + +#define CL_IMG_USE_GRALLOC_PTR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* Error codes */ +#define CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG 0x40D4 +#define CL_INVALID_GRALLOC_OBJECT_IMG 0x40D5 + +/* cl_mem_flags */ +#define CL_MEM_USE_GRALLOC_PTR_IMG (1 << 28) + +/* cl_command_type */ +#define CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG 0x40D2 +#define CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG 0x40D3 + + +typedef cl_int CL_API_CALL +clEnqueueAcquireGrallocObjectsIMG_t( + 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 clEnqueueAcquireGrallocObjectsIMG_t * +clEnqueueAcquireGrallocObjectsIMG_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clEnqueueReleaseGrallocObjectsIMG_t( + 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 clEnqueueReleaseGrallocObjectsIMG_t * +clEnqueueReleaseGrallocObjectsIMG_fn CL_API_SUFFIX__VERSION_1_2; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueAcquireGrallocObjectsIMG( + 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_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReleaseGrallocObjectsIMG( + 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_2; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_img_generate_mipmap +***************************************************************/ +#define cl_img_generate_mipmap 1 +#define CL_IMG_GENERATE_MIPMAP_EXTENSION_NAME \ + "cl_img_generate_mipmap" + + +#define CL_IMG_GENERATE_MIPMAP_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +typedef cl_uint cl_mipmap_filter_mode_img; + +/* cl_mipmap_filter_mode_img */ +#define CL_MIPMAP_FILTER_ANY_IMG 0x0 +#define CL_MIPMAP_FILTER_BOX_IMG 0x1 + +/* cl_command_type */ +#define CL_COMMAND_GENERATE_MIPMAP_IMG 0x40D6 + + +typedef cl_int CL_API_CALL +clEnqueueGenerateMipmapIMG_t( + cl_command_queue command_queue, + cl_mem src_image, + cl_mem dst_image, + cl_mipmap_filter_mode_img mipmap_filter_mode, + const size_t* array_region, + const size_t* mip_region, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueGenerateMipmapIMG_t * +clEnqueueGenerateMipmapIMG_fn CL_API_SUFFIX__VERSION_1_2; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueGenerateMipmapIMG( + cl_command_queue command_queue, + cl_mem src_image, + cl_mem dst_image, + cl_mipmap_filter_mode_img mipmap_filter_mode, + const size_t* array_region, + const size_t* mip_region, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event) CL_API_SUFFIX__VERSION_1_2; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_img_mem_properties +***************************************************************/ +#define cl_img_mem_properties 1 +#define CL_IMG_MEM_PROPERTIES_EXTENSION_NAME \ + "cl_img_mem_properties" + + +#define CL_IMG_MEM_PROPERTIES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_mem_properties */ +#define CL_MEM_ALLOC_FLAGS_IMG 0x40D7 + +/* cl_mem_alloc_flags_img */ +#define CL_MEM_ALLOC_RELAX_REQUIREMENTS_IMG (1 << 0) +#define CL_MEM_ALLOC_GPU_WRITE_COMBINE_IMG (1 << 1) +#define CL_MEM_ALLOC_GPU_CACHED_IMG (1 << 2) +#define CL_MEM_ALLOC_CPU_LOCAL_IMG (1 << 3) +#define CL_MEM_ALLOC_GPU_LOCAL_IMG (1 << 4) +#define CL_MEM_ALLOC_GPU_PRIVATE_IMG (1 << 5) + +/* cl_device_info */ +#define CL_DEVICE_MEMORY_CAPABILITIES_IMG 0x40D8 + +/*************************************************************** +* cl_khr_subgroups +***************************************************************/ +#define cl_khr_subgroups 1 +#define CL_KHR_SUBGROUPS_EXTENSION_NAME \ + "cl_khr_subgroups" + + +#define CL_KHR_SUBGROUPS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +#if !defined(CL_VERSION_2_1) +/* defined in CL.h for OpenCL 2.1 and newer */ +typedef cl_uint cl_kernel_sub_group_info; + +#endif /* !defined(CL_VERSION_2_1) */ + +/* 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 + + +typedef cl_int CL_API_CALL +clGetKernelSubGroupInfoKHR_t( + 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); + +typedef clGetKernelSubGroupInfoKHR_t * +clGetKernelSubGroupInfoKHR_fn CL_API_SUFFIX__VERSION_2_0_DEPRECATED; + +#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern 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) CL_API_SUFFIX__VERSION_2_0_DEPRECATED; + +#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_khr_mipmap_image +***************************************************************/ +#define cl_khr_mipmap_image 1 +#define CL_KHR_MIPMAP_IMAGE_EXTENSION_NAME \ + "cl_khr_mipmap_image" + + +#define CL_KHR_MIPMAP_IMAGE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_sampler_properties */ +#define CL_SAMPLER_MIP_FILTER_MODE_KHR 0x1155 +#define CL_SAMPLER_LOD_MIN_KHR 0x1156 +#define CL_SAMPLER_LOD_MAX_KHR 0x1157 + +/*************************************************************** +* cl_khr_priority_hints +***************************************************************/ +#define cl_khr_priority_hints 1 +#define CL_KHR_PRIORITY_HINTS_EXTENSION_NAME \ + "cl_khr_priority_hints" + + +#define CL_KHR_PRIORITY_HINTS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* To be used by clGetEventInfo */ +typedef cl_uint cl_queue_priority_khr; + +/* cl_queue_properties */ +#define CL_QUEUE_PRIORITY_KHR 0x1096 + +/* cl_queue_priority_khr */ +#define CL_QUEUE_PRIORITY_HIGH_KHR (1 << 0) +#define CL_QUEUE_PRIORITY_MED_KHR (1 << 1) +#define CL_QUEUE_PRIORITY_LOW_KHR (1 << 2) + +/*************************************************************** +* cl_khr_throttle_hints +***************************************************************/ +#define cl_khr_throttle_hints 1 +#define CL_KHR_THROTTLE_HINTS_EXTENSION_NAME \ + "cl_khr_throttle_hints" + + +#define CL_KHR_THROTTLE_HINTS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* To be used by clGetEventInfo */ +typedef cl_uint cl_queue_throttle_khr; + +/* cl_queue_properties */ +#define CL_QUEUE_THROTTLE_KHR 0x1097 + +/* cl_queue_throttle_khr */ +#define CL_QUEUE_THROTTLE_HIGH_KHR (1 << 0) +#define CL_QUEUE_THROTTLE_MED_KHR (1 << 1) +#define CL_QUEUE_THROTTLE_LOW_KHR (1 << 2) + +/*************************************************************** +* cl_khr_subgroup_named_barrier +***************************************************************/ +#define cl_khr_subgroup_named_barrier 1 +#define CL_KHR_SUBGROUP_NAMED_BARRIER_EXTENSION_NAME \ + "cl_khr_subgroup_named_barrier" + + +#define CL_KHR_SUBGROUP_NAMED_BARRIER_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_MAX_NAMED_BARRIER_COUNT_KHR 0x2035 + +/*************************************************************** +* cl_khr_extended_versioning +***************************************************************/ +#define cl_khr_extended_versioning 1 +#define CL_KHR_EXTENDED_VERSIONING_EXTENSION_NAME \ + "cl_khr_extended_versioning" + + +#define CL_KHR_EXTENDED_VERSIONING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +#define CL_VERSION_MAJOR_BITS_KHR 10 +#define CL_VERSION_MINOR_BITS_KHR 10 +#define CL_VERSION_PATCH_BITS_KHR 12 + +#define CL_VERSION_MAJOR_MASK_KHR ((1 << CL_VERSION_MAJOR_BITS_KHR) - 1) +#define CL_VERSION_MINOR_MASK_KHR ((1 << CL_VERSION_MINOR_BITS_KHR) - 1) +#define CL_VERSION_PATCH_MASK_KHR ((1 << CL_VERSION_PATCH_BITS_KHR) - 1) + +#define CL_VERSION_MAJOR_KHR(version) ((version) >> (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR)) +#define CL_VERSION_MINOR_KHR(version) (((version) >> CL_VERSION_PATCH_BITS_KHR) & CL_VERSION_MINOR_MASK_KHR) +#define CL_VERSION_PATCH_KHR(version) ((version) & CL_VERSION_PATCH_MASK_KHR) + +#define CL_MAKE_VERSION_KHR(major, minor, patch) \ + ((((major) & CL_VERSION_MAJOR_MASK_KHR) << (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR)) | \ + (((minor) & CL_VERSION_MINOR_MASK_KHR) << CL_VERSION_PATCH_BITS_KHR) | \ + ((patch) & CL_VERSION_PATCH_MASK_KHR)) + +#define CL_NAME_VERSION_MAX_NAME_SIZE_KHR 64 + +typedef cl_uint cl_version_khr; +typedef struct _cl_name_version_khr { + cl_version_khr version; + char name[CL_NAME_VERSION_MAX_NAME_SIZE_KHR]; +} cl_name_version_khr; + +/* cl_platform_info */ +#define CL_PLATFORM_NUMERIC_VERSION_KHR 0x0906 +#define CL_PLATFORM_EXTENSIONS_WITH_VERSION_KHR 0x0907 + +/* cl_device_info */ +#define CL_DEVICE_NUMERIC_VERSION_KHR 0x105E +#define CL_DEVICE_OPENCL_C_NUMERIC_VERSION_KHR 0x105F +#define CL_DEVICE_EXTENSIONS_WITH_VERSION_KHR 0x1060 +#define CL_DEVICE_ILS_WITH_VERSION_KHR 0x1061 +#define CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION_KHR 0x1062 + +/*************************************************************** +* cl_khr_device_uuid +***************************************************************/ +#define cl_khr_device_uuid 1 +#define CL_KHR_DEVICE_UUID_EXTENSION_NAME \ + "cl_khr_device_uuid" + + +#define CL_KHR_DEVICE_UUID_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* Size Constants */ +#define CL_UUID_SIZE_KHR 16 +#define CL_LUID_SIZE_KHR 8 + +/* cl_device_info */ +#define CL_DEVICE_UUID_KHR 0x106A +#define CL_DRIVER_UUID_KHR 0x106B +#define CL_DEVICE_LUID_VALID_KHR 0x106C +#define CL_DEVICE_LUID_KHR 0x106D +#define CL_DEVICE_NODE_MASK_KHR 0x106E + +/*************************************************************** +* cl_khr_pci_bus_info +***************************************************************/ +#define cl_khr_pci_bus_info 1 +#define CL_KHR_PCI_BUS_INFO_EXTENSION_NAME \ + "cl_khr_pci_bus_info" + + +#define CL_KHR_PCI_BUS_INFO_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef struct _cl_device_pci_bus_info_khr { + cl_uint pci_domain; + cl_uint pci_bus; + cl_uint pci_device; + cl_uint pci_function; +} cl_device_pci_bus_info_khr; + +/* cl_device_info */ +#define CL_DEVICE_PCI_BUS_INFO_KHR 0x410F + +/*************************************************************** +* cl_khr_suggested_local_work_size +***************************************************************/ +#define cl_khr_suggested_local_work_size 1 +#define CL_KHR_SUGGESTED_LOCAL_WORK_SIZE_EXTENSION_NAME \ + "cl_khr_suggested_local_work_size" + + +#define CL_KHR_SUGGESTED_LOCAL_WORK_SIZE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + + +typedef cl_int CL_API_CALL +clGetKernelSuggestedLocalWorkSizeKHR_t( + cl_command_queue command_queue, + cl_kernel kernel, + cl_uint work_dim, + const size_t* global_work_offset, + const size_t* global_work_size, + size_t* suggested_local_work_size); + +typedef clGetKernelSuggestedLocalWorkSizeKHR_t * +clGetKernelSuggestedLocalWorkSizeKHR_fn CL_API_SUFFIX__VERSION_3_0; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetKernelSuggestedLocalWorkSizeKHR( + cl_command_queue command_queue, + cl_kernel kernel, + cl_uint work_dim, + const size_t* global_work_offset, + const size_t* global_work_size, + size_t* suggested_local_work_size) CL_API_SUFFIX__VERSION_3_0; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_khr_integer_dot_product +***************************************************************/ +#define cl_khr_integer_dot_product 1 +#define CL_KHR_INTEGER_DOT_PRODUCT_EXTENSION_NAME \ + "cl_khr_integer_dot_product" + + +#define CL_KHR_INTEGER_DOT_PRODUCT_EXTENSION_VERSION CL_MAKE_VERSION(2, 0, 0) + +typedef cl_bitfield cl_device_integer_dot_product_capabilities_khr; +typedef struct _cl_device_integer_dot_product_acceleration_properties_khr { + cl_bool signed_accelerated; + cl_bool unsigned_accelerated; + cl_bool mixed_signedness_accelerated; + cl_bool accumulating_saturating_signed_accelerated; + cl_bool accumulating_saturating_unsigned_accelerated; + cl_bool accumulating_saturating_mixed_signedness_accelerated; +} cl_device_integer_dot_product_acceleration_properties_khr; + +/* cl_device_integer_dot_product_capabilities_khr */ +#define CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED_KHR (1 << 0) +#define CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_KHR (1 << 1) + +/* cl_device_info */ +#define CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIES_KHR 0x1073 +#define CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT_KHR 0x1074 +#define CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_4x8BIT_PACKED_KHR 0x1075 + +/*************************************************************** +* cl_khr_external_memory +***************************************************************/ +#define cl_khr_external_memory 1 +#define CL_KHR_EXTERNAL_MEMORY_EXTENSION_NAME \ + "cl_khr_external_memory" + + +#define CL_KHR_EXTERNAL_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 1) + +typedef cl_uint cl_external_memory_handle_type_khr; + +/* cl_platform_info */ +#define CL_PLATFORM_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR 0x2044 + +/* cl_device_info */ +#define CL_DEVICE_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR 0x204F +#define CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR 0x2052 + +/* cl_mem_properties */ +#define CL_MEM_DEVICE_HANDLE_LIST_KHR 0x2051 +#define CL_MEM_DEVICE_HANDLE_LIST_END_KHR 0 + +/* cl_command_type */ +#define CL_COMMAND_ACQUIRE_EXTERNAL_MEM_OBJECTS_KHR 0x2047 +#define CL_COMMAND_RELEASE_EXTERNAL_MEM_OBJECTS_KHR 0x2048 + + +typedef cl_int CL_API_CALL +clEnqueueAcquireExternalMemObjectsKHR_t( + cl_command_queue command_queue, + cl_uint num_mem_objects, + const cl_mem* mem_objects, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueAcquireExternalMemObjectsKHR_t * +clEnqueueAcquireExternalMemObjectsKHR_fn CL_API_SUFFIX__VERSION_3_0; + +typedef cl_int CL_API_CALL +clEnqueueReleaseExternalMemObjectsKHR_t( + cl_command_queue command_queue, + cl_uint num_mem_objects, + const cl_mem* mem_objects, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueReleaseExternalMemObjectsKHR_t * +clEnqueueReleaseExternalMemObjectsKHR_fn CL_API_SUFFIX__VERSION_3_0; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueAcquireExternalMemObjectsKHR( + cl_command_queue command_queue, + cl_uint num_mem_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_3_0; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReleaseExternalMemObjectsKHR( + cl_command_queue command_queue, + cl_uint num_mem_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_3_0; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_khr_external_memory_dma_buf +***************************************************************/ +#define cl_khr_external_memory_dma_buf 1 +#define CL_KHR_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME \ + "cl_khr_external_memory_dma_buf" + + +#define CL_KHR_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_external_memory_handle_type_khr */ +#define CL_EXTERNAL_MEMORY_HANDLE_DMA_BUF_KHR 0x2067 + +/*************************************************************** +* cl_khr_external_memory_opaque_fd +***************************************************************/ +#define cl_khr_external_memory_opaque_fd 1 +#define CL_KHR_EXTERNAL_MEMORY_OPAQUE_FD_EXTENSION_NAME \ + "cl_khr_external_memory_opaque_fd" + + +#define CL_KHR_EXTERNAL_MEMORY_OPAQUE_FD_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_external_memory_handle_type_khr */ +#define CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR 0x2060 + +/*************************************************************** +* cl_khr_external_memory_win32 +***************************************************************/ +#define cl_khr_external_memory_win32 1 +#define CL_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME \ + "cl_khr_external_memory_win32" + + +#define CL_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_VERSION CL_MAKE_VERSION(1, 1, 0) + +/* cl_external_memory_handle_type_khr */ +#define CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR 0x2061 +#define CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KMT_KHR 0x2062 +#define CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_NAME_KHR 0x2069 + +/*************************************************************** +* cl_khr_external_semaphore +***************************************************************/ +#define cl_khr_external_semaphore 1 +#define CL_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME \ + "cl_khr_external_semaphore" + + +#define CL_KHR_EXTERNAL_SEMAPHORE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 1) + +typedef struct _cl_semaphore_khr * cl_semaphore_khr; +typedef cl_uint cl_external_semaphore_handle_type_khr; + +/* cl_platform_info */ +#define CL_PLATFORM_SEMAPHORE_IMPORT_HANDLE_TYPES_KHR 0x2037 +#define CL_PLATFORM_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR 0x2038 + +/* cl_device_info */ +#define CL_DEVICE_SEMAPHORE_IMPORT_HANDLE_TYPES_KHR 0x204D +#define CL_DEVICE_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR 0x204E + +/* cl_semaphore_properties_khr */ +#define CL_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR 0x203F +#define CL_SEMAPHORE_EXPORT_HANDLE_TYPES_LIST_END_KHR 0 + +/* cl_semaphore_info_khr */ +#define CL_SEMAPHORE_EXPORTABLE_KHR 0x2054 + + +typedef cl_int CL_API_CALL +clGetSemaphoreHandleForTypeKHR_t( + cl_semaphore_khr sema_object, + cl_device_id device, + cl_external_semaphore_handle_type_khr handle_type, + size_t handle_size, + void* handle_ptr, + size_t* handle_size_ret); + +typedef clGetSemaphoreHandleForTypeKHR_t * +clGetSemaphoreHandleForTypeKHR_fn CL_API_SUFFIX__VERSION_1_2; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetSemaphoreHandleForTypeKHR( + cl_semaphore_khr sema_object, + cl_device_id device, + cl_external_semaphore_handle_type_khr handle_type, + size_t handle_size, + void* handle_ptr, + size_t* handle_size_ret) CL_API_SUFFIX__VERSION_1_2; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_khr_external_semaphore_dx_fence (beta) +***************************************************************/ +#if defined(CL_ENABLE_BETA_EXTENSIONS) + +#define cl_khr_external_semaphore_dx_fence 1 +#define CL_KHR_EXTERNAL_SEMAPHORE_DX_FENCE_EXTENSION_NAME \ + "cl_khr_external_semaphore_dx_fence" + + +#define CL_KHR_EXTERNAL_SEMAPHORE_DX_FENCE_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 0) + +/* cl_external_semaphore_handle_type_khr */ +#define CL_SEMAPHORE_HANDLE_D3D12_FENCE_KHR 0x2059 + +#endif /* defined(CL_ENABLE_BETA_EXTENSIONS) */ + +/*************************************************************** +* cl_khr_external_semaphore_opaque_fd +***************************************************************/ +#define cl_khr_external_semaphore_opaque_fd 1 +#define CL_KHR_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXTENSION_NAME \ + "cl_khr_external_semaphore_opaque_fd" + + +#define CL_KHR_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_external_semaphore_handle_type_khr */ +#define CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR 0x2055 + +/*************************************************************** +* cl_khr_external_semaphore_sync_fd +***************************************************************/ +#define cl_khr_external_semaphore_sync_fd 1 +#define CL_KHR_EXTERNAL_SEMAPHORE_SYNC_FD_EXTENSION_NAME \ + "cl_khr_external_semaphore_sync_fd" + + +#define CL_KHR_EXTERNAL_SEMAPHORE_SYNC_FD_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef cl_properties cl_semaphore_reimport_properties_khr; + +/* cl_external_semaphore_handle_type_khr */ +#define CL_SEMAPHORE_HANDLE_SYNC_FD_KHR 0x2058 + + +typedef cl_int CL_API_CALL +clReImportSemaphoreSyncFdKHR_t( + cl_semaphore_khr sema_object, + cl_semaphore_reimport_properties_khr* reimport_props, + int fd); + +typedef clReImportSemaphoreSyncFdKHR_t * +clReImportSemaphoreSyncFdKHR_fn CL_API_SUFFIX__VERSION_3_0; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clReImportSemaphoreSyncFdKHR( + cl_semaphore_khr sema_object, + cl_semaphore_reimport_properties_khr* reimport_props, + int fd) CL_API_SUFFIX__VERSION_3_0; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_khr_external_semaphore_win32 (beta) +***************************************************************/ +#if defined(CL_ENABLE_BETA_EXTENSIONS) + +#define cl_khr_external_semaphore_win32 1 +#define CL_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME \ + "cl_khr_external_semaphore_win32" + + +#define CL_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 1) + +/* cl_external_semaphore_handle_type_khr */ +#define CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR 0x2056 +#define CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR 0x2057 +#define CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_NAME_KHR 0x2068 + +#endif /* defined(CL_ENABLE_BETA_EXTENSIONS) */ + +/*************************************************************** +* cl_khr_semaphore +***************************************************************/ +#define cl_khr_semaphore 1 +#define CL_KHR_SEMAPHORE_EXTENSION_NAME \ + "cl_khr_semaphore" + + +#define CL_KHR_SEMAPHORE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* type cl_semaphore_khr */ +typedef cl_properties cl_semaphore_properties_khr; +typedef cl_uint cl_semaphore_info_khr; +typedef cl_uint cl_semaphore_type_khr; +typedef cl_ulong cl_semaphore_payload_khr; + +/* cl_semaphore_type */ +#define CL_SEMAPHORE_TYPE_BINARY_KHR 1 + +/* cl_platform_info */ +#define CL_PLATFORM_SEMAPHORE_TYPES_KHR 0x2036 + +/* cl_device_info */ +#define CL_DEVICE_SEMAPHORE_TYPES_KHR 0x204C + +/* cl_semaphore_info_khr */ +#define CL_SEMAPHORE_CONTEXT_KHR 0x2039 +#define CL_SEMAPHORE_REFERENCE_COUNT_KHR 0x203A +#define CL_SEMAPHORE_PROPERTIES_KHR 0x203B +#define CL_SEMAPHORE_PAYLOAD_KHR 0x203C + +/* cl_semaphore_info_khr or cl_semaphore_properties_khr */ +#define CL_SEMAPHORE_TYPE_KHR 0x203D +#define CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR 0x2053 +#define CL_SEMAPHORE_DEVICE_HANDLE_LIST_END_KHR 0 + +/* cl_command_type */ +#define CL_COMMAND_SEMAPHORE_WAIT_KHR 0x2042 +#define CL_COMMAND_SEMAPHORE_SIGNAL_KHR 0x2043 + +/* Error codes */ +#define CL_INVALID_SEMAPHORE_KHR -1142 + + +typedef cl_semaphore_khr CL_API_CALL +clCreateSemaphoreWithPropertiesKHR_t( + cl_context context, + const cl_semaphore_properties_khr* sema_props, + cl_int* errcode_ret); + +typedef clCreateSemaphoreWithPropertiesKHR_t * +clCreateSemaphoreWithPropertiesKHR_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clEnqueueWaitSemaphoresKHR_t( + cl_command_queue command_queue, + cl_uint num_sema_objects, + const cl_semaphore_khr* sema_objects, + const cl_semaphore_payload_khr* sema_payload_list, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueWaitSemaphoresKHR_t * +clEnqueueWaitSemaphoresKHR_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clEnqueueSignalSemaphoresKHR_t( + cl_command_queue command_queue, + cl_uint num_sema_objects, + const cl_semaphore_khr* sema_objects, + const cl_semaphore_payload_khr* sema_payload_list, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueSignalSemaphoresKHR_t * +clEnqueueSignalSemaphoresKHR_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clGetSemaphoreInfoKHR_t( + cl_semaphore_khr sema_object, + cl_semaphore_info_khr param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetSemaphoreInfoKHR_t * +clGetSemaphoreInfoKHR_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clReleaseSemaphoreKHR_t( + cl_semaphore_khr sema_object); + +typedef clReleaseSemaphoreKHR_t * +clReleaseSemaphoreKHR_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clRetainSemaphoreKHR_t( + cl_semaphore_khr sema_object); + +typedef clRetainSemaphoreKHR_t * +clRetainSemaphoreKHR_fn CL_API_SUFFIX__VERSION_1_2; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_semaphore_khr CL_API_CALL +clCreateSemaphoreWithPropertiesKHR( + cl_context context, + const cl_semaphore_properties_khr* sema_props, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueWaitSemaphoresKHR( + cl_command_queue command_queue, + cl_uint num_sema_objects, + const cl_semaphore_khr* sema_objects, + const cl_semaphore_payload_khr* sema_payload_list, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSignalSemaphoresKHR( + cl_command_queue command_queue, + cl_uint num_sema_objects, + const cl_semaphore_khr* sema_objects, + const cl_semaphore_payload_khr* sema_payload_list, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetSemaphoreInfoKHR( + cl_semaphore_khr sema_object, + cl_semaphore_info_khr param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clReleaseSemaphoreKHR( + cl_semaphore_khr sema_object) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clRetainSemaphoreKHR( + cl_semaphore_khr sema_object) CL_API_SUFFIX__VERSION_1_2; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_arm_import_memory +***************************************************************/ +#define cl_arm_import_memory 1 +#define CL_ARM_IMPORT_MEMORY_EXTENSION_NAME \ + "cl_arm_import_memory" + + +#define CL_ARM_IMPORT_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +typedef intptr_t cl_import_properties_arm; + +/* cl_import_properties_arm */ +#define CL_IMPORT_TYPE_ARM 0x40B2 +#define CL_IMPORT_TYPE_HOST_ARM 0x40B3 +#define CL_IMPORT_TYPE_DMA_BUF_ARM 0x40B4 +#define CL_IMPORT_TYPE_PROTECTED_ARM 0x40B5 +#define CL_IMPORT_TYPE_ANDROID_HARDWARE_BUFFER_ARM 0x41E2 +#define CL_IMPORT_DMA_BUF_DATA_CONSISTENCY_WITH_HOST_ARM 0x41E3 +#define CL_IMPORT_MEMORY_WHOLE_ALLOCATION_ARM SIZE_MAX +#define CL_IMPORT_ANDROID_HARDWARE_BUFFER_PLANE_INDEX_ARM 0x41EF +#define CL_IMPORT_ANDROID_HARDWARE_BUFFER_LAYER_INDEX_ARM 0x41F0 + + +typedef cl_mem CL_API_CALL +clImportMemoryARM_t( + cl_context context, + cl_mem_flags flags, + const cl_import_properties_arm* properties, + void* memory, + size_t size, + cl_int* errcode_ret); + +typedef clImportMemoryARM_t * +clImportMemoryARM_fn CL_API_SUFFIX__VERSION_1_0; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_mem CL_API_CALL +clImportMemoryARM( + cl_context context, + cl_mem_flags flags, + const cl_import_properties_arm* properties, + void* memory, + size_t size, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_arm_shared_virtual_memory +***************************************************************/ +#define cl_arm_shared_virtual_memory 1 +#define CL_ARM_SHARED_VIRTUAL_MEMORY_EXTENSION_NAME \ + "cl_arm_shared_virtual_memory" + + +#define CL_ARM_SHARED_VIRTUAL_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +typedef cl_bitfield cl_svm_mem_flags_arm; +typedef cl_uint cl_kernel_exec_info_arm; +typedef cl_bitfield cl_device_svm_capabilities_arm; + +/* cl_device_info */ +#define CL_DEVICE_SVM_CAPABILITIES_ARM 0x40B6 + +/* cl_mem_info */ +#define CL_MEM_USES_SVM_POINTER_ARM 0x40B7 + +/* cl_kernel_exec_info_arm */ +#define CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM 0x40B8 +#define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM 0x40B9 + +/* cl_command_type */ +#define CL_COMMAND_SVM_FREE_ARM 0x40BA +#define CL_COMMAND_SVM_MEMCPY_ARM 0x40BB +#define CL_COMMAND_SVM_MEMFILL_ARM 0x40BC +#define CL_COMMAND_SVM_MAP_ARM 0x40BD +#define CL_COMMAND_SVM_UNMAP_ARM 0x40BE + +/* cl_device_svm_capabilities_arm */ +#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM (1 << 0) +#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM (1 << 1) +#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM (1 << 2) +#define CL_DEVICE_SVM_ATOMICS_ARM (1 << 3) + +/* cl_svm_mem_flags_arm */ +#define CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM (1 << 10) +#define CL_MEM_SVM_ATOMICS_ARM (1 << 11) + + +typedef void* CL_API_CALL +clSVMAllocARM_t( + cl_context context, + cl_svm_mem_flags_arm flags, + size_t size, + cl_uint alignment); + +typedef clSVMAllocARM_t * +clSVMAllocARM_fn CL_API_SUFFIX__VERSION_1_2; + +typedef void CL_API_CALL +clSVMFreeARM_t( + cl_context context, + void* svm_pointer); + +typedef clSVMFreeARM_t * +clSVMFreeARM_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clEnqueueSVMFreeARM_t( + 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); + +typedef clEnqueueSVMFreeARM_t * +clEnqueueSVMFreeARM_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clEnqueueSVMMemcpyARM_t( + 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); + +typedef clEnqueueSVMMemcpyARM_t * +clEnqueueSVMMemcpyARM_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clEnqueueSVMMemFillARM_t( + 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); + +typedef clEnqueueSVMMemFillARM_t * +clEnqueueSVMMemFillARM_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clEnqueueSVMMapARM_t( + 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); + +typedef clEnqueueSVMMapARM_t * +clEnqueueSVMMapARM_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clEnqueueSVMUnmapARM_t( + cl_command_queue command_queue, + void* svm_ptr, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueSVMUnmapARM_t * +clEnqueueSVMUnmapARM_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clSetKernelArgSVMPointerARM_t( + cl_kernel kernel, + cl_uint arg_index, + const void* arg_value); + +typedef clSetKernelArgSVMPointerARM_t * +clSetKernelArgSVMPointerARM_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clSetKernelExecInfoARM_t( + cl_kernel kernel, + cl_kernel_exec_info_arm param_name, + size_t param_value_size, + const void* param_value); + +typedef clSetKernelExecInfoARM_t * +clSetKernelExecInfoARM_fn CL_API_SUFFIX__VERSION_1_2; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY void* CL_API_CALL +clSVMAllocARM( + cl_context context, + cl_svm_mem_flags_arm flags, + size_t size, + cl_uint alignment) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY void CL_API_CALL +clSVMFreeARM( + cl_context context, + void* svm_pointer) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMFreeARM( + 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_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMMemcpyARM( + 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_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMMemFillARM( + 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_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMMapARM( + 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_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueSVMUnmapARM( + 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_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clSetKernelArgSVMPointerARM( + cl_kernel kernel, + cl_uint arg_index, + const void* arg_value) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clSetKernelExecInfoARM( + cl_kernel kernel, + cl_kernel_exec_info_arm param_name, + size_t param_value_size, + const void* param_value) CL_API_SUFFIX__VERSION_1_2; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_arm_get_core_id +***************************************************************/ +#if defined(CL_VERSION_1_2) + +#define cl_arm_get_core_id 1 +#define CL_ARM_GET_CORE_ID_EXTENSION_NAME \ + "cl_arm_get_core_id" + + +#define CL_ARM_GET_CORE_ID_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM 0x40BF + +#endif /* defined(CL_VERSION_1_2) */ + +/*************************************************************** +* cl_arm_job_slot_selection +***************************************************************/ +#define cl_arm_job_slot_selection 1 +#define CL_ARM_JOB_SLOT_SELECTION_EXTENSION_NAME \ + "cl_arm_job_slot_selection" + + +#define CL_ARM_JOB_SLOT_SELECTION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_JOB_SLOTS_ARM 0x41E0 + +/* cl_queue_properties */ +#define CL_QUEUE_JOB_SLOT_ARM 0x41E1 + +/*************************************************************** +* cl_arm_scheduling_controls +***************************************************************/ +#define cl_arm_scheduling_controls 1 +#define CL_ARM_SCHEDULING_CONTROLS_EXTENSION_NAME \ + "cl_arm_scheduling_controls" + + +#define CL_ARM_SCHEDULING_CONTROLS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* Types */ +typedef cl_bitfield cl_device_scheduling_controls_capabilities_arm; + +/* cl_device_scheduling_controls_capabilities_arm */ +#define CL_DEVICE_SCHEDULING_KERNEL_BATCHING_ARM (1 << 0) +#define CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_ARM (1 << 1) +#define CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_MODIFIER_ARM (1 << 2) +#define CL_DEVICE_SCHEDULING_DEFERRED_FLUSH_ARM (1 << 3) +#define CL_DEVICE_SCHEDULING_REGISTER_ALLOCATION_ARM (1 << 4) +#define CL_DEVICE_SCHEDULING_WARP_THROTTLING_ARM (1 << 5) +#define CL_DEVICE_SCHEDULING_COMPUTE_UNIT_BATCH_QUEUE_SIZE_ARM (1 << 6) +#define CL_DEVICE_SCHEDULING_COMPUTE_UNIT_LIMIT_ARM (1 << 7) + +/* cl_device_info */ +#define CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM 0x41E4 +#define CL_DEVICE_SUPPORTED_REGISTER_ALLOCATIONS_ARM 0x41EB +#define CL_DEVICE_MAX_WARP_COUNT_ARM 0x41EA + +/* cl_kernel_exec_info */ +#define CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_ARM 0x41E5 +#define CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_MODIFIER_ARM 0x41E6 +#define CL_KERNEL_EXEC_INFO_WARP_COUNT_LIMIT_ARM 0x41E8 +#define CL_KERNEL_EXEC_INFO_COMPUTE_UNIT_MAX_QUEUED_BATCHES_ARM 0x41F1 + +/* cl_kernel_info */ +#define CL_KERNEL_MAX_WARP_COUNT_ARM 0x41E9 + +/* cl_queue_properties */ +#define CL_QUEUE_KERNEL_BATCHING_ARM 0x41E7 +#define CL_QUEUE_DEFERRED_FLUSH_ARM 0x41EC +#define CL_QUEUE_COMPUTE_UNIT_LIMIT_ARM 0x41F3 + +/*************************************************************** +* cl_arm_controlled_kernel_termination +***************************************************************/ +#define cl_arm_controlled_kernel_termination 1 +#define CL_ARM_CONTROLLED_KERNEL_TERMINATION_EXTENSION_NAME \ + "cl_arm_controlled_kernel_termination" + + +#define CL_ARM_CONTROLLED_KERNEL_TERMINATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* Types */ +typedef cl_bitfield cl_device_controlled_termination_capabilities_arm; + +/* Error codes */ +#define CL_COMMAND_TERMINATED_ITSELF_WITH_FAILURE_ARM -1108 + +/* cl_device_controlled_termination_capabilities_arm */ +#define CL_DEVICE_CONTROLLED_TERMINATION_SUCCESS_ARM (1 << 0) +#define CL_DEVICE_CONTROLLED_TERMINATION_FAILURE_ARM (1 << 1) +#define CL_DEVICE_CONTROLLED_TERMINATION_QUERY_ARM (1 << 2) + +/* cl_device_info */ +#define CL_DEVICE_CONTROLLED_TERMINATION_CAPABILITIES_ARM 0x41EE + +/* cl_event_info */ +#define CL_EVENT_COMMAND_TERMINATION_REASON_ARM 0x41ED + +/* cl_command_termination_reason_arm */ +#define CL_COMMAND_TERMINATION_COMPLETION_ARM 0 +#define CL_COMMAND_TERMINATION_CONTROLLED_SUCCESS_ARM 1 +#define CL_COMMAND_TERMINATION_CONTROLLED_FAILURE_ARM 2 +#define CL_COMMAND_TERMINATION_ERROR_ARM 3 + +/*************************************************************** +* cl_arm_protected_memory_allocation +***************************************************************/ +#define cl_arm_protected_memory_allocation 1 +#define CL_ARM_PROTECTED_MEMORY_ALLOCATION_EXTENSION_NAME \ + "cl_arm_protected_memory_allocation" + + +#define CL_ARM_PROTECTED_MEMORY_ALLOCATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +#define CL_MEM_PROTECTED_ALLOC_ARM ((cl_bitfield)1 << 36) + +/*************************************************************** +* cl_intel_exec_by_local_thread +***************************************************************/ +#define cl_intel_exec_by_local_thread 1 +#define CL_INTEL_EXEC_BY_LOCAL_THREAD_EXTENSION_NAME \ + "cl_intel_exec_by_local_thread" + + +#define CL_INTEL_EXEC_BY_LOCAL_THREAD_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_command_queue_properties - bitfield */ +#define CL_QUEUE_THREAD_LOCAL_EXEC_ENABLE_INTEL ((cl_bitfield)1 << 31) + +/*************************************************************** +* cl_intel_device_attribute_query +***************************************************************/ +#define cl_intel_device_attribute_query 1 +#define CL_INTEL_DEVICE_ATTRIBUTE_QUERY_EXTENSION_NAME \ + "cl_intel_device_attribute_query" + + +#define CL_INTEL_DEVICE_ATTRIBUTE_QUERY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +typedef cl_bitfield cl_device_feature_capabilities_intel; + +/* cl_device_feature_capabilities_intel */ +#define CL_DEVICE_FEATURE_FLAG_DP4A_INTEL (1 << 0) +#define CL_DEVICE_FEATURE_FLAG_DPAS_INTEL (1 << 1) + +/* cl_device_info */ +#define CL_DEVICE_IP_VERSION_INTEL 0x4250 +#define CL_DEVICE_ID_INTEL 0x4251 +#define CL_DEVICE_NUM_SLICES_INTEL 0x4252 +#define CL_DEVICE_NUM_SUB_SLICES_PER_SLICE_INTEL 0x4253 +#define CL_DEVICE_NUM_EUS_PER_SUB_SLICE_INTEL 0x4254 +#define CL_DEVICE_NUM_THREADS_PER_EU_INTEL 0x4255 +#define CL_DEVICE_FEATURE_CAPABILITIES_INTEL 0x4256 + +/*************************************************************** +* cl_intel_device_partition_by_names +***************************************************************/ +#define cl_intel_device_partition_by_names 1 +#define CL_INTEL_DEVICE_PARTITION_BY_NAMES_EXTENSION_NAME \ + "cl_intel_device_partition_by_names" + + +#define CL_INTEL_DEVICE_PARTITION_BY_NAMES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +#define CL_DEVICE_PARTITION_BY_NAMES_INTEL 0x4052 +#define CL_PARTITION_BY_NAMES_LIST_END_INTEL -1 + +/*************************************************************** +* cl_intel_accelerator +***************************************************************/ +#define cl_intel_accelerator 1 +#define CL_INTEL_ACCELERATOR_EXTENSION_NAME \ + "cl_intel_accelerator" + + +#define CL_INTEL_ACCELERATOR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +typedef struct _cl_accelerator_intel* cl_accelerator_intel; +typedef cl_uint cl_accelerator_type_intel; +typedef cl_uint cl_accelerator_info_intel; + +/* cl_accelerator_info_intel */ +#define CL_ACCELERATOR_DESCRIPTOR_INTEL 0x4090 +#define CL_ACCELERATOR_REFERENCE_COUNT_INTEL 0x4091 +#define CL_ACCELERATOR_CONTEXT_INTEL 0x4092 +#define CL_ACCELERATOR_TYPE_INTEL 0x4093 + +/* Error codes */ +#define CL_INVALID_ACCELERATOR_INTEL -1094 +#define CL_INVALID_ACCELERATOR_TYPE_INTEL -1095 +#define CL_INVALID_ACCELERATOR_DESCRIPTOR_INTEL -1096 +#define CL_ACCELERATOR_TYPE_NOT_SUPPORTED_INTEL -1097 + + +typedef cl_accelerator_intel CL_API_CALL +clCreateAcceleratorINTEL_t( + cl_context context, + cl_accelerator_type_intel accelerator_type, + size_t descriptor_size, + const void* descriptor, + cl_int* errcode_ret); + +typedef clCreateAcceleratorINTEL_t * +clCreateAcceleratorINTEL_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clGetAcceleratorInfoINTEL_t( + cl_accelerator_intel accelerator, + cl_accelerator_info_intel param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetAcceleratorInfoINTEL_t * +clGetAcceleratorInfoINTEL_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clRetainAcceleratorINTEL_t( + cl_accelerator_intel accelerator); + +typedef clRetainAcceleratorINTEL_t * +clRetainAcceleratorINTEL_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clReleaseAcceleratorINTEL_t( + cl_accelerator_intel accelerator); + +typedef clReleaseAcceleratorINTEL_t * +clReleaseAcceleratorINTEL_fn CL_API_SUFFIX__VERSION_1_2; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_accelerator_intel CL_API_CALL +clCreateAcceleratorINTEL( + cl_context context, + cl_accelerator_type_intel accelerator_type, + size_t descriptor_size, + const void* descriptor, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetAcceleratorInfoINTEL( + cl_accelerator_intel accelerator, + cl_accelerator_info_intel param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clRetainAcceleratorINTEL( + cl_accelerator_intel accelerator) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clReleaseAcceleratorINTEL( + cl_accelerator_intel accelerator) CL_API_SUFFIX__VERSION_1_2; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_intel_motion_estimation +***************************************************************/ +#define cl_intel_motion_estimation 1 +#define CL_INTEL_MOTION_ESTIMATION_EXTENSION_NAME \ + "cl_intel_motion_estimation" + + +#define CL_INTEL_MOTION_ESTIMATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +typedef struct _cl_motion_estimation_desc_intel { + cl_uint mb_block_type; + cl_uint subpixel_mode; + cl_uint sad_adjust_mode; + cl_uint search_path_type; +} cl_motion_estimation_desc_intel; + +/* cl_accelerator_type_intel */ +#define CL_ACCELERATOR_TYPE_MOTION_ESTIMATION_INTEL 0x0 + +/* cl_uint mb_block_type */ +#define CL_ME_MB_TYPE_16x16_INTEL 0x0 +#define CL_ME_MB_TYPE_8x8_INTEL 0x1 +#define CL_ME_MB_TYPE_4x4_INTEL 0x2 + +/* cl_uint subpixel_mode */ +#define CL_ME_SUBPIXEL_MODE_INTEGER_INTEL 0x0 +#define CL_ME_SUBPIXEL_MODE_HPEL_INTEL 0x1 +#define CL_ME_SUBPIXEL_MODE_QPEL_INTEL 0x2 + +/* cl_uint sad_adjust_mode */ +#define CL_ME_SAD_ADJUST_MODE_NONE_INTEL 0x0 +#define CL_ME_SAD_ADJUST_MODE_HAAR_INTEL 0x1 + +/* cl_uint search_path_type */ +#define CL_ME_SEARCH_PATH_RADIUS_2_2_INTEL 0x0 +#define CL_ME_SEARCH_PATH_RADIUS_4_4_INTEL 0x1 +#define CL_ME_SEARCH_PATH_RADIUS_16_12_INTEL 0x5 + +/*************************************************************** +* cl_intel_advanced_motion_estimation +***************************************************************/ +#define cl_intel_advanced_motion_estimation 1 +#define CL_INTEL_ADVANCED_MOTION_ESTIMATION_EXTENSION_NAME \ + "cl_intel_advanced_motion_estimation" + + +#define CL_INTEL_ADVANCED_MOTION_ESTIMATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_ME_VERSION_INTEL 0x407E + +#define CL_ME_VERSION_LEGACY_INTEL 0x0 +#define CL_ME_VERSION_ADVANCED_VER_1_INTEL 0x1 +#define CL_ME_VERSION_ADVANCED_VER_2_INTEL 0x2 + +#define CL_ME_CHROMA_INTRA_PREDICT_ENABLED_INTEL 0x1 +#define CL_ME_LUMA_INTRA_PREDICT_ENABLED_INTEL 0x2 + +#define CL_ME_SKIP_BLOCK_TYPE_16x16_INTEL 0x0 +#define CL_ME_SKIP_BLOCK_TYPE_8x8_INTEL 0x4 + +#define CL_ME_COST_PENALTY_NONE_INTEL 0x0 +#define CL_ME_COST_PENALTY_LOW_INTEL 0x1 +#define CL_ME_COST_PENALTY_NORMAL_INTEL 0x2 +#define CL_ME_COST_PENALTY_HIGH_INTEL 0x3 + +#define CL_ME_COST_PRECISION_QPEL_INTEL 0x0 +#define CL_ME_COST_PRECISION_HPEL_INTEL 0x1 +#define CL_ME_COST_PRECISION_PEL_INTEL 0x2 +#define CL_ME_COST_PRECISION_DPEL_INTEL 0x3 + +#define CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL 0x0 +#define CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1 +#define CL_ME_LUMA_PREDICTOR_MODE_DC_INTEL 0x2 +#define CL_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL 0x3 +#define CL_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL 0x4 +#define CL_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL 0x4 +#define CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL 0x5 +#define CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL 0x6 +#define CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL 0x7 +#define CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL 0x8 + +#define CL_ME_CHROMA_PREDICTOR_MODE_DC_INTEL 0x0 +#define CL_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1 +#define CL_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL 0x2 +#define CL_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL 0x3 + +#define CL_ME_FORWARD_INPUT_MODE_INTEL 0x1 +#define CL_ME_BACKWARD_INPUT_MODE_INTEL 0x2 +#define CL_ME_BIDIRECTION_INPUT_MODE_INTEL 0x3 + +#define CL_ME_BIDIR_WEIGHT_QUARTER_INTEL 16 +#define CL_ME_BIDIR_WEIGHT_THIRD_INTEL 21 +#define CL_ME_BIDIR_WEIGHT_HALF_INTEL 32 +#define CL_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL 43 +#define CL_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL 48 + +/*************************************************************** +* cl_intel_simultaneous_sharing +***************************************************************/ +#define cl_intel_simultaneous_sharing 1 +#define CL_INTEL_SIMULTANEOUS_SHARING_EXTENSION_NAME \ + "cl_intel_simultaneous_sharing" + + +#define CL_INTEL_SIMULTANEOUS_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_SIMULTANEOUS_INTEROPS_INTEL 0x4104 +#define CL_DEVICE_NUM_SIMULTANEOUS_INTEROPS_INTEL 0x4105 + +/*************************************************************** +* cl_intel_egl_image_yuv +***************************************************************/ +#define cl_intel_egl_image_yuv 1 +#define CL_INTEL_EGL_IMAGE_YUV_EXTENSION_NAME \ + "cl_intel_egl_image_yuv" + + +#define CL_INTEL_EGL_IMAGE_YUV_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_egl_image_properties_khr */ +#define CL_EGL_YUV_PLANE_INTEL 0x4107 + +/*************************************************************** +* cl_intel_packed_yuv +***************************************************************/ +#define cl_intel_packed_yuv 1 +#define CL_INTEL_PACKED_YUV_EXTENSION_NAME \ + "cl_intel_packed_yuv" + + +#define CL_INTEL_PACKED_YUV_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_channel_order */ +#define CL_YUYV_INTEL 0x4076 +#define CL_UYVY_INTEL 0x4077 +#define CL_YVYU_INTEL 0x4078 +#define CL_VYUY_INTEL 0x4079 + +/*************************************************************** +* cl_intel_required_subgroup_size +***************************************************************/ +#define cl_intel_required_subgroup_size 1 +#define CL_INTEL_REQUIRED_SUBGROUP_SIZE_EXTENSION_NAME \ + "cl_intel_required_subgroup_size" + + +#define CL_INTEL_REQUIRED_SUBGROUP_SIZE_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_SUB_GROUP_SIZES_INTEL 0x4108 + +/* cl_kernel_work_group_info */ +#define CL_KERNEL_SPILL_MEM_SIZE_INTEL 0x4109 + +/* cl_kernel_sub_group_info */ +#define CL_KERNEL_COMPILE_SUB_GROUP_SIZE_INTEL 0x410A + +/*************************************************************** +* cl_intel_driver_diagnostics +***************************************************************/ +#define cl_intel_driver_diagnostics 1 +#define CL_INTEL_DRIVER_DIAGNOSTICS_EXTENSION_NAME \ + "cl_intel_driver_diagnostics" + + +#define CL_INTEL_DRIVER_DIAGNOSTICS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +typedef cl_bitfield cl_diagnostic_verbose_level_intel; + +/* cl_context_properties */ +#define CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL 0x4106 + +/* cl_diagnostic_verbose_level_intel */ +#define CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL 0xff +#define CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL (1 << 0) +#define CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL (1 << 1) +#define CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL (1 << 2) + +/*************************************************************** +* cl_intel_planar_yuv +***************************************************************/ +#define cl_intel_planar_yuv 1 +#define CL_INTEL_PLANAR_YUV_EXTENSION_NAME \ + "cl_intel_planar_yuv" + + +#define CL_INTEL_PLANAR_YUV_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_channel_order */ +#define CL_NV12_INTEL 0x410E + +/* cl_mem_flags */ +#define CL_MEM_NO_ACCESS_INTEL (1 << 24) +#define CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL (1 << 25) + +/* cl_device_info */ +#define CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL 0x417E +#define CL_DEVICE_PLANAR_YUV_MAX_HEIGHT_INTEL 0x417F + +/*************************************************************** +* cl_intel_device_side_avc_motion_estimation +***************************************************************/ +#define cl_intel_device_side_avc_motion_estimation 1 +#define CL_INTEL_DEVICE_SIDE_AVC_MOTION_ESTIMATION_EXTENSION_NAME \ + "cl_intel_device_side_avc_motion_estimation" + + +#define CL_INTEL_DEVICE_SIDE_AVC_MOTION_ESTIMATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_AVC_ME_VERSION_INTEL 0x410B +#define CL_DEVICE_AVC_ME_SUPPORTS_TEXTURE_SAMPLER_USE_INTEL 0x410C +#define CL_DEVICE_AVC_ME_SUPPORTS_PREEMPTION_INTEL 0x410D + +/* returned by CL_DEVICE_AVC_ME_VERSION_INTEL */ +#define CL_AVC_ME_VERSION_0_INTEL 0x0 +#define CL_AVC_ME_VERSION_1_INTEL 0x1 + +/* Inter macro-block major shape values */ +#define CL_AVC_ME_MAJOR_16x16_INTEL 0x0 +#define CL_AVC_ME_MAJOR_16x8_INTEL 0x1 +#define CL_AVC_ME_MAJOR_8x16_INTEL 0x2 +#define CL_AVC_ME_MAJOR_8x8_INTEL 0x3 + +/* Inter macro-block minor shape values */ +#define CL_AVC_ME_MINOR_8x8_INTEL 0x0 +#define CL_AVC_ME_MINOR_8x4_INTEL 0x1 +#define CL_AVC_ME_MINOR_4x8_INTEL 0x2 +#define CL_AVC_ME_MINOR_4x4_INTEL 0x3 + +/* Inter macro-block major direction values */ +#define CL_AVC_ME_MAJOR_FORWARD_INTEL 0x0 +#define CL_AVC_ME_MAJOR_BACKWARD_INTEL 0x1 +#define CL_AVC_ME_MAJOR_BIDIRECTIONAL_INTEL 0x2 + +/* Inter (IME) partition mask values */ +#define CL_AVC_ME_PARTITION_MASK_ALL_INTEL 0x0 +#define CL_AVC_ME_PARTITION_MASK_16x16_INTEL 0x7E +#define CL_AVC_ME_PARTITION_MASK_16x8_INTEL 0x7D +#define CL_AVC_ME_PARTITION_MASK_8x16_INTEL 0x7B +#define CL_AVC_ME_PARTITION_MASK_8x8_INTEL 0x77 +#define CL_AVC_ME_PARTITION_MASK_8x4_INTEL 0x6F +#define CL_AVC_ME_PARTITION_MASK_4x8_INTEL 0x5F +#define CL_AVC_ME_PARTITION_MASK_4x4_INTEL 0x3F + +/* Search window configuration */ +#define CL_AVC_ME_SEARCH_WINDOW_EXHAUSTIVE_INTEL 0x0 +#define CL_AVC_ME_SEARCH_WINDOW_SMALL_INTEL 0x1 +#define CL_AVC_ME_SEARCH_WINDOW_TINY_INTEL 0x2 +#define CL_AVC_ME_SEARCH_WINDOW_EXTRA_TINY_INTEL 0x3 +#define CL_AVC_ME_SEARCH_WINDOW_DIAMOND_INTEL 0x4 +#define CL_AVC_ME_SEARCH_WINDOW_LARGE_DIAMOND_INTEL 0x5 +#define CL_AVC_ME_SEARCH_WINDOW_RESERVED0_INTEL 0x6 +#define CL_AVC_ME_SEARCH_WINDOW_RESERVED1_INTEL 0x7 +#define CL_AVC_ME_SEARCH_WINDOW_CUSTOM_INTEL 0x8 +#define CL_AVC_ME_SEARCH_WINDOW_16x12_RADIUS_INTEL 0x9 +#define CL_AVC_ME_SEARCH_WINDOW_4x4_RADIUS_INTEL 0x2 +#define CL_AVC_ME_SEARCH_WINDOW_2x2_RADIUS_INTEL 0xa + +/* SAD adjustment mode */ +#define CL_AVC_ME_SAD_ADJUST_MODE_NONE_INTEL 0x0 +#define CL_AVC_ME_SAD_ADJUST_MODE_HAAR_INTEL 0x2 + +/* Pixel resolution */ +#define CL_AVC_ME_SUBPIXEL_MODE_INTEGER_INTEL 0x0 +#define CL_AVC_ME_SUBPIXEL_MODE_HPEL_INTEL 0x1 +#define CL_AVC_ME_SUBPIXEL_MODE_QPEL_INTEL 0x3 + +/* Cost precision values */ +#define CL_AVC_ME_COST_PRECISION_QPEL_INTEL 0x0 +#define CL_AVC_ME_COST_PRECISION_HPEL_INTEL 0x1 +#define CL_AVC_ME_COST_PRECISION_PEL_INTEL 0x2 +#define CL_AVC_ME_COST_PRECISION_DPEL_INTEL 0x3 + +/* Inter bidirectional weights */ +#define CL_AVC_ME_BIDIR_WEIGHT_QUARTER_INTEL 0x10 +#define CL_AVC_ME_BIDIR_WEIGHT_THIRD_INTEL 0x15 +#define CL_AVC_ME_BIDIR_WEIGHT_HALF_INTEL 0x20 +#define CL_AVC_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL 0x2B +#define CL_AVC_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL 0x30 + +/* Inter border reached values */ +#define CL_AVC_ME_BORDER_REACHED_LEFT_INTEL 0x0 +#define CL_AVC_ME_BORDER_REACHED_RIGHT_INTEL 0x2 +#define CL_AVC_ME_BORDER_REACHED_TOP_INTEL 0x4 +#define CL_AVC_ME_BORDER_REACHED_BOTTOM_INTEL 0x8 + +/* Inter skip block partition type */ +#define CL_AVC_ME_SKIP_BLOCK_PARTITION_16x16_INTEL 0x0 +#define CL_AVC_ME_SKIP_BLOCK_PARTITION_8x8_INTEL 0x4000 + +/* Inter skip motion vector mask */ +#define CL_AVC_ME_SKIP_BLOCK_16x16_FORWARD_ENABLE_INTEL (0x1 << 24) +#define CL_AVC_ME_SKIP_BLOCK_16x16_BACKWARD_ENABLE_INTEL (0x2 << 24) +#define CL_AVC_ME_SKIP_BLOCK_16x16_DUAL_ENABLE_INTEL (0x3 << 24) +#define CL_AVC_ME_SKIP_BLOCK_8x8_FORWARD_ENABLE_INTEL (0x55 << 24) +#define CL_AVC_ME_SKIP_BLOCK_8x8_BACKWARD_ENABLE_INTEL (0xAA << 24) +#define CL_AVC_ME_SKIP_BLOCK_8x8_DUAL_ENABLE_INTEL (0xFF << 24) +#define CL_AVC_ME_SKIP_BLOCK_8x8_0_FORWARD_ENABLE_INTEL (0x1 << 24) +#define CL_AVC_ME_SKIP_BLOCK_8x8_0_BACKWARD_ENABLE_INTEL (0x2 << 24) +#define CL_AVC_ME_SKIP_BLOCK_8x8_1_FORWARD_ENABLE_INTEL (0x1 << 26) +#define CL_AVC_ME_SKIP_BLOCK_8x8_1_BACKWARD_ENABLE_INTEL (0x2 << 26) +#define CL_AVC_ME_SKIP_BLOCK_8x8_2_FORWARD_ENABLE_INTEL (0x1 << 28) +#define CL_AVC_ME_SKIP_BLOCK_8x8_2_BACKWARD_ENABLE_INTEL (0x2 << 28) +#define CL_AVC_ME_SKIP_BLOCK_8x8_3_FORWARD_ENABLE_INTEL (0x1 << 30) +#define CL_AVC_ME_SKIP_BLOCK_8x8_3_BACKWARD_ENABLE_INTEL (0x2 << 30) + +/* Block based skip type values */ +#define CL_AVC_ME_BLOCK_BASED_SKIP_4x4_INTEL 0x00 +#define CL_AVC_ME_BLOCK_BASED_SKIP_8x8_INTEL 0x80 + +/* cl_intel_device_side_avc_motion_estimation.?? */ +#define CL_AVC_ME_INTRA_16x16_INTEL 0x0 +#define CL_AVC_ME_INTRA_8x8_INTEL 0x1 +#define CL_AVC_ME_INTRA_4x4_INTEL 0x2 + +/* Luma intra partition mask values */ +#define CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_16x16_INTEL 0x6 +#define CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_8x8_INTEL 0x5 +#define CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_4x4_INTEL 0x3 + +/* Intra neighbor availability mask values */ +#define CL_AVC_ME_INTRA_NEIGHBOR_LEFT_MASK_ENABLE_INTEL 0x60 +#define CL_AVC_ME_INTRA_NEIGHBOR_UPPER_MASK_ENABLE_INTEL 0x10 +#define CL_AVC_ME_INTRA_NEIGHBOR_UPPER_RIGHT_MASK_ENABLE_INTEL 0x8 +#define CL_AVC_ME_INTRA_NEIGHBOR_UPPER_LEFT_MASK_ENABLE_INTEL 0x4 + +/* Luma intra modes */ +#define CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL 0x0 +#define CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1 +#define CL_AVC_ME_LUMA_PREDICTOR_MODE_DC_INTEL 0x2 +#define CL_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL 0x3 +#define CL_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL 0x4 +#define CL_AVC_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL 0x4 +#define CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL 0x5 +#define CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL 0x6 +#define CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL 0x7 +#define CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL 0x8 + +/* Chroma intra modes */ +#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_DC_INTEL 0x0 +#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1 +#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL 0x2 +#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL 0x3 + +/* Reference image select values */ +#define CL_AVC_ME_FRAME_FORWARD_INTEL 0x1 +#define CL_AVC_ME_FRAME_BACKWARD_INTEL 0x2 +#define CL_AVC_ME_FRAME_DUAL_INTEL 0x3 + +/* Slice type values */ +#define CL_AVC_ME_SLICE_TYPE_PRED_INTEL 0x0 +#define CL_AVC_ME_SLICE_TYPE_BPRED_INTEL 0x1 +#define CL_AVC_ME_SLICE_TYPE_INTRA_INTEL 0x2 + +/* Interlaced image field polarity values */ +#define CL_AVC_ME_INTERLACED_SCAN_TOP_FIELD_INTEL 0x0 +#define CL_AVC_ME_INTERLACED_SCAN_BOTTOM_FIELD_INTEL 0x1 + +/*************************************************************** +* cl_intel_unified_shared_memory +***************************************************************/ +#define cl_intel_unified_shared_memory 1 +#define CL_INTEL_UNIFIED_SHARED_MEMORY_EXTENSION_NAME \ + "cl_intel_unified_shared_memory" + + +#define CL_INTEL_UNIFIED_SHARED_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(1, 1, 0) + +typedef cl_bitfield cl_device_unified_shared_memory_capabilities_intel; +typedef cl_properties cl_mem_properties_intel; +typedef cl_bitfield cl_mem_alloc_flags_intel; +typedef cl_uint cl_mem_info_intel; +typedef cl_uint cl_unified_shared_memory_type_intel; +typedef cl_uint cl_mem_advice_intel; + +/* cl_device_info */ +#define CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL 0x4190 +#define CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL 0x4191 +#define CL_DEVICE_SINGLE_DEVICE_SHARED_MEM_CAPABILITIES_INTEL 0x4192 +#define CL_DEVICE_CROSS_DEVICE_SHARED_MEM_CAPABILITIES_INTEL 0x4193 +#define CL_DEVICE_SHARED_SYSTEM_MEM_CAPABILITIES_INTEL 0x4194 + +/* cl_unified_shared_memory_capabilities_intel - bitfield */ +#define CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL (1 << 0) +#define CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL (1 << 1) +#define CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL (1 << 2) +#define CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL (1 << 3) + +/* cl_mem_properties_intel */ +#define CL_MEM_ALLOC_FLAGS_INTEL 0x4195 + +/* cl_mem_alloc_flags_intel - bitfield */ +#define CL_MEM_ALLOC_WRITE_COMBINED_INTEL (1 << 0) +#define CL_MEM_ALLOC_INITIAL_PLACEMENT_DEVICE_INTEL (1 << 1) +#define CL_MEM_ALLOC_INITIAL_PLACEMENT_HOST_INTEL (1 << 2) + +/* cl_mem_alloc_info_intel */ +#define CL_MEM_ALLOC_TYPE_INTEL 0x419A +#define CL_MEM_ALLOC_BASE_PTR_INTEL 0x419B +#define CL_MEM_ALLOC_SIZE_INTEL 0x419C +#define CL_MEM_ALLOC_DEVICE_INTEL 0x419D + +/* cl_unified_shared_memory_type_intel */ +#define CL_MEM_TYPE_UNKNOWN_INTEL 0x4196 +#define CL_MEM_TYPE_HOST_INTEL 0x4197 +#define CL_MEM_TYPE_DEVICE_INTEL 0x4198 +#define CL_MEM_TYPE_SHARED_INTEL 0x4199 + +/* cl_kernel_exec_info */ +#define CL_KERNEL_EXEC_INFO_INDIRECT_HOST_ACCESS_INTEL 0x4200 +#define CL_KERNEL_EXEC_INFO_INDIRECT_DEVICE_ACCESS_INTEL 0x4201 +#define CL_KERNEL_EXEC_INFO_INDIRECT_SHARED_ACCESS_INTEL 0x4202 +#define CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL 0x4203 + +/* cl_command_type */ +#define CL_COMMAND_MEMFILL_INTEL 0x4204 +#define CL_COMMAND_MEMCPY_INTEL 0x4205 +#define CL_COMMAND_MIGRATEMEM_INTEL 0x4206 +#define CL_COMMAND_MEMADVISE_INTEL 0x4207 + + +typedef void* CL_API_CALL +clHostMemAllocINTEL_t( + cl_context context, + const cl_mem_properties_intel* properties, + size_t size, + cl_uint alignment, + cl_int* errcode_ret); + +typedef clHostMemAllocINTEL_t * +clHostMemAllocINTEL_fn ; + +typedef void* CL_API_CALL +clDeviceMemAllocINTEL_t( + cl_context context, + cl_device_id device, + const cl_mem_properties_intel* properties, + size_t size, + cl_uint alignment, + cl_int* errcode_ret); + +typedef clDeviceMemAllocINTEL_t * +clDeviceMemAllocINTEL_fn ; + +typedef void* CL_API_CALL +clSharedMemAllocINTEL_t( + cl_context context, + cl_device_id device, + const cl_mem_properties_intel* properties, + size_t size, + cl_uint alignment, + cl_int* errcode_ret); + +typedef clSharedMemAllocINTEL_t * +clSharedMemAllocINTEL_fn ; + +typedef cl_int CL_API_CALL +clMemFreeINTEL_t( + cl_context context, + void* ptr); + +typedef clMemFreeINTEL_t * +clMemFreeINTEL_fn ; + +typedef cl_int CL_API_CALL +clMemBlockingFreeINTEL_t( + cl_context context, + void* ptr); + +typedef clMemBlockingFreeINTEL_t * +clMemBlockingFreeINTEL_fn ; + +typedef cl_int CL_API_CALL +clGetMemAllocInfoINTEL_t( + cl_context context, + const void* ptr, + cl_mem_info_intel param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetMemAllocInfoINTEL_t * +clGetMemAllocInfoINTEL_fn ; + +typedef cl_int CL_API_CALL +clSetKernelArgMemPointerINTEL_t( + cl_kernel kernel, + cl_uint arg_index, + const void* arg_value); + +typedef clSetKernelArgMemPointerINTEL_t * +clSetKernelArgMemPointerINTEL_fn ; + +typedef cl_int CL_API_CALL +clEnqueueMemFillINTEL_t( + cl_command_queue command_queue, + void* dst_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); + +typedef clEnqueueMemFillINTEL_t * +clEnqueueMemFillINTEL_fn ; + +typedef cl_int CL_API_CALL +clEnqueueMemcpyINTEL_t( + cl_command_queue command_queue, + cl_bool blocking, + 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); + +typedef clEnqueueMemcpyINTEL_t * +clEnqueueMemcpyINTEL_fn ; + +typedef cl_int CL_API_CALL +clEnqueueMemAdviseINTEL_t( + cl_command_queue command_queue, + const void* ptr, + size_t size, + cl_mem_advice_intel advice, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueMemAdviseINTEL_t * +clEnqueueMemAdviseINTEL_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY void* CL_API_CALL +clHostMemAllocINTEL( + cl_context context, + const cl_mem_properties_intel* properties, + size_t size, + cl_uint alignment, + cl_int* errcode_ret) ; + +extern CL_API_ENTRY void* CL_API_CALL +clDeviceMemAllocINTEL( + cl_context context, + cl_device_id device, + const cl_mem_properties_intel* properties, + size_t size, + cl_uint alignment, + cl_int* errcode_ret) ; + +extern CL_API_ENTRY void* CL_API_CALL +clSharedMemAllocINTEL( + cl_context context, + cl_device_id device, + const cl_mem_properties_intel* properties, + size_t size, + cl_uint alignment, + cl_int* errcode_ret) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clMemFreeINTEL( + cl_context context, + void* ptr) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clMemBlockingFreeINTEL( + cl_context context, + void* ptr) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetMemAllocInfoINTEL( + cl_context context, + const void* ptr, + cl_mem_info_intel param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clSetKernelArgMemPointerINTEL( + cl_kernel kernel, + cl_uint arg_index, + const void* arg_value) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueMemFillINTEL( + cl_command_queue command_queue, + void* dst_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) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueMemcpyINTEL( + cl_command_queue command_queue, + cl_bool blocking, + 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) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueMemAdviseINTEL( + cl_command_queue command_queue, + const void* ptr, + size_t size, + cl_mem_advice_intel advice, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#if defined(CL_VERSION_1_2) +/* Requires OpenCL 1.2 for cl_mem_migration_flags: */ + +typedef cl_int CL_API_CALL +clEnqueueMigrateMemINTEL_t( + cl_command_queue command_queue, + const void* ptr, + size_t size, + cl_mem_migration_flags flags, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueMigrateMemINTEL_t * +clEnqueueMigrateMemINTEL_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueMigrateMemINTEL( + cl_command_queue command_queue, + const void* ptr, + size_t size, + cl_mem_migration_flags flags, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#endif /* defined(CL_VERSION_1_2) */ + +/* deprecated, use clEnqueueMemFillINTEL instead */ + +typedef cl_int CL_API_CALL +clEnqueueMemsetINTEL_t( + cl_command_queue command_queue, + void* dst_ptr, + cl_int value, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueMemsetINTEL_t * +clEnqueueMemsetINTEL_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueMemsetINTEL( + cl_command_queue command_queue, + void* dst_ptr, + cl_int value, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_intel_mem_alloc_buffer_location +***************************************************************/ +#define cl_intel_mem_alloc_buffer_location 1 +#define CL_INTEL_MEM_ALLOC_BUFFER_LOCATION_EXTENSION_NAME \ + "cl_intel_mem_alloc_buffer_location" + + +#define CL_INTEL_MEM_ALLOC_BUFFER_LOCATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_mem_properties_intel */ +#define CL_MEM_ALLOC_BUFFER_LOCATION_INTEL 0x419E + +/* cl_mem_alloc_info_intel */ +/* enum CL_MEM_ALLOC_BUFFER_LOCATION_INTEL */ + +/*************************************************************** +* cl_intel_create_buffer_with_properties +***************************************************************/ +#define cl_intel_create_buffer_with_properties 1 +#define CL_INTEL_CREATE_BUFFER_WITH_PROPERTIES_EXTENSION_NAME \ + "cl_intel_create_buffer_with_properties" + + +#define CL_INTEL_CREATE_BUFFER_WITH_PROPERTIES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* type cl_mem_properties_intel */ + + +typedef cl_mem CL_API_CALL +clCreateBufferWithPropertiesINTEL_t( + cl_context context, + const cl_mem_properties_intel* properties, + cl_mem_flags flags, + size_t size, + void* host_ptr, + cl_int* errcode_ret); + +typedef clCreateBufferWithPropertiesINTEL_t * +clCreateBufferWithPropertiesINTEL_fn CL_API_SUFFIX__VERSION_1_0; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_mem CL_API_CALL +clCreateBufferWithPropertiesINTEL( + cl_context context, + const cl_mem_properties_intel* properties, + cl_mem_flags flags, + size_t size, + void* host_ptr, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_intel_program_scope_host_pipe +***************************************************************/ +#define cl_intel_program_scope_host_pipe 1 +#define CL_INTEL_PROGRAM_SCOPE_HOST_PIPE_EXTENSION_NAME \ + "cl_intel_program_scope_host_pipe" + + +#define CL_INTEL_PROGRAM_SCOPE_HOST_PIPE_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* clGetEventInfo response when param_name is CL_EVENT_COMMAND_TYPE */ +#define CL_COMMAND_READ_HOST_PIPE_INTEL 0x4214 +#define CL_COMMAND_WRITE_HOST_PIPE_INTEL 0x4215 + +/* clGetProgramInfo param_name */ +#define CL_PROGRAM_NUM_HOST_PIPES_INTEL 0x4216 +#define CL_PROGRAM_HOST_PIPE_NAMES_INTEL 0x4217 + + +typedef cl_int CL_API_CALL +clEnqueueReadHostPipeINTEL_t( + cl_command_queue command_queue, + cl_program program, + const char* pipe_symbol, + cl_bool blocking_read, + void* ptr, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueReadHostPipeINTEL_t * +clEnqueueReadHostPipeINTEL_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL +clEnqueueWriteHostPipeINTEL_t( + cl_command_queue command_queue, + cl_program program, + const char* pipe_symbol, + cl_bool blocking_write, + const void* ptr, + size_t size, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueWriteHostPipeINTEL_t * +clEnqueueWriteHostPipeINTEL_fn CL_API_SUFFIX__VERSION_1_0; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReadHostPipeINTEL( + cl_command_queue command_queue, + cl_program program, + const char* pipe_symbol, + cl_bool blocking_read, + void* ptr, + 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; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueWriteHostPipeINTEL( + cl_command_queue command_queue, + cl_program program, + const char* pipe_symbol, + cl_bool blocking_write, + const void* ptr, + 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; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_intel_mem_channel_property +***************************************************************/ +#define cl_intel_mem_channel_property 1 +#define CL_INTEL_MEM_CHANNEL_PROPERTY_EXTENSION_NAME \ + "cl_intel_mem_channel_property" + + +#define CL_INTEL_MEM_CHANNEL_PROPERTY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_mem_properties_intel */ +#define CL_MEM_CHANNEL_INTEL 0x4213 + +/*************************************************************** +* cl_intel_mem_force_host_memory +***************************************************************/ +#define cl_intel_mem_force_host_memory 1 +#define CL_INTEL_MEM_FORCE_HOST_MEMORY_EXTENSION_NAME \ + "cl_intel_mem_force_host_memory" + + +#define CL_INTEL_MEM_FORCE_HOST_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_mem_flags */ +#define CL_MEM_FORCE_HOST_MEMORY_INTEL (1 << 20) + +/*************************************************************** +* cl_intel_command_queue_families +***************************************************************/ +#define cl_intel_command_queue_families 1 +#define CL_INTEL_COMMAND_QUEUE_FAMILIES_EXTENSION_NAME \ + "cl_intel_command_queue_families" + + +#define CL_INTEL_COMMAND_QUEUE_FAMILIES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +typedef cl_bitfield cl_command_queue_capabilities_intel; + +#define CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL 64 + +typedef struct _cl_queue_family_properties_intel { + cl_command_queue_properties properties; + cl_command_queue_capabilities_intel capabilities; + cl_uint count; + char name[CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL]; +} cl_queue_family_properties_intel; + +/* cl_device_info */ +#define CL_DEVICE_QUEUE_FAMILY_PROPERTIES_INTEL 0x418B + +/* cl_queue_properties */ +#define CL_QUEUE_FAMILY_INTEL 0x418C +#define CL_QUEUE_INDEX_INTEL 0x418D + +/* cl_command_queue_capabilities_intel */ +#define CL_QUEUE_DEFAULT_CAPABILITIES_INTEL 0 +#define CL_QUEUE_CAPABILITY_CREATE_SINGLE_QUEUE_EVENTS_INTEL (1 << 0) +#define CL_QUEUE_CAPABILITY_CREATE_CROSS_QUEUE_EVENTS_INTEL (1 << 1) +#define CL_QUEUE_CAPABILITY_SINGLE_QUEUE_EVENT_WAIT_LIST_INTEL (1 << 2) +#define CL_QUEUE_CAPABILITY_CROSS_QUEUE_EVENT_WAIT_LIST_INTEL (1 << 3) +#define CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_INTEL (1 << 8) +#define CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_RECT_INTEL (1 << 9) +#define CL_QUEUE_CAPABILITY_MAP_BUFFER_INTEL (1 << 10) +#define CL_QUEUE_CAPABILITY_FILL_BUFFER_INTEL (1 << 11) +#define CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_INTEL (1 << 12) +#define CL_QUEUE_CAPABILITY_MAP_IMAGE_INTEL (1 << 13) +#define CL_QUEUE_CAPABILITY_FILL_IMAGE_INTEL (1 << 14) +#define CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_IMAGE_INTEL (1 << 15) +#define CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_BUFFER_INTEL (1 << 16) +#define CL_QUEUE_CAPABILITY_MARKER_INTEL (1 << 24) +#define CL_QUEUE_CAPABILITY_BARRIER_INTEL (1 << 25) +#define CL_QUEUE_CAPABILITY_KERNEL_INTEL (1 << 26) + +/*************************************************************** +* cl_intel_queue_no_sync_operations +***************************************************************/ +#define cl_intel_queue_no_sync_operations 1 +#define CL_INTEL_QUEUE_NO_SYNC_OPERATIONS_EXTENSION_NAME \ + "cl_intel_queue_no_sync_operations" + + +#define CL_INTEL_QUEUE_NO_SYNC_OPERATIONS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_command_queue_properties */ +#define CL_QUEUE_NO_SYNC_OPERATIONS_INTEL (1 << 29) + +/*************************************************************** +* cl_intel_sharing_format_query +***************************************************************/ +#define cl_intel_sharing_format_query 1 +#define CL_INTEL_SHARING_FORMAT_QUERY_EXTENSION_NAME \ + "cl_intel_sharing_format_query" + + +#define CL_INTEL_SHARING_FORMAT_QUERY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/*************************************************************** +* cl_ext_image_requirements_info +***************************************************************/ +#if defined(CL_VERSION_3_0) + +#define cl_ext_image_requirements_info 1 +#define CL_EXT_IMAGE_REQUIREMENTS_INFO_EXTENSION_NAME \ + "cl_ext_image_requirements_info" + + +#define CL_EXT_IMAGE_REQUIREMENTS_INFO_EXTENSION_VERSION CL_MAKE_VERSION(0, 5, 0) + +/* Types */ +typedef cl_uint cl_image_requirements_info_ext; + +/* cl_image_requirements_info_ext */ +#define CL_IMAGE_REQUIREMENTS_BASE_ADDRESS_ALIGNMENT_EXT 0x1292 +#define CL_IMAGE_REQUIREMENTS_ROW_PITCH_ALIGNMENT_EXT 0x1290 +#define CL_IMAGE_REQUIREMENTS_SIZE_EXT 0x12B2 +#define CL_IMAGE_REQUIREMENTS_MAX_WIDTH_EXT 0x12B3 +#define CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT 0x12B4 +#define CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT 0x12B5 +#define CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT 0x12B6 + +/* Enqueued Commands APIs */ + +typedef cl_int CL_API_CALL +clGetImageRequirementsInfoEXT_t( + cl_context context, + const cl_mem_properties* properties, + cl_mem_flags flags, + const cl_image_format* image_format, + const cl_image_desc* image_desc, + cl_image_requirements_info_ext param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetImageRequirementsInfoEXT_t * +clGetImageRequirementsInfoEXT_fn CL_API_SUFFIX__VERSION_3_0; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetImageRequirementsInfoEXT( + cl_context context, + const cl_mem_properties* properties, + cl_mem_flags flags, + const cl_image_format* image_format, + const cl_image_desc* image_desc, + cl_image_requirements_info_ext param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_3_0; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#endif /* defined(CL_VERSION_3_0) */ + +/*************************************************************** +* cl_ext_image_from_buffer +***************************************************************/ +#if defined(CL_VERSION_3_0) + +#define cl_ext_image_from_buffer 1 +#define CL_EXT_IMAGE_FROM_BUFFER_EXTENSION_NAME \ + "cl_ext_image_from_buffer" + + +#define CL_EXT_IMAGE_FROM_BUFFER_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_image_requirements_info_ext */ +#define CL_IMAGE_REQUIREMENTS_SLICE_PITCH_ALIGNMENT_EXT 0x1291 + +#endif /* defined(CL_VERSION_3_0) */ + +/*************************************************************** +* cl_loader_info +***************************************************************/ +#define cl_loader_info 1 +#define CL_LOADER_INFO_EXTENSION_NAME \ + "cl_loader_info" + + +#define CL_LOADER_INFO_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef cl_uint cl_icdl_info; + +/* cl_icdl_info */ +#define CL_ICDL_OCL_VERSION 1 +#define CL_ICDL_VERSION 2 +#define CL_ICDL_NAME 3 +#define CL_ICDL_VENDOR 4 + + +typedef cl_int CL_API_CALL +clGetICDLoaderInfoOCLICD_t( + cl_icdl_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetICDLoaderInfoOCLICD_t * +clGetICDLoaderInfoOCLICD_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetICDLoaderInfoOCLICD( + cl_icdl_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_khr_depth_images +***************************************************************/ +#define cl_khr_depth_images 1 +#define CL_KHR_DEPTH_IMAGES_EXTENSION_NAME \ + "cl_khr_depth_images" + + +#define CL_KHR_DEPTH_IMAGES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +#if !defined(CL_VERSION_2_0) +/* cl_channel_order - defined in CL.h for OpenCL 2.0 and newer */ +#define CL_DEPTH 0x10BD + +#endif /* !defined(CL_VERSION_2_0) */ + +/*************************************************************** +* cl_ext_float_atomics +***************************************************************/ +#define cl_ext_float_atomics 1 +#define CL_EXT_FLOAT_ATOMICS_EXTENSION_NAME \ + "cl_ext_float_atomics" + + +#define CL_EXT_FLOAT_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef cl_bitfield cl_device_fp_atomic_capabilities_ext; + +/* cl_device_fp_atomic_capabilities_ext */ +#define CL_DEVICE_GLOBAL_FP_ATOMIC_LOAD_STORE_EXT (1 << 0) +#define CL_DEVICE_GLOBAL_FP_ATOMIC_ADD_EXT (1 << 1) +#define CL_DEVICE_GLOBAL_FP_ATOMIC_MIN_MAX_EXT (1 << 2) +#define CL_DEVICE_LOCAL_FP_ATOMIC_LOAD_STORE_EXT (1 << 16) +#define CL_DEVICE_LOCAL_FP_ATOMIC_ADD_EXT (1 << 17) +#define CL_DEVICE_LOCAL_FP_ATOMIC_MIN_MAX_EXT (1 << 18) + +/* cl_device_info */ +#define CL_DEVICE_SINGLE_FP_ATOMIC_CAPABILITIES_EXT 0x4231 +#define CL_DEVICE_DOUBLE_FP_ATOMIC_CAPABILITIES_EXT 0x4232 +#define CL_DEVICE_HALF_FP_ATOMIC_CAPABILITIES_EXT 0x4233 + +/*************************************************************** +* cl_intel_create_mem_object_properties +***************************************************************/ +#define cl_intel_create_mem_object_properties 1 +#define CL_INTEL_CREATE_MEM_OBJECT_PROPERTIES_EXTENSION_NAME \ + "cl_intel_create_mem_object_properties" + + +#define CL_INTEL_CREATE_MEM_OBJECT_PROPERTIES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* cl_mem_properties */ +#define CL_MEM_LOCALLY_UNCACHED_RESOURCE_INTEL 0x4218 +#define CL_MEM_DEVICE_ID_INTEL 0x4219 + +/*************************************************************** +* cl_pocl_content_size +***************************************************************/ +#define cl_pocl_content_size 1 +#define CL_POCL_CONTENT_SIZE_EXTENSION_NAME \ + "cl_pocl_content_size" + + +#define CL_POCL_CONTENT_SIZE_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + + +typedef cl_int CL_API_CALL +clSetContentSizeBufferPoCL_t( + cl_mem buffer, + cl_mem content_size_buffer); + +typedef clSetContentSizeBufferPoCL_t * +clSetContentSizeBufferPoCL_fn CL_API_SUFFIX__VERSION_1_0; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clSetContentSizeBufferPoCL( + cl_mem buffer, + cl_mem content_size_buffer) CL_API_SUFFIX__VERSION_1_0; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_ext_image_raw10_raw12 +***************************************************************/ +#define cl_ext_image_raw10_raw12 1 +#define CL_EXT_IMAGE_RAW10_RAW12_EXTENSION_NAME \ + "cl_ext_image_raw10_raw12" + + +#define CL_EXT_IMAGE_RAW10_RAW12_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_channel_type */ +#define CL_UNSIGNED_INT_RAW10_EXT 0x10E3 +#define CL_UNSIGNED_INT_RAW12_EXT 0x10E4 + +/*************************************************************** +* cl_khr_3d_image_writes +***************************************************************/ +#define cl_khr_3d_image_writes 1 +#define CL_KHR_3D_IMAGE_WRITES_EXTENSION_NAME \ + "cl_khr_3d_image_writes" + + +#define CL_KHR_3D_IMAGE_WRITES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_async_work_group_copy_fence +***************************************************************/ +#define cl_khr_async_work_group_copy_fence 1 +#define CL_KHR_ASYNC_WORK_GROUP_COPY_FENCE_EXTENSION_NAME \ + "cl_khr_async_work_group_copy_fence" + + +#define CL_KHR_ASYNC_WORK_GROUP_COPY_FENCE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_byte_addressable_store +***************************************************************/ +#define cl_khr_byte_addressable_store 1 +#define CL_KHR_BYTE_ADDRESSABLE_STORE_EXTENSION_NAME \ + "cl_khr_byte_addressable_store" + + +#define CL_KHR_BYTE_ADDRESSABLE_STORE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_device_enqueue_local_arg_types +***************************************************************/ +#define cl_khr_device_enqueue_local_arg_types 1 +#define CL_KHR_DEVICE_ENQUEUE_LOCAL_ARG_TYPES_EXTENSION_NAME \ + "cl_khr_device_enqueue_local_arg_types" + + +#define CL_KHR_DEVICE_ENQUEUE_LOCAL_ARG_TYPES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_expect_assume +***************************************************************/ +#define cl_khr_expect_assume 1 +#define CL_KHR_EXPECT_ASSUME_EXTENSION_NAME \ + "cl_khr_expect_assume" + + +#define CL_KHR_EXPECT_ASSUME_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_extended_async_copies +***************************************************************/ +#define cl_khr_extended_async_copies 1 +#define CL_KHR_EXTENDED_ASYNC_COPIES_EXTENSION_NAME \ + "cl_khr_extended_async_copies" + + +#define CL_KHR_EXTENDED_ASYNC_COPIES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_extended_bit_ops +***************************************************************/ +#define cl_khr_extended_bit_ops 1 +#define CL_KHR_EXTENDED_BIT_OPS_EXTENSION_NAME \ + "cl_khr_extended_bit_ops" + + +#define CL_KHR_EXTENDED_BIT_OPS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_external_memory_android_hardware_buffer (beta) +***************************************************************/ +#if defined(CL_ENABLE_BETA_EXTENSIONS) + +#define cl_khr_external_memory_android_hardware_buffer 1 +#define CL_KHR_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME \ + "cl_khr_external_memory_android_hardware_buffer" + + +#define CL_KHR_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 2) + +/* cl_external_memory_handle_type_khr */ +#define CL_EXTERNAL_MEMORY_HANDLE_ANDROID_HARDWARE_BUFFER_KHR 0x2070 + +#endif /* defined(CL_ENABLE_BETA_EXTENSIONS) */ + +/*************************************************************** +* cl_khr_global_int32_base_atomics +***************************************************************/ +#define cl_khr_global_int32_base_atomics 1 +#define CL_KHR_GLOBAL_INT32_BASE_ATOMICS_EXTENSION_NAME \ + "cl_khr_global_int32_base_atomics" + + +#define CL_KHR_GLOBAL_INT32_BASE_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_global_int32_extended_atomics +***************************************************************/ +#define cl_khr_global_int32_extended_atomics 1 +#define CL_KHR_GLOBAL_INT32_EXTENDED_ATOMICS_EXTENSION_NAME \ + "cl_khr_global_int32_extended_atomics" + + +#define CL_KHR_GLOBAL_INT32_EXTENDED_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_int64_base_atomics +***************************************************************/ +#define cl_khr_int64_base_atomics 1 +#define CL_KHR_INT64_BASE_ATOMICS_EXTENSION_NAME \ + "cl_khr_int64_base_atomics" + + +#define CL_KHR_INT64_BASE_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_int64_extended_atomics +***************************************************************/ +#define cl_khr_int64_extended_atomics 1 +#define CL_KHR_INT64_EXTENDED_ATOMICS_EXTENSION_NAME \ + "cl_khr_int64_extended_atomics" + + +#define CL_KHR_INT64_EXTENDED_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_kernel_clock +***************************************************************/ +#define cl_khr_kernel_clock 1 +#define CL_KHR_KERNEL_CLOCK_EXTENSION_NAME \ + "cl_khr_kernel_clock" + + +#define CL_KHR_KERNEL_CLOCK_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_KERNEL_CLOCK_CAPABILITIES_KHR 0x1076 + +typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; + +/* cl_device_kernel_clock_capabilities_khr */ +#define CL_DEVICE_KERNEL_CLOCK_SCOPE_DEVICE_KHR (1 << 0) +#define CL_DEVICE_KERNEL_CLOCK_SCOPE_WORK_GROUP_KHR (1 << 1) +#define CL_DEVICE_KERNEL_CLOCK_SCOPE_SUB_GROUP_KHR (1 << 2) + +/*************************************************************** +* cl_khr_local_int32_base_atomics +***************************************************************/ +#define cl_khr_local_int32_base_atomics 1 +#define CL_KHR_LOCAL_INT32_BASE_ATOMICS_EXTENSION_NAME \ + "cl_khr_local_int32_base_atomics" + + +#define CL_KHR_LOCAL_INT32_BASE_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_local_int32_extended_atomics +***************************************************************/ +#define cl_khr_local_int32_extended_atomics 1 +#define CL_KHR_LOCAL_INT32_EXTENDED_ATOMICS_EXTENSION_NAME \ + "cl_khr_local_int32_extended_atomics" + + +#define CL_KHR_LOCAL_INT32_EXTENDED_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_mipmap_image_writes +***************************************************************/ +#define cl_khr_mipmap_image_writes 1 +#define CL_KHR_MIPMAP_IMAGE_WRITES_EXTENSION_NAME \ + "cl_khr_mipmap_image_writes" + + +#define CL_KHR_MIPMAP_IMAGE_WRITES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_select_fprounding_mode +***************************************************************/ +#define cl_khr_select_fprounding_mode 1 +#define CL_KHR_SELECT_FPROUNDING_MODE_EXTENSION_NAME \ + "cl_khr_select_fprounding_mode" + + +#define CL_KHR_SELECT_FPROUNDING_MODE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_spirv_extended_debug_info +***************************************************************/ +#define cl_khr_spirv_extended_debug_info 1 +#define CL_KHR_SPIRV_EXTENDED_DEBUG_INFO_EXTENSION_NAME \ + "cl_khr_spirv_extended_debug_info" + + +#define CL_KHR_SPIRV_EXTENDED_DEBUG_INFO_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_spirv_linkonce_odr +***************************************************************/ +#define cl_khr_spirv_linkonce_odr 1 +#define CL_KHR_SPIRV_LINKONCE_ODR_EXTENSION_NAME \ + "cl_khr_spirv_linkonce_odr" + + +#define CL_KHR_SPIRV_LINKONCE_ODR_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_spirv_no_integer_wrap_decoration +***************************************************************/ +#define cl_khr_spirv_no_integer_wrap_decoration 1 +#define CL_KHR_SPIRV_NO_INTEGER_WRAP_DECORATION_EXTENSION_NAME \ + "cl_khr_spirv_no_integer_wrap_decoration" + + +#define CL_KHR_SPIRV_NO_INTEGER_WRAP_DECORATION_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_spirv_queries +***************************************************************/ +#define cl_khr_spirv_queries 1 +#define CL_KHR_SPIRV_QUERIES_EXTENSION_NAME \ + "cl_khr_spirv_queries" + + +#define CL_KHR_SPIRV_QUERIES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_device_info */ +#define CL_DEVICE_SPIRV_EXTENDED_INSTRUCTION_SETS_KHR 0x12B9 +#define CL_DEVICE_SPIRV_EXTENSIONS_KHR 0x12BA +#define CL_DEVICE_SPIRV_CAPABILITIES_KHR 0x12BB + +/*************************************************************** +* cl_khr_srgb_image_writes +***************************************************************/ +#define cl_khr_srgb_image_writes 1 +#define CL_KHR_SRGB_IMAGE_WRITES_EXTENSION_NAME \ + "cl_khr_srgb_image_writes" + + +#define CL_KHR_SRGB_IMAGE_WRITES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_subgroup_ballot +***************************************************************/ +#define cl_khr_subgroup_ballot 1 +#define CL_KHR_SUBGROUP_BALLOT_EXTENSION_NAME \ + "cl_khr_subgroup_ballot" + + +#define CL_KHR_SUBGROUP_BALLOT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_subgroup_clustered_reduce +***************************************************************/ +#define cl_khr_subgroup_clustered_reduce 1 +#define CL_KHR_SUBGROUP_CLUSTERED_REDUCE_EXTENSION_NAME \ + "cl_khr_subgroup_clustered_reduce" + + +#define CL_KHR_SUBGROUP_CLUSTERED_REDUCE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_subgroup_extended_types +***************************************************************/ +#define cl_khr_subgroup_extended_types 1 +#define CL_KHR_SUBGROUP_EXTENDED_TYPES_EXTENSION_NAME \ + "cl_khr_subgroup_extended_types" + + +#define CL_KHR_SUBGROUP_EXTENDED_TYPES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_subgroup_non_uniform_arithmetic +***************************************************************/ +#define cl_khr_subgroup_non_uniform_arithmetic 1 +#define CL_KHR_SUBGROUP_NON_UNIFORM_ARITHMETIC_EXTENSION_NAME \ + "cl_khr_subgroup_non_uniform_arithmetic" + + +#define CL_KHR_SUBGROUP_NON_UNIFORM_ARITHMETIC_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_subgroup_non_uniform_vote +***************************************************************/ +#define cl_khr_subgroup_non_uniform_vote 1 +#define CL_KHR_SUBGROUP_NON_UNIFORM_VOTE_EXTENSION_NAME \ + "cl_khr_subgroup_non_uniform_vote" + + +#define CL_KHR_SUBGROUP_NON_UNIFORM_VOTE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_subgroup_rotate +***************************************************************/ +#define cl_khr_subgroup_rotate 1 +#define CL_KHR_SUBGROUP_ROTATE_EXTENSION_NAME \ + "cl_khr_subgroup_rotate" + + +#define CL_KHR_SUBGROUP_ROTATE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_subgroup_shuffle +***************************************************************/ +#define cl_khr_subgroup_shuffle 1 +#define CL_KHR_SUBGROUP_SHUFFLE_EXTENSION_NAME \ + "cl_khr_subgroup_shuffle" + + +#define CL_KHR_SUBGROUP_SHUFFLE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_subgroup_shuffle_relative +***************************************************************/ +#define cl_khr_subgroup_shuffle_relative 1 +#define CL_KHR_SUBGROUP_SHUFFLE_RELATIVE_EXTENSION_NAME \ + "cl_khr_subgroup_shuffle_relative" + + +#define CL_KHR_SUBGROUP_SHUFFLE_RELATIVE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_khr_work_group_uniform_arithmetic +***************************************************************/ +#define cl_khr_work_group_uniform_arithmetic 1 +#define CL_KHR_WORK_GROUP_UNIFORM_ARITHMETIC_EXTENSION_NAME \ + "cl_khr_work_group_uniform_arithmetic" + + +#define CL_KHR_WORK_GROUP_UNIFORM_ARITHMETIC_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/*************************************************************** +* cl_ext_buffer_device_address +***************************************************************/ +#define cl_ext_buffer_device_address 1 +#define CL_EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME \ + "cl_ext_buffer_device_address" + + +#define CL_EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 2) + +typedef cl_ulong cl_mem_device_address_ext; + + +typedef cl_int CL_API_CALL +clSetKernelArgDevicePointerEXT_t( + cl_kernel kernel, + cl_uint arg_index, + cl_mem_device_address_ext arg_value); + +typedef clSetKernelArgDevicePointerEXT_t * +clSetKernelArgDevicePointerEXT_fn CL_API_SUFFIX__VERSION_3_0; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clSetKernelArgDevicePointerEXT( + cl_kernel kernel, + cl_uint arg_index, + cl_mem_device_address_ext arg_value) CL_API_SUFFIX__VERSION_3_0; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/* cl_mem_properties */ +#define CL_MEM_DEVICE_PRIVATE_ADDRESS_EXT 0x5000 + +/* cl_mem_info */ +#define CL_MEM_DEVICE_ADDRESS_EXT 0x5001 + +/* cl_kernel_exec_info */ +#define CL_KERNEL_EXEC_INFO_DEVICE_PTRS_EXT 0x5002 + +/*************************************************************** +* cl_ext_image_unorm_int_2_101010 +***************************************************************/ +#define cl_ext_image_unorm_int_2_101010 1 +#define CL_EXT_IMAGE_UNORM_INT_2_101010_EXTENSION_NAME \ + "cl_ext_image_unorm_int_2_101010" + + +#define CL_EXT_IMAGE_UNORM_INT_2_101010_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_channel_type */ +#define CL_UNORM_INT_2_101010_EXT 0x10E5 + +/*************************************************************** +* cl_ext_image_unsigned_10x6_12x4_14x2 +***************************************************************/ +#define cl_ext_image_unsigned_10x6_12x4_14x2 1 +#define CL_EXT_IMAGE_UNSIGNED_10X6_12X4_14X2_EXTENSION_NAME \ + "cl_ext_image_unsigned_10x6_12x4_14x2" + + +#define CL_EXT_IMAGE_UNSIGNED_10X6_12X4_14X2_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_channel_type */ +#define CL_UNSIGNED_INT10X6_EXT 0x10E6 +#define CL_UNSIGNED_INT12X4_EXT 0x10E7 +#define CL_UNSIGNED_INT14X2_EXT 0x10E8 +#define CL_UNORM_INT10X6_EXT 0x10E1 +#define CL_UNORM_INT12X4_EXT 0x10E9 +#define CL_UNORM_INT14X2_EXT 0x10EA + +/*************************************************************** +* cl_ext_immutable_memory_objects +***************************************************************/ +#define cl_ext_immutable_memory_objects 1 +#define CL_EXT_IMMUTABLE_MEMORY_OBJECTS_EXTENSION_NAME \ + "cl_ext_immutable_memory_objects" + + +#define CL_EXT_IMMUTABLE_MEMORY_OBJECTS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_mem_flags */ +#define CL_MEM_IMMUTABLE_EXT (1 << 6) + +/*************************************************************** +* cl_img_cancel_command +***************************************************************/ +#define cl_img_cancel_command 1 +#define CL_IMG_CANCEL_COMMAND_EXTENSION_NAME \ + "cl_img_cancel_command" + + +#define CL_IMG_CANCEL_COMMAND_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* Error codes */ +#define CL_CANCELLED_IMG -1126 + + +typedef cl_int CL_API_CALL +clCancelCommandsIMG_t( + const cl_event* event_list, + size_t num_events_in_list); + +typedef clCancelCommandsIMG_t * +clCancelCommandsIMG_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clCancelCommandsIMG( + const cl_event* event_list, + size_t num_events_in_list) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_qcom_perf_hint +***************************************************************/ +#define cl_qcom_perf_hint 1 +#define CL_QCOM_PERF_HINT_EXTENSION_NAME \ + "cl_qcom_perf_hint" + + +#define CL_QCOM_PERF_HINT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 5) + +typedef cl_uint cl_perf_hint_qcom; + +/* cl_perf_hint_qcom */ +#define CL_PERF_HINT_HIGH_QCOM 0x40C3 +#define CL_PERF_HINT_NORMAL_QCOM 0x40C4 +#define CL_PERF_HINT_LOW_QCOM 0x40C5 + +/* cl_context_info */ +#define CL_CONTEXT_PERF_HINT_QCOM 0x40C2 + + +typedef cl_int CL_API_CALL +clSetPerfHintQCOM_t( + cl_context context, + cl_perf_hint_qcom perf_hint); + +typedef clSetPerfHintQCOM_t * +clSetPerfHintQCOM_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clSetPerfHintQCOM( + cl_context context, + cl_perf_hint_qcom perf_hint) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_CL_EXT_H_ */ diff --git a/lib/opencl_3.0.0/CL/cl_ext_intel.h b/lib/opencl_v2025.07.22/CL/cl_ext_intel.h similarity index 100% rename from lib/opencl_3.0.0/CL/cl_ext_intel.h rename to lib/opencl_v2025.07.22/CL/cl_ext_intel.h diff --git a/lib/opencl_v2025.07.22/CL/cl_function_types.h b/lib/opencl_v2025.07.22/CL/cl_function_types.h new file mode 100644 index 00000000000..124f53ba7ec --- /dev/null +++ b/lib/opencl_v2025.07.22/CL/cl_function_types.h @@ -0,0 +1,1184 @@ +/* + * Copyright (c) 2023 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. + * + * OpenCL is a trademark of Apple Inc. used under license by Khronos. + */ + +#ifndef OPENCL_CL_FUNCTION_TYPES_H_ +#define OPENCL_CL_FUNCTION_TYPES_H_ + +#include + +typedef cl_int CL_API_CALL clGetPlatformIDs_t( + cl_uint num_entries, + cl_platform_id* platforms, + cl_uint* num_platforms); + +typedef clGetPlatformIDs_t * +clGetPlatformIDs_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetPlatformInfo_t( + cl_platform_id platform, + cl_platform_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetPlatformInfo_t * +clGetPlatformInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetDeviceIDs_t( + cl_platform_id platform, + cl_device_type device_type, + cl_uint num_entries, + cl_device_id* devices, + cl_uint* num_devices); + +typedef clGetDeviceIDs_t * +clGetDeviceIDs_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetDeviceInfo_t( + cl_device_id device, + cl_device_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetDeviceInfo_t * +clGetDeviceInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_context CL_API_CALL clCreateContext_t( + 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); + +typedef clCreateContext_t * +clCreateContext_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_context CL_API_CALL clCreateContextFromType_t( + 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); + +typedef clCreateContextFromType_t * +clCreateContextFromType_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clRetainContext_t( + cl_context context); + +typedef clRetainContext_t * +clRetainContext_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clReleaseContext_t( + cl_context context); + +typedef clReleaseContext_t * +clReleaseContext_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetContextInfo_t( + cl_context context, + cl_context_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetContextInfo_t * +clGetContextInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clRetainCommandQueue_t( + cl_command_queue command_queue); + +typedef clRetainCommandQueue_t * +clRetainCommandQueue_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clReleaseCommandQueue_t( + cl_command_queue command_queue); + +typedef clReleaseCommandQueue_t * +clReleaseCommandQueue_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetCommandQueueInfo_t( + 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); + +typedef clGetCommandQueueInfo_t * +clGetCommandQueueInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_mem CL_API_CALL clCreateBuffer_t( + cl_context context, + cl_mem_flags flags, + size_t size, + void* host_ptr, + cl_int* errcode_ret); + +typedef clCreateBuffer_t * +clCreateBuffer_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clRetainMemObject_t( + cl_mem memobj); + +typedef clRetainMemObject_t * +clRetainMemObject_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clReleaseMemObject_t( + cl_mem memobj); + +typedef clReleaseMemObject_t * +clReleaseMemObject_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetSupportedImageFormats_t( + 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); + +typedef clGetSupportedImageFormats_t * +clGetSupportedImageFormats_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetMemObjectInfo_t( + cl_mem memobj, + cl_mem_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetMemObjectInfo_t * +clGetMemObjectInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetImageInfo_t( + cl_mem image, + cl_image_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetImageInfo_t * +clGetImageInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clRetainSampler_t( + cl_sampler sampler); + +typedef clRetainSampler_t * +clRetainSampler_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clReleaseSampler_t( + cl_sampler sampler); + +typedef clReleaseSampler_t * +clReleaseSampler_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetSamplerInfo_t( + cl_sampler sampler, + cl_sampler_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetSamplerInfo_t * +clGetSamplerInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_program CL_API_CALL clCreateProgramWithSource_t( + cl_context context, + cl_uint count, + const char** strings, + const size_t* lengths, + cl_int* errcode_ret); + +typedef clCreateProgramWithSource_t * +clCreateProgramWithSource_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_program CL_API_CALL clCreateProgramWithBinary_t( + 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); + +typedef clCreateProgramWithBinary_t * +clCreateProgramWithBinary_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clRetainProgram_t( + cl_program program); + +typedef clRetainProgram_t * +clRetainProgram_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clReleaseProgram_t( + cl_program program); + +typedef clReleaseProgram_t * +clReleaseProgram_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clBuildProgram_t( + 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); + +typedef clBuildProgram_t * +clBuildProgram_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetProgramInfo_t( + cl_program program, + cl_program_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetProgramInfo_t * +clGetProgramInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetProgramBuildInfo_t( + 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); + +typedef clGetProgramBuildInfo_t * +clGetProgramBuildInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_kernel CL_API_CALL clCreateKernel_t( + cl_program program, + const char* kernel_name, + cl_int* errcode_ret); + +typedef clCreateKernel_t * +clCreateKernel_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clCreateKernelsInProgram_t( + cl_program program, + cl_uint num_kernels, + cl_kernel* kernels, + cl_uint* num_kernels_ret); + +typedef clCreateKernelsInProgram_t * +clCreateKernelsInProgram_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clRetainKernel_t( + cl_kernel kernel); + +typedef clRetainKernel_t * +clRetainKernel_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clReleaseKernel_t( + cl_kernel kernel); + +typedef clReleaseKernel_t * +clReleaseKernel_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clSetKernelArg_t( + cl_kernel kernel, + cl_uint arg_index, + size_t arg_size, + const void* arg_value); + +typedef clSetKernelArg_t * +clSetKernelArg_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetKernelInfo_t( + cl_kernel kernel, + cl_kernel_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetKernelInfo_t * +clGetKernelInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetKernelWorkGroupInfo_t( + 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); + +typedef clGetKernelWorkGroupInfo_t * +clGetKernelWorkGroupInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clWaitForEvents_t( + cl_uint num_events, + const cl_event* event_list); + +typedef clWaitForEvents_t * +clWaitForEvents_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetEventInfo_t( + cl_event event, + cl_event_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetEventInfo_t * +clGetEventInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clRetainEvent_t( + cl_event event); + +typedef clRetainEvent_t * +clRetainEvent_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clReleaseEvent_t( + cl_event event); + +typedef clReleaseEvent_t * +clReleaseEvent_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clGetEventProfilingInfo_t( + cl_event event, + cl_profiling_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetEventProfilingInfo_t * +clGetEventProfilingInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clFlush_t( + cl_command_queue command_queue); + +typedef clFlush_t * +clFlush_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clFinish_t( + cl_command_queue command_queue); + +typedef clFinish_t * +clFinish_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clEnqueueReadBuffer_t( + 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); + +typedef clEnqueueReadBuffer_t * +clEnqueueReadBuffer_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clEnqueueWriteBuffer_t( + 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); + +typedef clEnqueueWriteBuffer_t * +clEnqueueWriteBuffer_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clEnqueueCopyBuffer_t( + 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); + +typedef clEnqueueCopyBuffer_t * +clEnqueueCopyBuffer_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clEnqueueReadImage_t( + 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); + +typedef clEnqueueReadImage_t * +clEnqueueReadImage_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clEnqueueWriteImage_t( + 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); + +typedef clEnqueueWriteImage_t * +clEnqueueWriteImage_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clEnqueueCopyImage_t( + 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); + +typedef clEnqueueCopyImage_t * +clEnqueueCopyImage_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clEnqueueCopyImageToBuffer_t( + 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); + +typedef clEnqueueCopyImageToBuffer_t * +clEnqueueCopyImageToBuffer_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clEnqueueCopyBufferToImage_t( + 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); + +typedef clEnqueueCopyBufferToImage_t * +clEnqueueCopyBufferToImage_fn CL_API_SUFFIX__VERSION_1_0; + +typedef void* CL_API_CALL clEnqueueMapBuffer_t( + 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); + +typedef clEnqueueMapBuffer_t * +clEnqueueMapBuffer_fn CL_API_SUFFIX__VERSION_1_0; + +typedef void* CL_API_CALL clEnqueueMapImage_t( + 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); + +typedef clEnqueueMapImage_t * +clEnqueueMapImage_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clEnqueueUnmapMemObject_t( + 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); + +typedef clEnqueueUnmapMemObject_t * +clEnqueueUnmapMemObject_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clEnqueueNDRangeKernel_t( + 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); + +typedef clEnqueueNDRangeKernel_t * +clEnqueueNDRangeKernel_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clEnqueueNativeKernel_t( + 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); + +typedef clEnqueueNativeKernel_t * +clEnqueueNativeKernel_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL clSetCommandQueueProperty_t( + cl_command_queue command_queue, + cl_command_queue_properties properties, + cl_bool enable, + cl_command_queue_properties* old_properties); + +typedef clSetCommandQueueProperty_t * +clSetCommandQueueProperty_fn CL_API_SUFFIX__VERSION_1_0_DEPRECATED; + +typedef cl_mem CL_API_CALL clCreateImage2D_t( + 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); + +typedef clCreateImage2D_t * +clCreateImage2D_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +typedef cl_mem CL_API_CALL clCreateImage3D_t( + 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); + +typedef clCreateImage3D_t * +clCreateImage3D_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +typedef cl_int CL_API_CALL clEnqueueMarker_t( + cl_command_queue command_queue, + cl_event* event); + +typedef clEnqueueMarker_t * +clEnqueueMarker_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +typedef cl_int CL_API_CALL clEnqueueWaitForEvents_t( + cl_command_queue command_queue, + cl_uint num_events, + const cl_event* event_list); + +typedef clEnqueueWaitForEvents_t * +clEnqueueWaitForEvents_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +typedef cl_int CL_API_CALL clEnqueueBarrier_t( + cl_command_queue command_queue); + +typedef clEnqueueBarrier_t * +clEnqueueBarrier_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +typedef cl_int CL_API_CALL clUnloadCompiler_t( + void ); + +typedef clUnloadCompiler_t * +clUnloadCompiler_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +typedef void* CL_API_CALL clGetExtensionFunctionAddress_t( + const char* func_name); + +typedef clGetExtensionFunctionAddress_t * +clGetExtensionFunctionAddress_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +typedef cl_command_queue CL_API_CALL clCreateCommandQueue_t( + cl_context context, + cl_device_id device, + cl_command_queue_properties properties, + cl_int* errcode_ret); + +typedef clCreateCommandQueue_t * +clCreateCommandQueue_fn CL_API_SUFFIX__VERSION_1_2_DEPRECATED; + +typedef cl_sampler CL_API_CALL clCreateSampler_t( + cl_context context, + cl_bool normalized_coords, + cl_addressing_mode addressing_mode, + cl_filter_mode filter_mode, + cl_int* errcode_ret); + +typedef clCreateSampler_t * +clCreateSampler_fn CL_API_SUFFIX__VERSION_1_2_DEPRECATED; + +typedef cl_int CL_API_CALL clEnqueueTask_t( + cl_command_queue command_queue, + cl_kernel kernel, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueTask_t * +clEnqueueTask_fn CL_API_SUFFIX__VERSION_1_2_DEPRECATED; + +#ifdef CL_VERSION_1_1 + +typedef cl_mem CL_API_CALL clCreateSubBuffer_t( + cl_mem buffer, + cl_mem_flags flags, + cl_buffer_create_type buffer_create_type, + const void* buffer_create_info, + cl_int* errcode_ret); + +typedef clCreateSubBuffer_t * +clCreateSubBuffer_fn CL_API_SUFFIX__VERSION_1_1; + +typedef cl_int CL_API_CALL clSetMemObjectDestructorCallback_t( + cl_mem memobj, + void (CL_CALLBACK* pfn_notify)(cl_mem memobj, void* user_data), + void* user_data); + +typedef clSetMemObjectDestructorCallback_t * +clSetMemObjectDestructorCallback_fn CL_API_SUFFIX__VERSION_1_1; + +typedef cl_event CL_API_CALL clCreateUserEvent_t( + cl_context context, + cl_int* errcode_ret); + +typedef clCreateUserEvent_t * +clCreateUserEvent_fn CL_API_SUFFIX__VERSION_1_1; + +typedef cl_int CL_API_CALL clSetUserEventStatus_t( + cl_event event, + cl_int execution_status); + +typedef clSetUserEventStatus_t * +clSetUserEventStatus_fn CL_API_SUFFIX__VERSION_1_1; + +typedef cl_int CL_API_CALL clSetEventCallback_t( + 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); + +typedef clSetEventCallback_t * +clSetEventCallback_fn CL_API_SUFFIX__VERSION_1_1; + +typedef cl_int CL_API_CALL clEnqueueReadBufferRect_t( + 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); + +typedef clEnqueueReadBufferRect_t * +clEnqueueReadBufferRect_fn CL_API_SUFFIX__VERSION_1_1; + +typedef cl_int CL_API_CALL clEnqueueWriteBufferRect_t( + 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); + +typedef clEnqueueWriteBufferRect_t * +clEnqueueWriteBufferRect_fn CL_API_SUFFIX__VERSION_1_1; + +typedef cl_int CL_API_CALL clEnqueueCopyBufferRect_t( + 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); + +typedef clEnqueueCopyBufferRect_t * +clEnqueueCopyBufferRect_fn CL_API_SUFFIX__VERSION_1_1; + +#endif /* CL_VERSION_1_1 */ + +#ifdef CL_VERSION_1_2 + +typedef cl_int CL_API_CALL clCreateSubDevices_t( + 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); + +typedef clCreateSubDevices_t * +clCreateSubDevices_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL clRetainDevice_t( + cl_device_id device); + +typedef clRetainDevice_t * +clRetainDevice_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL clReleaseDevice_t( + cl_device_id device); + +typedef clReleaseDevice_t * +clReleaseDevice_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_mem CL_API_CALL clCreateImage_t( + 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); + +typedef clCreateImage_t * +clCreateImage_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_program CL_API_CALL clCreateProgramWithBuiltInKernels_t( + cl_context context, + cl_uint num_devices, + const cl_device_id* device_list, + const char* kernel_names, + cl_int* errcode_ret); + +typedef clCreateProgramWithBuiltInKernels_t * +clCreateProgramWithBuiltInKernels_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL clCompileProgram_t( + 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); + +typedef clCompileProgram_t * +clCompileProgram_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_program CL_API_CALL clLinkProgram_t( + 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); + +typedef clLinkProgram_t * +clLinkProgram_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL clUnloadPlatformCompiler_t( + cl_platform_id platform); + +typedef clUnloadPlatformCompiler_t * +clUnloadPlatformCompiler_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL clGetKernelArgInfo_t( + cl_kernel kernel, + cl_uint arg_index, + cl_kernel_arg_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetKernelArgInfo_t * +clGetKernelArgInfo_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL clEnqueueFillBuffer_t( + 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); + +typedef clEnqueueFillBuffer_t * +clEnqueueFillBuffer_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL clEnqueueFillImage_t( + 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); + +typedef clEnqueueFillImage_t * +clEnqueueFillImage_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL clEnqueueMigrateMemObjects_t( + 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); + +typedef clEnqueueMigrateMemObjects_t * +clEnqueueMigrateMemObjects_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL clEnqueueMarkerWithWaitList_t( + cl_command_queue command_queue, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueMarkerWithWaitList_t * +clEnqueueMarkerWithWaitList_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL clEnqueueBarrierWithWaitList_t( + cl_command_queue command_queue, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueBarrierWithWaitList_t * +clEnqueueBarrierWithWaitList_fn CL_API_SUFFIX__VERSION_1_2; + +typedef void* CL_API_CALL clGetExtensionFunctionAddressForPlatform_t( + cl_platform_id platform, + const char* func_name); + +typedef clGetExtensionFunctionAddressForPlatform_t * +clGetExtensionFunctionAddressForPlatform_fn CL_API_SUFFIX__VERSION_1_2; + +#endif /* CL_VERSION_1_2 */ + +#ifdef CL_VERSION_2_0 + +typedef cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties_t( + cl_context context, + cl_device_id device, + const cl_queue_properties* properties, + cl_int* errcode_ret); + +typedef clCreateCommandQueueWithProperties_t * +clCreateCommandQueueWithProperties_fn CL_API_SUFFIX__VERSION_2_0; + +typedef cl_mem CL_API_CALL clCreatePipe_t( + 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); + +typedef clCreatePipe_t * +clCreatePipe_fn CL_API_SUFFIX__VERSION_2_0; + +typedef cl_int CL_API_CALL clGetPipeInfo_t( + cl_mem pipe, + cl_pipe_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetPipeInfo_t * +clGetPipeInfo_fn CL_API_SUFFIX__VERSION_2_0; + +typedef void* CL_API_CALL clSVMAlloc_t( + cl_context context, + cl_svm_mem_flags flags, + size_t size, + cl_uint alignment); + +typedef clSVMAlloc_t * +clSVMAlloc_fn CL_API_SUFFIX__VERSION_2_0; + +typedef void CL_API_CALL clSVMFree_t( + cl_context context, + void* svm_pointer); + +typedef clSVMFree_t * +clSVMFree_fn CL_API_SUFFIX__VERSION_2_0; + +typedef cl_sampler CL_API_CALL clCreateSamplerWithProperties_t( + cl_context context, + const cl_sampler_properties* sampler_properties, + cl_int* errcode_ret); + +typedef clCreateSamplerWithProperties_t * +clCreateSamplerWithProperties_fn CL_API_SUFFIX__VERSION_2_0; + +typedef cl_int CL_API_CALL clSetKernelArgSVMPointer_t( + cl_kernel kernel, + cl_uint arg_index, + const void* arg_value); + +typedef clSetKernelArgSVMPointer_t * +clSetKernelArgSVMPointer_fn CL_API_SUFFIX__VERSION_2_0; + +typedef cl_int CL_API_CALL clSetKernelExecInfo_t( + cl_kernel kernel, + cl_kernel_exec_info param_name, + size_t param_value_size, + const void* param_value); + +typedef clSetKernelExecInfo_t * +clSetKernelExecInfo_fn CL_API_SUFFIX__VERSION_2_0; + +typedef cl_int CL_API_CALL clEnqueueSVMFree_t( + 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); + +typedef clEnqueueSVMFree_t * +clEnqueueSVMFree_fn CL_API_SUFFIX__VERSION_2_0; + +typedef cl_int CL_API_CALL clEnqueueSVMMemcpy_t( + 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); + +typedef clEnqueueSVMMemcpy_t * +clEnqueueSVMMemcpy_fn CL_API_SUFFIX__VERSION_2_0; + +typedef cl_int CL_API_CALL clEnqueueSVMMemFill_t( + 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); + +typedef clEnqueueSVMMemFill_t * +clEnqueueSVMMemFill_fn CL_API_SUFFIX__VERSION_2_0; + +typedef cl_int CL_API_CALL clEnqueueSVMMap_t( + 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); + +typedef clEnqueueSVMMap_t * +clEnqueueSVMMap_fn CL_API_SUFFIX__VERSION_2_0; + +typedef cl_int CL_API_CALL clEnqueueSVMUnmap_t( + cl_command_queue command_queue, + void* svm_ptr, + cl_uint num_events_in_wait_list, + const cl_event* event_wait_list, + cl_event* event); + +typedef clEnqueueSVMUnmap_t * +clEnqueueSVMUnmap_fn CL_API_SUFFIX__VERSION_2_0; + +#endif /* CL_VERSION_2_0 */ + +#ifdef CL_VERSION_2_1 + +typedef cl_int CL_API_CALL clSetDefaultDeviceCommandQueue_t( + cl_context context, + cl_device_id device, + cl_command_queue command_queue); + +typedef clSetDefaultDeviceCommandQueue_t * +clSetDefaultDeviceCommandQueue_fn CL_API_SUFFIX__VERSION_2_1; + +typedef cl_int CL_API_CALL clGetDeviceAndHostTimer_t( + cl_device_id device, + cl_ulong* device_timestamp, + cl_ulong* host_timestamp); + +typedef clGetDeviceAndHostTimer_t * +clGetDeviceAndHostTimer_fn CL_API_SUFFIX__VERSION_2_1; + +typedef cl_int CL_API_CALL clGetHostTimer_t( + cl_device_id device, + cl_ulong* host_timestamp); + +typedef clGetHostTimer_t * +clGetHostTimer_fn CL_API_SUFFIX__VERSION_2_1; + +typedef cl_program CL_API_CALL clCreateProgramWithIL_t( + cl_context context, + const void* il, + size_t length, + cl_int* errcode_ret); + +typedef clCreateProgramWithIL_t * +clCreateProgramWithIL_fn CL_API_SUFFIX__VERSION_2_1; + +typedef cl_kernel CL_API_CALL clCloneKernel_t( + cl_kernel source_kernel, + cl_int* errcode_ret); + +typedef clCloneKernel_t * +clCloneKernel_fn CL_API_SUFFIX__VERSION_2_1; + +typedef cl_int CL_API_CALL clGetKernelSubGroupInfo_t( + 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); + +typedef clGetKernelSubGroupInfo_t * +clGetKernelSubGroupInfo_fn CL_API_SUFFIX__VERSION_2_1; + +typedef cl_int CL_API_CALL clEnqueueSVMMigrateMem_t( + 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); + +typedef clEnqueueSVMMigrateMem_t * +clEnqueueSVMMigrateMem_fn CL_API_SUFFIX__VERSION_2_1; + +#endif /* CL_VERSION_2_1 */ + +#ifdef CL_VERSION_2_2 + +typedef cl_int CL_API_CALL clSetProgramSpecializationConstant_t( + cl_program program, + cl_uint spec_id, + size_t spec_size, + const void* spec_value); + +typedef clSetProgramSpecializationConstant_t * +clSetProgramSpecializationConstant_fn CL_API_SUFFIX__VERSION_2_2; + +typedef cl_int CL_API_CALL clSetProgramReleaseCallback_t( + cl_program program, + void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), + void* user_data); + +typedef clSetProgramReleaseCallback_t * +clSetProgramReleaseCallback_fn CL_API_SUFFIX__VERSION_2_2_DEPRECATED; + +#endif /* CL_VERSION_2_2 */ + +#ifdef CL_VERSION_3_0 + +typedef cl_int CL_API_CALL clSetContextDestructorCallback_t( + cl_context context, + void (CL_CALLBACK* pfn_notify)(cl_context context, void* user_data), + void* user_data); + +typedef clSetContextDestructorCallback_t * +clSetContextDestructorCallback_fn CL_API_SUFFIX__VERSION_3_0; + +typedef cl_mem CL_API_CALL clCreateBufferWithProperties_t( + cl_context context, + const cl_mem_properties* properties, + cl_mem_flags flags, + size_t size, + void* host_ptr, + cl_int* errcode_ret); + +typedef clCreateBufferWithProperties_t * +clCreateBufferWithProperties_fn CL_API_SUFFIX__VERSION_3_0; + +typedef cl_mem CL_API_CALL clCreateImageWithProperties_t( + 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); + +typedef clCreateImageWithProperties_t * +clCreateImageWithProperties_fn CL_API_SUFFIX__VERSION_3_0; + +#endif /* CL_VERSION_3_0 */ + +#endif /* OPENCL_CL_FUNCTION_TYPES_H_ */ diff --git a/lib/opencl_v2025.07.22/CL/cl_gl.h b/lib/opencl_v2025.07.22/CL/cl_gl.h new file mode 100644 index 00000000000..552560f71c4 --- /dev/null +++ b/lib/opencl_v2025.07.22/CL/cl_gl.h @@ -0,0 +1,421 @@ +/******************************************************************************* + * Copyright (c) 2008-2023 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_H_ +#define OPENCL_CL_GL_H_ + +/* +** This header is generated from the Khronos OpenCL XML API Registry. +*/ + +#include + +/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES) +#define CL_NO_EXTENSION_PROTOTYPES +#endif + +/* CL_NO_EXTENSION_PROTOTYPES implies + CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and + CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************** +* cl_khr_gl_sharing +***************************************************************/ +#define cl_khr_gl_sharing 1 +#define CL_KHR_GL_SHARING_EXTENSION_NAME \ + "cl_khr_gl_sharing" + + +#define CL_KHR_GL_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef int cl_GLint; +typedef unsigned int cl_GLenum; +typedef unsigned int cl_GLuint; + +typedef cl_uint cl_gl_context_info; + +/* Error codes */ +#define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000 + +/* cl_gl_context_info */ +#define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006 +#define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007 + +/* Additional cl_context_properties */ +#define CL_GL_CONTEXT_KHR 0x2008 +#define CL_EGL_DISPLAY_KHR 0x2009 +#define CL_GLX_DISPLAY_KHR 0x200A +#define CL_WGL_HDC_KHR 0x200B +#define CL_CGL_SHAREGROUP_KHR 0x200C + +typedef cl_uint cl_gl_object_type; +typedef cl_uint cl_gl_texture_info; +typedef cl_uint cl_gl_platform_info; + +/* cl_gl_object_type */ +#define CL_GL_OBJECT_BUFFER 0x2000 +#define CL_GL_OBJECT_TEXTURE2D 0x2001 +#define CL_GL_OBJECT_TEXTURE3D 0x2002 +#define CL_GL_OBJECT_RENDERBUFFER 0x2003 + +#if defined(CL_VERSION_1_2) +/* cl_gl_object_type */ +#define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E +#define CL_GL_OBJECT_TEXTURE1D 0x200F +#define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010 +#define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011 + +#endif /* defined(CL_VERSION_1_2) */ + +/* cl_gl_texture_info */ +#define CL_GL_TEXTURE_TARGET 0x2004 +#define CL_GL_MIPMAP_LEVEL 0x2005 + + +typedef cl_int CL_API_CALL +clGetGLContextInfoKHR_t( + 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); + +typedef clGetGLContextInfoKHR_t * +clGetGLContextInfoKHR_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_mem CL_API_CALL +clCreateFromGLBuffer_t( + cl_context context, + cl_mem_flags flags, + cl_GLuint bufobj, + cl_int* errcode_ret); + +typedef clCreateFromGLBuffer_t * +clCreateFromGLBuffer_fn CL_API_SUFFIX__VERSION_1_0; + +#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +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; + +extern CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromGLBuffer( + cl_context context, + cl_mem_flags flags, + cl_GLuint bufobj, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#if defined(CL_VERSION_1_2) + +typedef cl_mem CL_API_CALL +clCreateFromGLTexture_t( + cl_context context, + cl_mem_flags flags, + cl_GLenum target, + cl_GLint miplevel, + cl_GLuint texture, + cl_int* errcode_ret); + +typedef clCreateFromGLTexture_t * +clCreateFromGLTexture_fn CL_API_SUFFIX__VERSION_1_2; + +#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern 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) CL_API_SUFFIX__VERSION_1_2; + +#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#endif /* defined(CL_VERSION_1_2) */ + + +typedef cl_mem CL_API_CALL +clCreateFromGLRenderbuffer_t( + cl_context context, + cl_mem_flags flags, + cl_GLuint renderbuffer, + cl_int* errcode_ret); + +typedef clCreateFromGLRenderbuffer_t * +clCreateFromGLRenderbuffer_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL +clGetGLObjectInfo_t( + cl_mem memobj, + cl_gl_object_type* gl_object_type, + cl_GLuint* gl_object_name); + +typedef clGetGLObjectInfo_t * +clGetGLObjectInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL +clGetGLTextureInfo_t( + cl_mem memobj, + cl_gl_texture_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetGLTextureInfo_t * +clGetGLTextureInfo_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL +clEnqueueAcquireGLObjects_t( + 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 clEnqueueAcquireGLObjects_t * +clEnqueueAcquireGLObjects_fn CL_API_SUFFIX__VERSION_1_0; + +typedef cl_int CL_API_CALL +clEnqueueReleaseGLObjects_t( + 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 clEnqueueReleaseGLObjects_t * +clEnqueueReleaseGLObjects_fn CL_API_SUFFIX__VERSION_1_0; + +#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromGLRenderbuffer( + cl_context context, + cl_mem_flags flags, + cl_GLuint renderbuffer, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetGLObjectInfo( + cl_mem memobj, + cl_gl_object_type* gl_object_type, + cl_GLuint* gl_object_name) CL_API_SUFFIX__VERSION_1_0; + +extern 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) CL_API_SUFFIX__VERSION_1_0; + +extern 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) CL_API_SUFFIX__VERSION_1_0; + +extern 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) CL_API_SUFFIX__VERSION_1_0; + +#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/* OpenCL 1.0 APIs that were deprecated in OpenCL 1.2 */ + +typedef cl_mem CL_API_CALL +clCreateFromGLTexture2D_t( + cl_context context, + cl_mem_flags flags, + cl_GLenum target, + cl_GLint miplevel, + cl_GLuint texture, + cl_int* errcode_ret); + +typedef clCreateFromGLTexture2D_t * +clCreateFromGLTexture2D_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +typedef cl_mem CL_API_CALL +clCreateFromGLTexture3D_t( + cl_context context, + cl_mem_flags flags, + cl_GLenum target, + cl_GLint miplevel, + cl_GLuint texture, + cl_int* errcode_ret); + +typedef clCreateFromGLTexture3D_t * +clCreateFromGLTexture3D_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY 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) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +extern CL_API_ENTRY 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) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; + +#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_khr_gl_event +***************************************************************/ +#define cl_khr_gl_event 1 +#define CL_KHR_GL_EVENT_EXTENSION_NAME \ + "cl_khr_gl_event" + + +#define CL_KHR_GL_EVENT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef struct __GLsync * cl_GLsync; + +/* cl_command_type */ +#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D + + +typedef cl_event CL_API_CALL +clCreateEventFromGLsyncKHR_t( + cl_context context, + cl_GLsync sync, + cl_int* errcode_ret); + +typedef clCreateEventFromGLsyncKHR_t * +clCreateEventFromGLsyncKHR_fn CL_API_SUFFIX__VERSION_1_1; + +#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +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 /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_khr_gl_depth_images +***************************************************************/ +#define cl_khr_gl_depth_images 1 +#define CL_KHR_GL_DEPTH_IMAGES_EXTENSION_NAME \ + "cl_khr_gl_depth_images" + + +#define CL_KHR_GL_DEPTH_IMAGES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_channel_order */ +#define CL_DEPTH_STENCIL 0x10BE + +/* cl_channel_type */ +#define CL_UNORM_INT24 0x10DF + +/*************************************************************** +* cl_khr_gl_msaa_sharing +***************************************************************/ +#define cl_khr_gl_msaa_sharing 1 +#define CL_KHR_GL_MSAA_SHARING_EXTENSION_NAME \ + "cl_khr_gl_msaa_sharing" + + +#define CL_KHR_GL_MSAA_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +/* cl_gl_texture_info */ +#define CL_GL_NUM_SAMPLES 0x2012 + +/*************************************************************** +* cl_intel_sharing_format_query_gl +***************************************************************/ +#define cl_intel_sharing_format_query_gl 1 +#define CL_INTEL_SHARING_FORMAT_QUERY_GL_EXTENSION_NAME \ + "cl_intel_sharing_format_query_gl" + + +#define CL_INTEL_SHARING_FORMAT_QUERY_GL_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* when cl_khr_gl_sharing is supported */ + +typedef cl_int CL_API_CALL +clGetSupportedGLTextureFormatsINTEL_t( + cl_context context, + cl_mem_flags flags, + cl_mem_object_type image_type, + cl_uint num_entries, + cl_GLenum* gl_formats, + cl_uint* num_texture_formats); + +typedef clGetSupportedGLTextureFormatsINTEL_t * +clGetSupportedGLTextureFormatsINTEL_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetSupportedGLTextureFormatsINTEL( + cl_context context, + cl_mem_flags flags, + cl_mem_object_type image_type, + cl_uint num_entries, + cl_GLenum* gl_formats, + cl_uint* num_texture_formats) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_CL_GL_H_ */ diff --git a/lib/opencl_3.0.0/CL/cl_gl_ext.h b/lib/opencl_v2025.07.22/CL/cl_gl_ext.h similarity index 92% rename from lib/opencl_3.0.0/CL/cl_gl_ext.h rename to lib/opencl_v2025.07.22/CL/cl_gl_ext.h index 8ec8181674d..b5da13eb670 100644 --- a/lib/opencl_3.0.0/CL/cl_gl_ext.h +++ b/lib/opencl_v2025.07.22/CL/cl_gl_ext.h @@ -15,4 +15,4 @@ ******************************************************************************/ #include -#pragma message("All OpenGL-related extensions have been moved into cl_gl.h. Please include cl_gl.h directly.") +#pragma message("The extensions in cl_gl_ext.h have been moved into cl_gl.h. Please include cl_gl.h directly.") diff --git a/lib/opencl_3.0.0/CL/cl_half.h b/lib/opencl_v2025.07.22/CL/cl_half.h similarity index 100% rename from lib/opencl_3.0.0/CL/cl_half.h rename to lib/opencl_v2025.07.22/CL/cl_half.h diff --git a/lib/opencl_v2025.07.22/CL/cl_icd.h b/lib/opencl_v2025.07.22/CL/cl_icd.h new file mode 100644 index 00000000000..bce60ea25b4 --- /dev/null +++ b/lib/opencl_v2025.07.22/CL/cl_icd.h @@ -0,0 +1,342 @@ +/******************************************************************************* + * Copyright (c) 2019-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_ICD_H +#define OPENCL_CL_ICD_H + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#include +#include +#include +#endif + +#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__ + /* Disable warning C4201: nonstandard extension used : nameless struct/union */ + #pragma warning( push ) + #pragma warning( disable : 4201 ) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Vendor dispatch table structure */ + +typedef struct _cl_icd_dispatch { + /* OpenCL 1.0 */ +#if __CL_HAS_ANON_STRUCT__ + __CL_ANON_STRUCT__ union { +#endif + clGetPlatformIDs_t *clGetPlatformIDs; +#if __CL_HAS_ANON_STRUCT__ + /* Set to CL_ICD2_TAG_KHR for cl_khr_icd 2.0.0 */ + intptr_t clGetPlatformIDs_icd2_tag; + }; +#endif + clGetPlatformInfo_t *clGetPlatformInfo; + clGetDeviceIDs_t *clGetDeviceIDs; + clGetDeviceInfo_t *clGetDeviceInfo; + clCreateContext_t *clCreateContext; + clCreateContextFromType_t *clCreateContextFromType; + clRetainContext_t *clRetainContext; + clReleaseContext_t *clReleaseContext; + clGetContextInfo_t *clGetContextInfo; + clCreateCommandQueue_t *clCreateCommandQueue; + clRetainCommandQueue_t *clRetainCommandQueue; + clReleaseCommandQueue_t *clReleaseCommandQueue; + clGetCommandQueueInfo_t *clGetCommandQueueInfo; + clSetCommandQueueProperty_t *clSetCommandQueueProperty; + clCreateBuffer_t *clCreateBuffer; + clCreateImage2D_t *clCreateImage2D; + clCreateImage3D_t *clCreateImage3D; + clRetainMemObject_t *clRetainMemObject; + clReleaseMemObject_t *clReleaseMemObject; + clGetSupportedImageFormats_t *clGetSupportedImageFormats; + clGetMemObjectInfo_t *clGetMemObjectInfo; + clGetImageInfo_t *clGetImageInfo; + clCreateSampler_t *clCreateSampler; + clRetainSampler_t *clRetainSampler; + clReleaseSampler_t *clReleaseSampler; + clGetSamplerInfo_t *clGetSamplerInfo; + clCreateProgramWithSource_t *clCreateProgramWithSource; + clCreateProgramWithBinary_t *clCreateProgramWithBinary; + clRetainProgram_t *clRetainProgram; + clReleaseProgram_t *clReleaseProgram; + clBuildProgram_t *clBuildProgram; +#if __CL_HAS_ANON_STRUCT__ + __CL_ANON_STRUCT__ union { +#endif + clUnloadCompiler_t *clUnloadCompiler; +#if __CL_HAS_ANON_STRUCT__ + /* Set to CL_ICD2_TAG_KHR for cl_khr_icd 2.0.0 */ + intptr_t clUnloadCompiler_icd2_tag; + }; +#endif + clGetProgramInfo_t *clGetProgramInfo; + clGetProgramBuildInfo_t *clGetProgramBuildInfo; + clCreateKernel_t *clCreateKernel; + clCreateKernelsInProgram_t *clCreateKernelsInProgram; + clRetainKernel_t *clRetainKernel; + clReleaseKernel_t *clReleaseKernel; + clSetKernelArg_t *clSetKernelArg; + clGetKernelInfo_t *clGetKernelInfo; + clGetKernelWorkGroupInfo_t *clGetKernelWorkGroupInfo; + clWaitForEvents_t *clWaitForEvents; + clGetEventInfo_t *clGetEventInfo; + clRetainEvent_t *clRetainEvent; + clReleaseEvent_t *clReleaseEvent; + clGetEventProfilingInfo_t *clGetEventProfilingInfo; + clFlush_t *clFlush; + clFinish_t *clFinish; + clEnqueueReadBuffer_t *clEnqueueReadBuffer; + clEnqueueWriteBuffer_t *clEnqueueWriteBuffer; + clEnqueueCopyBuffer_t *clEnqueueCopyBuffer; + clEnqueueReadImage_t *clEnqueueReadImage; + clEnqueueWriteImage_t *clEnqueueWriteImage; + clEnqueueCopyImage_t *clEnqueueCopyImage; + clEnqueueCopyImageToBuffer_t *clEnqueueCopyImageToBuffer; + clEnqueueCopyBufferToImage_t *clEnqueueCopyBufferToImage; + clEnqueueMapBuffer_t *clEnqueueMapBuffer; + clEnqueueMapImage_t *clEnqueueMapImage; + clEnqueueUnmapMemObject_t *clEnqueueUnmapMemObject; + clEnqueueNDRangeKernel_t *clEnqueueNDRangeKernel; + clEnqueueTask_t *clEnqueueTask; + clEnqueueNativeKernel_t *clEnqueueNativeKernel; + clEnqueueMarker_t *clEnqueueMarker; + clEnqueueWaitForEvents_t *clEnqueueWaitForEvents; + clEnqueueBarrier_t *clEnqueueBarrier; + clGetExtensionFunctionAddress_t *clGetExtensionFunctionAddress; + clCreateFromGLBuffer_t *clCreateFromGLBuffer; + clCreateFromGLTexture2D_t *clCreateFromGLTexture2D; + clCreateFromGLTexture3D_t *clCreateFromGLTexture3D; + clCreateFromGLRenderbuffer_t *clCreateFromGLRenderbuffer; + clGetGLObjectInfo_t *clGetGLObjectInfo; + clGetGLTextureInfo_t *clGetGLTextureInfo; + clEnqueueAcquireGLObjects_t *clEnqueueAcquireGLObjects; + clEnqueueReleaseGLObjects_t *clEnqueueReleaseGLObjects; + clGetGLContextInfoKHR_t *clGetGLContextInfoKHR; + + /* cl_khr_d3d10_sharing */ +#ifdef _WIN32 + clGetDeviceIDsFromD3D10KHR_t *clGetDeviceIDsFromD3D10KHR; + clCreateFromD3D10BufferKHR_t *clCreateFromD3D10BufferKHR; + clCreateFromD3D10Texture2DKHR_t *clCreateFromD3D10Texture2DKHR; + clCreateFromD3D10Texture3DKHR_t *clCreateFromD3D10Texture3DKHR; + clEnqueueAcquireD3D10ObjectsKHR_t *clEnqueueAcquireD3D10ObjectsKHR; + clEnqueueReleaseD3D10ObjectsKHR_t *clEnqueueReleaseD3D10ObjectsKHR; +#else + void *clGetDeviceIDsFromD3D10KHR; + void *clCreateFromD3D10BufferKHR; + void *clCreateFromD3D10Texture2DKHR; + void *clCreateFromD3D10Texture3DKHR; + void *clEnqueueAcquireD3D10ObjectsKHR; + void *clEnqueueReleaseD3D10ObjectsKHR; +#endif + + /* OpenCL 1.1 */ +#ifdef CL_VERSION_1_1 + clSetEventCallback_t *clSetEventCallback; + clCreateSubBuffer_t *clCreateSubBuffer; + clSetMemObjectDestructorCallback_t *clSetMemObjectDestructorCallback; + clCreateUserEvent_t *clCreateUserEvent; + clSetUserEventStatus_t *clSetUserEventStatus; + clEnqueueReadBufferRect_t *clEnqueueReadBufferRect; + clEnqueueWriteBufferRect_t *clEnqueueWriteBufferRect; + clEnqueueCopyBufferRect_t *clEnqueueCopyBufferRect; +#else + void *clSetEventCallback; + void *clCreateSubBuffer; + void *clSetMemObjectDestructorCallback; + void *clCreateUserEvent; + void *clSetUserEventStatus; + void *clEnqueueReadBufferRect; + void *clEnqueueWriteBufferRect; + void *clEnqueueCopyBufferRect; +#endif + + /* cl_ext_device_fission */ + clCreateSubDevicesEXT_t *clCreateSubDevicesEXT; + clRetainDeviceEXT_t *clRetainDeviceEXT; + clReleaseDeviceEXT_t *clReleaseDeviceEXT; + + /* cl_khr_gl_event */ + clCreateEventFromGLsyncKHR_t *clCreateEventFromGLsyncKHR; + + /* OpenCL 1.2 */ +#ifdef CL_VERSION_1_2 + clCreateSubDevices_t *clCreateSubDevices; + clRetainDevice_t *clRetainDevice; + clReleaseDevice_t *clReleaseDevice; + clCreateImage_t *clCreateImage; + clCreateProgramWithBuiltInKernels_t *clCreateProgramWithBuiltInKernels; + clCompileProgram_t *clCompileProgram; + clLinkProgram_t *clLinkProgram; + clUnloadPlatformCompiler_t *clUnloadPlatformCompiler; + clGetKernelArgInfo_t *clGetKernelArgInfo; + clEnqueueFillBuffer_t *clEnqueueFillBuffer; + clEnqueueFillImage_t *clEnqueueFillImage; + clEnqueueMigrateMemObjects_t *clEnqueueMigrateMemObjects; + clEnqueueMarkerWithWaitList_t *clEnqueueMarkerWithWaitList; + clEnqueueBarrierWithWaitList_t *clEnqueueBarrierWithWaitList; + clGetExtensionFunctionAddressForPlatform_t * + clGetExtensionFunctionAddressForPlatform; + clCreateFromGLTexture_t *clCreateFromGLTexture; +#else + void *clCreateSubDevices; + void *clRetainDevice; + void *clReleaseDevice; + void *clCreateImage; + void *clCreateProgramWithBuiltInKernels; + void *clCompileProgram; + void *clLinkProgram; + void *clUnloadPlatformCompiler; + void *clGetKernelArgInfo; + void *clEnqueueFillBuffer; + void *clEnqueueFillImage; + void *clEnqueueMigrateMemObjects; + void *clEnqueueMarkerWithWaitList; + void *clEnqueueBarrierWithWaitList; + void *clGetExtensionFunctionAddressForPlatform; + void *clCreateFromGLTexture; +#endif + + /* cl_khr_d3d11_sharing and cl_khr_dx9_media_sharing */ +#ifdef _WIN32 + clGetDeviceIDsFromD3D11KHR_t *clGetDeviceIDsFromD3D11KHR; + clCreateFromD3D11BufferKHR_t *clCreateFromD3D11BufferKHR; + clCreateFromD3D11Texture2DKHR_t *clCreateFromD3D11Texture2DKHR; + clCreateFromD3D11Texture3DKHR_t *clCreateFromD3D11Texture3DKHR; + clCreateFromDX9MediaSurfaceKHR_t *clCreateFromDX9MediaSurfaceKHR; + clEnqueueAcquireD3D11ObjectsKHR_t *clEnqueueAcquireD3D11ObjectsKHR; + clEnqueueReleaseD3D11ObjectsKHR_t *clEnqueueReleaseD3D11ObjectsKHR; + clGetDeviceIDsFromDX9MediaAdapterKHR_t * + clGetDeviceIDsFromDX9MediaAdapterKHR; + clEnqueueAcquireDX9MediaSurfacesKHR_t * + clEnqueueAcquireDX9MediaSurfacesKHR; + clEnqueueReleaseDX9MediaSurfacesKHR_t * + clEnqueueReleaseDX9MediaSurfacesKHR; +#else + void *clGetDeviceIDsFromD3D11KHR; + void *clCreateFromD3D11BufferKHR; + void *clCreateFromD3D11Texture2DKHR; + void *clCreateFromD3D11Texture3DKHR; + void *clCreateFromDX9MediaSurfaceKHR; + void *clEnqueueAcquireD3D11ObjectsKHR; + void *clEnqueueReleaseD3D11ObjectsKHR; + void *clGetDeviceIDsFromDX9MediaAdapterKHR; + void *clEnqueueAcquireDX9MediaSurfacesKHR; + void *clEnqueueReleaseDX9MediaSurfacesKHR; +#endif + + /* cl_khr_egl_image */ + clCreateFromEGLImageKHR_t *clCreateFromEGLImageKHR; + clEnqueueAcquireEGLObjectsKHR_t *clEnqueueAcquireEGLObjectsKHR; + clEnqueueReleaseEGLObjectsKHR_t *clEnqueueReleaseEGLObjectsKHR; + + /* cl_khr_egl_event */ + clCreateEventFromEGLSyncKHR_t *clCreateEventFromEGLSyncKHR; + + /* OpenCL 2.0 */ +#ifdef CL_VERSION_2_0 + clCreateCommandQueueWithProperties_t *clCreateCommandQueueWithProperties; + clCreatePipe_t *clCreatePipe; + clGetPipeInfo_t *clGetPipeInfo; + clSVMAlloc_t *clSVMAlloc; + clSVMFree_t *clSVMFree; + clEnqueueSVMFree_t *clEnqueueSVMFree; + clEnqueueSVMMemcpy_t *clEnqueueSVMMemcpy; + clEnqueueSVMMemFill_t *clEnqueueSVMMemFill; + clEnqueueSVMMap_t *clEnqueueSVMMap; + clEnqueueSVMUnmap_t *clEnqueueSVMUnmap; + clCreateSamplerWithProperties_t *clCreateSamplerWithProperties; + clSetKernelArgSVMPointer_t *clSetKernelArgSVMPointer; + clSetKernelExecInfo_t *clSetKernelExecInfo; +#else + void *clCreateCommandQueueWithProperties; + void *clCreatePipe; + void *clGetPipeInfo; + void *clSVMAlloc; + void *clSVMFree; + void *clEnqueueSVMFree; + void *clEnqueueSVMMemcpy; + void *clEnqueueSVMMemFill; + void *clEnqueueSVMMap; + void *clEnqueueSVMUnmap; + void *clCreateSamplerWithProperties; + void *clSetKernelArgSVMPointer; + void *clSetKernelExecInfo; +#endif + + /* cl_khr_sub_groups */ + clGetKernelSubGroupInfoKHR_t *clGetKernelSubGroupInfoKHR; + + /* OpenCL 2.1 */ +#ifdef CL_VERSION_2_1 + clCloneKernel_t *clCloneKernel; + clCreateProgramWithIL_t *clCreateProgramWithIL; + clEnqueueSVMMigrateMem_t *clEnqueueSVMMigrateMem; + clGetDeviceAndHostTimer_t *clGetDeviceAndHostTimer; + clGetHostTimer_t *clGetHostTimer; + clGetKernelSubGroupInfo_t *clGetKernelSubGroupInfo; + clSetDefaultDeviceCommandQueue_t *clSetDefaultDeviceCommandQueue; +#else + void *clCloneKernel; + void *clCreateProgramWithIL; + void *clEnqueueSVMMigrateMem; + void *clGetDeviceAndHostTimer; + void *clGetHostTimer; + void *clGetKernelSubGroupInfo; + void *clSetDefaultDeviceCommandQueue; +#endif + + /* OpenCL 2.2 */ +#ifdef CL_VERSION_2_2 + clSetProgramReleaseCallback_t *clSetProgramReleaseCallback; + clSetProgramSpecializationConstant_t *clSetProgramSpecializationConstant; +#else + void *clSetProgramReleaseCallback; + void *clSetProgramSpecializationConstant; +#endif + + /* OpenCL 3.0 */ +#ifdef CL_VERSION_3_0 + clCreateBufferWithProperties_t *clCreateBufferWithProperties; + clCreateImageWithProperties_t *clCreateImageWithProperties; + clSetContextDestructorCallback_t *clSetContextDestructorCallback; +#else + void *clCreateBufferWithProperties; + void *clCreateImageWithProperties; + void *clSetContextDestructorCallback; +#endif + +} cl_icd_dispatch; + +#ifdef __cplusplus +} +#endif + +#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__ + #pragma warning( pop ) +#endif + +#endif /* #ifndef OPENCL_CL_ICD_H */ diff --git a/lib/opencl_v2025.07.22/CL/cl_layer.h b/lib/opencl_v2025.07.22/CL/cl_layer.h new file mode 100644 index 00000000000..245f7b53295 --- /dev/null +++ b/lib/opencl_v2025.07.22/CL/cl_layer.h @@ -0,0 +1,125 @@ +/******************************************************************************* + * Copyright (c) 2008-2023 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_LAYER_H_ +#define OPENCL_CL_LAYER_H_ + +/* +** This header is generated from the Khronos OpenCL XML API Registry. +*/ + +#include + +#include + +/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES) +#define CL_NO_EXTENSION_PROTOTYPES +#endif + +/* CL_NO_EXTENSION_PROTOTYPES implies + CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and + CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************** +* cl_loader_layers +***************************************************************/ +#define cl_loader_layers 1 +#define CL_LOADER_LAYERS_EXTENSION_NAME \ + "cl_loader_layers" + + +#define CL_LOADER_LAYERS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + +typedef cl_uint cl_layer_info; +typedef cl_uint cl_layer_api_version; + +/* cl_layer_info */ +#define CL_LAYER_API_VERSION 0x4240 +#define CL_LAYER_NAME 0x4241 + +/* Misc API enums */ +#define CL_LAYER_API_VERSION_100 100 + + +typedef cl_int CL_API_CALL +clGetLayerInfo_t( + cl_layer_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret); + +typedef clGetLayerInfo_t * +clGetLayerInfo_fn ; + +typedef cl_int CL_API_CALL +clInitLayer_t( + cl_uint num_entries, + const cl_icd_dispatch* target_dispatch, + cl_uint* num_entries_ret, + const cl_icd_dispatch** layer_dispatch_ret); + +typedef clInitLayer_t * +clInitLayer_fn ; + +/* +** The function pointer typedefs prefixed with "pfn_" are provided for +** compatibility with earlier versions of the headers. New code is +** encouraged to use the function pointer typedefs that are suffixed with +** "_fn" instead, for consistency. +*/ + +typedef clGetLayerInfo_t * +pfn_clGetLayerInfo ; + +typedef clInitLayer_t * +pfn_clInitLayer ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetLayerInfo( + cl_layer_info param_name, + size_t param_value_size, + void* param_value, + size_t* param_value_size_ret) ; + +extern CL_API_ENTRY cl_int CL_API_CALL +clInitLayer( + cl_uint num_entries, + const cl_icd_dispatch* target_dispatch, + cl_uint* num_entries_ret, + const cl_icd_dispatch** layer_dispatch_ret) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_CL_LAYER_H_ */ diff --git a/lib/opencl_3.0.0/CL/cl_platform.h b/lib/opencl_v2025.07.22/CL/cl_platform.h similarity index 98% rename from lib/opencl_3.0.0/CL/cl_platform.h rename to lib/opencl_v2025.07.22/CL/cl_platform.h index 8ae655d1435..5f92d6faad4 100644 --- a/lib/opencl_3.0.0/CL/cl_platform.h +++ b/lib/opencl_v2025.07.22/CL/cl_platform.h @@ -77,7 +77,7 @@ extern "C" { #ifdef __GNUC__ #define CL_API_SUFFIX_DEPRECATED __attribute__((deprecated)) #define CL_API_PREFIX_DEPRECATED -#elif defined(_WIN32) +#elif defined(_MSC_VER) && !defined(__clang__) #define CL_API_SUFFIX_DEPRECATED #define CL_API_PREFIX_DEPRECATED __declspec(deprecated) #else @@ -135,6 +135,11 @@ extern "C" { #if (defined (_WIN32) && defined(_MSC_VER)) +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wlanguage-extension-token" +#endif + /* intptr_t is used in cl.h and provided by stddef.h in Visual C++, but not in clang */ /* stdint.h was missing before Visual Studio 2010, include it for later versions and for clang */ #if defined(__clang__) || _MSC_VER >= 1600 @@ -155,6 +160,10 @@ typedef unsigned __int16 cl_half; typedef float cl_float; typedef double cl_double; +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + /* Macro names and corresponding values defined by OpenCL */ #define CL_CHAR_BIT 8 #define CL_SCHAR_MAX 127 @@ -352,11 +361,6 @@ typedef double cl_double; #include -/* Mirror types to GL types. Mirror types allow us to avoid deciding which 87s to load based on whether we are using GL or GLES here. */ -typedef unsigned int cl_GLuint; -typedef int cl_GLint; -typedef unsigned int cl_GLenum; - /* * Vector types * @@ -501,25 +505,26 @@ typedef unsigned int cl_GLenum; #if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #define __CL_HAS_ANON_STRUCT__ 1 #define __CL_ANON_STRUCT__ -#elif defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) +#elif defined(_WIN32) && defined(_MSC_VER) && !defined(__STDC__) +#define __CL_HAS_ANON_STRUCT__ 1 +#define __CL_ANON_STRUCT__ +#elif defined(__GNUC__) && ! defined(__STRICT_ANSI__) +#define __CL_HAS_ANON_STRUCT__ 1 +#define __CL_ANON_STRUCT__ __extension__ +#elif defined(__clang__) #define __CL_HAS_ANON_STRUCT__ 1 #define __CL_ANON_STRUCT__ __extension__ -#elif defined( _WIN32) && defined(_MSC_VER) && ! defined(__STDC__) - #if _MSC_VER >= 1500 - /* Microsoft Developer Studio 2008 supports anonymous structs, but - * complains by default. */ - #define __CL_HAS_ANON_STRUCT__ 1 - #define __CL_ANON_STRUCT__ - /* Disable warning C4201: nonstandard extension used : nameless - * struct/union */ - #pragma warning( push ) - #pragma warning( disable : 4201 ) - #endif #else #define __CL_HAS_ANON_STRUCT__ 0 #define __CL_ANON_STRUCT__ #endif +#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__ + /* Disable warning C4201: nonstandard extension used : nameless struct/union */ + #pragma warning( push ) + #pragma warning( disable : 4201 ) +#endif + /* Define alignment keys */ #if defined( __GNUC__ ) || defined(__INTEGRITY) #define CL_ALIGNED(_x) __attribute__ ((aligned(_x))) @@ -1395,10 +1400,8 @@ typedef union } #endif -#if defined( _WIN32) && defined(_MSC_VER) && ! defined(__STDC__) - #if _MSC_VER >=1500 +#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__ #pragma warning( pop ) - #endif #endif #endif /* __CL_PLATFORM_H */ diff --git a/lib/opencl_v2025.07.22/CL/cl_va_api_media_sharing_intel.h b/lib/opencl_v2025.07.22/CL/cl_va_api_media_sharing_intel.h new file mode 100644 index 00000000000..9fb8863f24d --- /dev/null +++ b/lib/opencl_v2025.07.22/CL/cl_va_api_media_sharing_intel.h @@ -0,0 +1,220 @@ +/******************************************************************************* + * Copyright (c) 2008-2023 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_VA_API_MEDIA_SHARING_INTEL_H_ +#define OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H_ + +/* +** This header is generated from the Khronos OpenCL XML API Registry. +*/ + +#include + +#include + +/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES) +#define CL_NO_EXTENSION_PROTOTYPES +#endif + +/* CL_NO_EXTENSION_PROTOTYPES implies + CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and + CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */ +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif +#if defined(CL_NO_EXTENSION_PROTOTYPES) && \ + !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) +#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************** +* cl_intel_sharing_format_query_va_api +***************************************************************/ +#define cl_intel_sharing_format_query_va_api 1 +#define CL_INTEL_SHARING_FORMAT_QUERY_VA_API_EXTENSION_NAME \ + "cl_intel_sharing_format_query_va_api" + + +#define CL_INTEL_SHARING_FORMAT_QUERY_VA_API_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +/* when cl_intel_va_api_media_sharing is supported */ + +typedef cl_int CL_API_CALL +clGetSupportedVA_APIMediaSurfaceFormatsINTEL_t( + cl_context context, + cl_mem_flags flags, + cl_mem_object_type image_type, + cl_uint plane, + cl_uint num_entries, + VAImageFormat* va_api_formats, + cl_uint* num_surface_formats); + +typedef clGetSupportedVA_APIMediaSurfaceFormatsINTEL_t * +clGetSupportedVA_APIMediaSurfaceFormatsINTEL_fn ; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetSupportedVA_APIMediaSurfaceFormatsINTEL( + cl_context context, + cl_mem_flags flags, + cl_mem_object_type image_type, + cl_uint plane, + cl_uint num_entries, + VAImageFormat* va_api_formats, + cl_uint* num_surface_formats) ; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +/*************************************************************** +* cl_intel_va_api_media_sharing +***************************************************************/ +#define cl_intel_va_api_media_sharing 1 +#define CL_INTEL_VA_API_MEDIA_SHARING_EXTENSION_NAME \ + "cl_intel_va_api_media_sharing" + + +#define CL_INTEL_VA_API_MEDIA_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + +typedef cl_uint cl_va_api_device_source_intel; +typedef cl_uint cl_va_api_device_set_intel; + +/* Error codes */ +#define CL_INVALID_VA_API_MEDIA_ADAPTER_INTEL -1098 +#define CL_INVALID_VA_API_MEDIA_SURFACE_INTEL -1099 +#define CL_VA_API_MEDIA_SURFACE_ALREADY_ACQUIRED_INTEL -1100 +#define CL_VA_API_MEDIA_SURFACE_NOT_ACQUIRED_INTEL -1101 + +/* cl_va_api_device_source_intel */ +#define CL_VA_API_DISPLAY_INTEL 0x4094 + +/* cl_va_api_device_set_intel */ +#define CL_PREFERRED_DEVICES_FOR_VA_API_INTEL 0x4095 +#define CL_ALL_DEVICES_FOR_VA_API_INTEL 0x4096 + +/* cl_context_info */ +#define CL_CONTEXT_VA_API_DISPLAY_INTEL 0x4097 + +/* cl_mem_info */ +#define CL_MEM_VA_API_MEDIA_SURFACE_INTEL 0x4098 + +/* cl_image_info */ +#define CL_IMAGE_VA_API_PLANE_INTEL 0x4099 + +/* cl_command_type */ +#define CL_COMMAND_ACQUIRE_VA_API_MEDIA_SURFACES_INTEL 0x409A +#define CL_COMMAND_RELEASE_VA_API_MEDIA_SURFACES_INTEL 0x409B + + +typedef cl_int CL_API_CALL +clGetDeviceIDsFromVA_APIMediaAdapterINTEL_t( + cl_platform_id platform, + cl_va_api_device_source_intel media_adapter_type, + void* media_adapter, + cl_va_api_device_set_intel media_adapter_set, + cl_uint num_entries, + cl_device_id* devices, + cl_uint* num_devices); + +typedef clGetDeviceIDsFromVA_APIMediaAdapterINTEL_t * +clGetDeviceIDsFromVA_APIMediaAdapterINTEL_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_mem CL_API_CALL +clCreateFromVA_APIMediaSurfaceINTEL_t( + cl_context context, + cl_mem_flags flags, + VASurfaceID* surface, + cl_uint plane, + cl_int* errcode_ret); + +typedef clCreateFromVA_APIMediaSurfaceINTEL_t * +clCreateFromVA_APIMediaSurfaceINTEL_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clEnqueueAcquireVA_APIMediaSurfacesINTEL_t( + 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 clEnqueueAcquireVA_APIMediaSurfacesINTEL_t * +clEnqueueAcquireVA_APIMediaSurfacesINTEL_fn CL_API_SUFFIX__VERSION_1_2; + +typedef cl_int CL_API_CALL +clEnqueueReleaseVA_APIMediaSurfacesINTEL_t( + 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 clEnqueueReleaseVA_APIMediaSurfacesINTEL_t * +clEnqueueReleaseVA_APIMediaSurfacesINTEL_fn CL_API_SUFFIX__VERSION_1_2; + +#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetDeviceIDsFromVA_APIMediaAdapterINTEL( + cl_platform_id platform, + cl_va_api_device_source_intel media_adapter_type, + void* media_adapter, + cl_va_api_device_set_intel media_adapter_set, + cl_uint num_entries, + cl_device_id* devices, + cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_mem CL_API_CALL +clCreateFromVA_APIMediaSurfaceINTEL( + cl_context context, + cl_mem_flags flags, + VASurfaceID* surface, + cl_uint plane, + cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueAcquireVA_APIMediaSurfacesINTEL( + 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_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReleaseVA_APIMediaSurfacesINTEL( + 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_2; + +#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H_ */ diff --git a/lib/opencl_3.0.0/CL/cl_version.h b/lib/opencl_v2025.07.22/CL/cl_version.h similarity index 100% rename from lib/opencl_3.0.0/CL/cl_version.h rename to lib/opencl_v2025.07.22/CL/cl_version.h diff --git a/lib/opencl_3.0.0/CL/opencl.h b/lib/opencl_v2025.07.22/CL/opencl.h similarity index 100% rename from lib/opencl_3.0.0/CL/opencl.h rename to lib/opencl_v2025.07.22/CL/opencl.h diff --git a/lib/opencl_3.0.0/CL/opencl.hpp b/lib/opencl_v2025.07.22/CL/opencl.hpp similarity index 61% rename from lib/opencl_3.0.0/CL/opencl.hpp rename to lib/opencl_v2025.07.22/CL/opencl.hpp index 503bd2eb3e2..65e709892cc 100644 --- a/lib/opencl_3.0.0/CL/opencl.hpp +++ b/lib/opencl_v2025.07.22/CL/opencl.hpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2008-2020 The Khronos Group Inc. +// Copyright (c) 2008-2024 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. @@ -33,14 +33,12 @@ * * Optional extension support * - * cl_ext_device_fission - * #define CL_HPP_USE_CL_DEVICE_FISSION * cl_khr_d3d10_sharing * #define CL_HPP_USE_DX_INTEROP + * cl_khr_il_program + * #define CL_HPP_USE_IL_KHR * cl_khr_sub_groups * #define CL_HPP_USE_CL_SUB_GROUPS_KHR - * cl_khr_image2d_from_buffer - * #define CL_HPP_USE_CL_IMAGE2D_FROM_BUFFER_KHR * * Doxygen documentation for this header is available here: * @@ -73,39 +71,39 @@ * fixes in the new header as well as additional OpenCL 2.0 features. * As a result the header is not directly backward compatible and for this * reason we release it as opencl.hpp rather than a new version of cl.hpp. - * + * * * \section compatibility Compatibility * Due to the evolution of the underlying OpenCL API the 2.0 C++ bindings * include an updated approach to defining supported feature versions * and the range of valid underlying OpenCL runtime versions supported. * - * The combination of preprocessor macros CL_HPP_TARGET_OPENCL_VERSION and + * The combination of preprocessor macros CL_HPP_TARGET_OPENCL_VERSION and * CL_HPP_MINIMUM_OPENCL_VERSION control this range. These are three digit - * decimal values representing OpenCL runime versions. The default for - * the target is 200, representing OpenCL 2.0 and the minimum is also - * defined as 200. These settings would use 2.0 API calls only. + * decimal values representing OpenCL runtime versions. The default for + * the target is 300, representing OpenCL 3.0. The minimum is defined as 200. + * These settings would use 2.0 and newer API calls only. * If backward compatibility with a 1.2 runtime is required, the minimum * version may be set to 120. * * Note that this is a compile-time setting, and so affects linking against * a particular SDK version rather than the versioning of the loaded runtime. * - * The earlier versions of the header included basic vector and string - * classes based loosely on STL versions. These were difficult to + * The earlier versions of the header included basic vector and string + * classes based loosely on STL versions. These were difficult to * maintain and very rarely used. For the 2.0 header we now assume * the presence of the standard library unless requested otherwise. - * We use std::array, std::vector, std::shared_ptr and std::string - * throughout to safely manage memory and reduce the chance of a + * We use std::array, std::vector, std::shared_ptr and std::string + * throughout to safely manage memory and reduce the chance of a * recurrance of earlier memory management bugs. * - * These classes are used through typedefs in the cl namespace: + * These classes are used through typedefs in the cl namespace: * cl::array, cl::vector, cl::pointer and cl::string. * In addition cl::allocate_pointer forwards to std::allocate_shared * by default. - * In all cases these standard library classes can be replaced with - * custom interface-compatible versions using the CL_HPP_NO_STD_ARRAY, - * CL_HPP_NO_STD_VECTOR, CL_HPP_NO_STD_UNIQUE_PTR and + * In all cases these standard library classes can be replaced with + * custom interface-compatible versions using the CL_HPP_NO_STD_ARRAY, + * CL_HPP_NO_STD_VECTOR, CL_HPP_NO_STD_UNIQUE_PTR and * CL_HPP_NO_STD_STRING macros. * * The OpenCL 1.x versions of the C++ bindings included a size_t wrapper @@ -116,12 +114,12 @@ * using the CL_HPP_ENABLE_SIZE_T_COMPATIBILITY macro. * * Finally, the program construction interface used a clumsy vector-of-pairs - * design in the earlier versions. We have replaced that with a cleaner - * vector-of-vectors and vector-of-strings design. However, for backward + * design in the earlier versions. We have replaced that with a cleaner + * vector-of-vectors and vector-of-strings design. However, for backward * compatibility old behaviour can be regained with the * CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY macro. - * - * In OpenCL 2.0 OpenCL C is not entirely backward compatibility with + * + * In OpenCL 2.0 OpenCL C is not entirely backward compatibility with * earlier versions. As a result a flag must be passed to the OpenCL C * compiled to request OpenCL 2.0 compilation of kernels with 1.2 as * the default in the absence of the flag. @@ -139,6 +137,11 @@ * - CL_HPP_TARGET_OPENCL_VERSION * * Defines the target OpenCL runtime version to build the header + * against. Defaults to 300, representing OpenCL 3.0. + * + * - CL_HPP_MINIMUM_OPENCL_VERSION + * + * Defines the minimum OpenCL runtime version to build the header * against. Defaults to 200, representing OpenCL 2.0. * * - CL_HPP_NO_STD_STRING @@ -165,10 +168,6 @@ * the cl::allocate_pointer functions are not defined and may be * defined by the user before opencl.hpp is included. * - * - CL_HPP_ENABLE_DEVICE_FISSION - * - * Enables device fission for OpenCL 1.2 platforms. - * * - CL_HPP_ENABLE_EXCEPTIONS * * Enable exceptions for use in the C++ bindings header. This is the @@ -194,14 +193,24 @@ * applies to use of cl::Program construction and other program * build variants. * + * * - CL_HPP_USE_CL_SUB_GROUPS_KHR * * Enable the cl_khr_subgroups extension. * + * - CL_HPP_USE_DX_INTEROP + * + * Enable the cl_khr_d3d10_sharing extension. + * * - CL_HPP_USE_IL_KHR * * Enable the cl_khr_il_program extension. * + * - CL_HPP_OPENCL_API_WRAPPER + * + * A macro which is used to wrap all OpenCL API symbols. This can be + * used e.g. to load the OpenCL library dynamically with dlopen()/dlsym(). + * * * \section example Example * @@ -209,6 +218,10 @@ * bindings, including support for the optional exception feature and * also the supplied vector and string classes, see following sections for * decriptions of these features. + * + * Note: the C++ bindings use std::call_once and therefore may need to be + * compiled using special command-line options (such as "-pthread") on some + * platforms! * * \code #define CL_HPP_ENABLE_EXCEPTIONS @@ -224,28 +237,30 @@ int main(void) { - // Filter for a 2.0 platform and set it as the default + // Filter for a 2.0 or newer platform and set it as the default std::vector platforms; cl::Platform::get(&platforms); cl::Platform plat; for (auto &p : platforms) { std::string platver = p.getInfo(); - if (platver.find("OpenCL 2.") != std::string::npos) { + if (platver.find("OpenCL 2.") != std::string::npos || + platver.find("OpenCL 3.") != std::string::npos) { + // Note: an OpenCL 3.x platform may not support all required features! plat = p; } } - if (plat() == 0) { - std::cout << "No OpenCL 2.0 platform found."; + if (plat() == 0) { + std::cout << "No OpenCL 2.0 or newer platform found.\n"; return -1; } cl::Platform newP = cl::Platform::setDefault(plat); if (newP != plat) { - std::cout << "Error setting default platform."; + std::cout << "Error setting default platform.\n"; return -1; } - // Use C++11 raw string literals for kernel source code + // C++11 raw string literal for the first kernel std::string kernel1{R"CLC( global int globalA; kernel void updateGlobal() @@ -253,6 +268,8 @@ globalA = 75; } )CLC"}; + + // Raw string literal for the second kernel std::string kernel2{R"CLC( typedef struct { global int *bar; } Foo; kernel void vectorAdd(global const Foo* aNum, global const int *inputA, global const int *inputB, @@ -279,8 +296,9 @@ } )CLC"}; - // New simpler string interface style - std::vector programStrings {kernel1, kernel2}; + std::vector programStrings; + programStrings.push_back(kernel1); + programStrings.push_back(kernel2); cl::Program vectorAddProgram(programStrings); try { @@ -319,12 +337,11 @@ std::vector>> inputA(numElements, 1, svmAlloc); cl::coarse_svm_vector inputB(numElements, 2, svmAlloc); - // ////////////// - // Traditional cl_mem allocations + std::vector output(numElements, 0xdeadbeef); - cl::Buffer outputBuffer(begin(output), end(output), false); + cl::Buffer outputBuffer(output.begin(), output.end(), false); cl::Pipe aPipe(sizeof(cl_int), numElements / 2); // Default command queue, also passed in as a parameter @@ -346,14 +363,8 @@ // This one was not passed as a parameter vectorAddKernel.setSVMPointers(anSVMInt); - // Hand control of coarse allocations to runtime - cl::enqueueUnmapSVM(anSVMInt); - cl::enqueueUnmapSVM(fooPointer); - cl::unmapSVM(inputB); - cl::unmapSVM(output2); - - cl_int error; - vectorAddKernel( + cl_int error; + vectorAddKernel( cl::EnqueueArgs( cl::NDRange(numElements/2), cl::NDRange(numElements/2)), @@ -364,12 +375,10 @@ 3, aPipe, defaultDeviceQueue, - error + error ); - cl::copy(outputBuffer, begin(output), end(output)); - // Grab the SVM output vector using a map - cl::mapSVM(output2); + cl::copy(outputBuffer, output.begin(), output.end()); cl::Device d = cl::Device::getDefault(); @@ -388,6 +397,12 @@ #ifndef CL_HPP_ #define CL_HPP_ +#ifdef CL_HPP_OPENCL_API_WRAPPER +#define CL_(name) CL_HPP_OPENCL_API_WRAPPER(name) +#else +#define CL_(name) ::name +#endif + /* Handle deprecated preprocessor definitions. In each case, we only check for * the old name if the new name is not defined, so that user code can define * both and hence work with either version of the bindings. @@ -396,10 +411,6 @@ # pragma message("opencl.hpp: USE_DX_INTEROP is deprecated. Define CL_HPP_USE_DX_INTEROP instead") # define CL_HPP_USE_DX_INTEROP #endif -#if !defined(CL_HPP_USE_CL_DEVICE_FISSION) && defined(USE_CL_DEVICE_FISSION) -# pragma message("opencl.hpp: USE_CL_DEVICE_FISSION is deprecated. Define CL_HPP_USE_CL_DEVICE_FISSION instead") -# define CL_HPP_USE_CL_DEVICE_FISSION -#endif #if !defined(CL_HPP_ENABLE_EXCEPTIONS) && defined(__CL_ENABLE_EXCEPTIONS) # pragma message("opencl.hpp: __CL_ENABLE_EXCEPTIONS is deprecated. Define CL_HPP_ENABLE_EXCEPTIONS instead") # define CL_HPP_ENABLE_EXCEPTIONS @@ -509,33 +520,22 @@ #if defined(_MSC_VER) #include -#endif // _MSC_VER - +#endif // _MSC_VER + // Check for a valid C++ version -// Need to do both tests here because for some reason __cplusplus is not +// Need to do both tests here because for some reason __cplusplus is not // updated in visual studio #if (!defined(_MSC_VER) && __cplusplus < 201103L) || (defined(_MSC_VER) && _MSC_VER < 1700) #error Visual studio 2013 or another C++11-supporting compiler required #endif -// -#if defined(CL_HPP_USE_CL_DEVICE_FISSION) || defined(CL_HPP_USE_CL_SUB_GROUPS_KHR) -#include -#endif - #if defined(__APPLE__) || defined(__MACOSX) #include #else #include #endif // !__APPLE__ -#if (__cplusplus >= 201103L || _MSVC_LANG >= 201103L ) -#define CL_HPP_NOEXCEPT_ noexcept -#else -#define CL_HPP_NOEXCEPT_ -#endif - #if __cplusplus >= 201703L # define CL_HPP_DEFINE_STATIC_MEMBER_ inline #elif defined(_MSC_VER) @@ -553,14 +553,21 @@ #endif // #if !defined(CL_API_PREFIX__VERSION_1_1_DEPRECATED) #if !defined(CL_API_SUFFIX__VERSION_1_1_DEPRECATED) #define CL_API_SUFFIX__VERSION_1_1_DEPRECATED -#endif // #if !defined(CL_API_PREFIX__VERSION_1_1_DEPRECATED) +#endif // #if !defined(CL_API_SUFFIX__VERSION_1_1_DEPRECATED) #if !defined(CL_API_PREFIX__VERSION_1_2_DEPRECATED) #define CL_API_PREFIX__VERSION_1_2_DEPRECATED #endif // #if !defined(CL_API_PREFIX__VERSION_1_2_DEPRECATED) #if !defined(CL_API_SUFFIX__VERSION_1_2_DEPRECATED) #define CL_API_SUFFIX__VERSION_1_2_DEPRECATED -#endif // #if !defined(CL_API_PREFIX__VERSION_1_2_DEPRECATED) +#endif // #if !defined(CL_API_SUFFIX__VERSION_1_2_DEPRECATED) + +#if !defined(CL_API_PREFIX__VERSION_2_2_DEPRECATED) +#define CL_API_PREFIX__VERSION_2_2_DEPRECATED +#endif // #if !defined(CL_API_PREFIX__VERSION_2_2_DEPRECATED) +#if !defined(CL_API_SUFFIX__VERSION_2_2_DEPRECATED) +#define CL_API_SUFFIX__VERSION_2_2_DEPRECATED +#endif // #if !defined(CL_API_SUFFIX__VERSION_2_2_DEPRECATED) #if !defined(CL_CALLBACK) #define CL_CALLBACK @@ -615,7 +622,7 @@ namespace cl { template using pointer = std::unique_ptr; } // namespace cl -#endif +#endif #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200 #if !defined(CL_HPP_NO_STD_ARRAY) #include @@ -703,24 +710,27 @@ namespace cl { * */ namespace cl { - class Memory; -#define CL_HPP_INIT_CL_EXT_FCN_PTR_(name) \ - if (!pfn_##name) { \ - pfn_##name = (PFN_##name) \ - clGetExtensionFunctionAddress(#name); \ - if (!pfn_##name) { \ - } \ +#define CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(name) \ + using PFN_##name = name##_fn + +#define CL_HPP_INIT_CL_EXT_FCN_PTR_(name) \ + if (!pfn_##name) { \ + pfn_##name = (PFN_##name)CL_(clGetExtensionFunctionAddress)(#name); \ } -#define CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, name) \ - if (!pfn_##name) { \ - pfn_##name = (PFN_##name) \ - clGetExtensionFunctionAddressForPlatform(platform, #name); \ - if (!pfn_##name) { \ - } \ +#define CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, name) \ + if (!pfn_##name) { \ + pfn_##name = (PFN_##name) \ + CL_(clGetExtensionFunctionAddressForPlatform)(platform, #name); \ } +#ifdef cl_khr_external_memory + enum class ExternalMemoryType : cl_external_memory_handle_type_khr; +#endif + + class Memory; + class Platform; class Program; class Device; class Context; @@ -729,10 +739,17 @@ namespace cl { class Memory; class Buffer; class Pipe; +#ifdef cl_khr_semaphore + class Semaphore; +#endif +#if defined(cl_khr_command_buffer) + class CommandBufferKhr; + class MutableCommandKhr; +#endif // cl_khr_command_buffer #if defined(CL_HPP_ENABLE_EXCEPTIONS) - /*! \brief Exception class - * + /*! \brief Exception class + * * This may be thrown by API functions when CL_HPP_ENABLE_EXCEPTIONS is defined. */ class Error : public std::exception @@ -743,25 +760,23 @@ namespace cl { public: /*! \brief Create a new CL error exception for a given error code * and corresponding message. - * + * * \param err error code value. * * \param errStr a descriptive string that must remain in scope until * handling of the exception has concluded. If set, it * will be returned by what(). */ - Error(cl_int err, const char * errStr = NULL) : err_(err), errStr_(errStr) + Error(cl_int err, const char * errStr = nullptr) : err_(err), errStr_(errStr) {} - ~Error() throw() {} - /*! \brief Get error string associated with exception * * \return A memory pointer to the error message string. */ - virtual const char * what() const throw () + const char * what() const noexcept override { - if (errStr_ == NULL) { + if (errStr_ == nullptr) { return "empty"; } else { @@ -777,7 +792,7 @@ namespace cl { }; #define CL_HPP_ERR_STR_(x) #x #else -#define CL_HPP_ERR_STR_(x) NULL +#define CL_HPP_ERR_STR_(x) nullptr #endif // CL_HPP_ENABLE_EXCEPTIONS @@ -786,7 +801,7 @@ namespace detail #if defined(CL_HPP_ENABLE_EXCEPTIONS) static inline cl_int errHandler ( cl_int err, - const char * errStr = NULL) + const char * errStr = nullptr) { if (err != CL_SUCCESS) { throw Error(err, errStr); @@ -794,7 +809,7 @@ static inline cl_int errHandler ( return err; } #else -static inline cl_int errHandler (cl_int err, const char * errStr = NULL) +static inline cl_int errHandler (cl_int err, const char * errStr = nullptr) { (void) errStr; // suppress unused variable warning return err; @@ -820,9 +835,11 @@ static inline cl_int errHandler (cl_int err, const char * errStr = NULL) #if CL_HPP_TARGET_OPENCL_VERSION >= 120 #define __GET_KERNEL_ARG_INFO_ERR CL_HPP_ERR_STR_(clGetKernelArgInfo) #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 -#if CL_HPP_TARGET_OPENCL_VERSION >= 200 +#if CL_HPP_TARGET_OPENCL_VERSION >= 210 #define __GET_KERNEL_SUB_GROUP_INFO_ERR CL_HPP_ERR_STR_(clGetKernelSubGroupInfo) -#endif // CL_HPP_TARGET_OPENCL_VERSION >= 200 +#else +#define __GET_KERNEL_SUB_GROUP_INFO_ERR CL_HPP_ERR_STR_(clGetKernelSubGroupInfoKHR) +#endif // CL_HPP_TARGET_OPENCL_VERSION >= 210 #define __GET_KERNEL_WORK_GROUP_INFO_ERR CL_HPP_ERR_STR_(clGetKernelWorkGroupInfo) #define __GET_PROGRAM_INFO_ERR CL_HPP_ERR_STR_(clGetProgramInfo) #define __GET_PROGRAM_BUILD_INFO_ERR CL_HPP_ERR_STR_(clGetProgramBuildInfo) @@ -831,6 +848,9 @@ static inline cl_int errHandler (cl_int err, const char * errStr = NULL) #define __CREATE_CONTEXT_ERR CL_HPP_ERR_STR_(clCreateContext) #define __CREATE_CONTEXT_FROM_TYPE_ERR CL_HPP_ERR_STR_(clCreateContextFromType) #define __GET_SUPPORTED_IMAGE_FORMATS_ERR CL_HPP_ERR_STR_(clGetSupportedImageFormats) +#if CL_HPP_TARGET_OPENCL_VERSION >= 300 +#define __SET_CONTEXT_DESCTRUCTOR_CALLBACK_ERR CL_HPP_ERR_STR_(clSetContextDestructorCallback) +#endif // CL_HPP_TARGET_OPENCL_VERSION >= 300 #define __CREATE_BUFFER_ERR CL_HPP_ERR_STR_(clCreateBuffer) #define __COPY_ERR CL_HPP_ERR_STR_(cl::copy) @@ -853,12 +873,11 @@ static inline cl_int errHandler (cl_int err, const char * errStr = NULL) #define __CREATE_KERNEL_ERR CL_HPP_ERR_STR_(clCreateKernel) #define __SET_KERNEL_ARGS_ERR CL_HPP_ERR_STR_(clSetKernelArg) #define __CREATE_PROGRAM_WITH_SOURCE_ERR CL_HPP_ERR_STR_(clCreateProgramWithSource) -#if CL_HPP_TARGET_OPENCL_VERSION >= 200 -#define __CREATE_PROGRAM_WITH_IL_ERR CL_HPP_ERR_STR_(clCreateProgramWithIL) -#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200 #define __CREATE_PROGRAM_WITH_BINARY_ERR CL_HPP_ERR_STR_(clCreateProgramWithBinary) #if CL_HPP_TARGET_OPENCL_VERSION >= 210 #define __CREATE_PROGRAM_WITH_IL_ERR CL_HPP_ERR_STR_(clCreateProgramWithIL) +#else +#define __CREATE_PROGRAM_WITH_IL_ERR CL_HPP_ERR_STR_(clCreateProgramWithILKHR) #endif // CL_HPP_TARGET_OPENCL_VERSION >= 210 #if CL_HPP_TARGET_OPENCL_VERSION >= 120 #define __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR CL_HPP_ERR_STR_(clCreateProgramWithBuiltInKernels) @@ -889,6 +908,10 @@ static inline cl_int errHandler (cl_int err, const char * errStr = NULL) #define __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueCopyImageToBuffer) #define __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueCopyBufferToImage) #define __ENQUEUE_MAP_BUFFER_ERR CL_HPP_ERR_STR_(clEnqueueMapBuffer) +#define __ENQUEUE_MAP_SVM_ERR CL_HPP_ERR_STR_(clEnqueueSVMMap) +#define __ENQUEUE_FILL_SVM_ERR CL_HPP_ERR_STR_(clEnqueueSVMMemFill) +#define __ENQUEUE_COPY_SVM_ERR CL_HPP_ERR_STR_(clEnqueueSVMMemcpy) +#define __ENQUEUE_UNMAP_SVM_ERR CL_HPP_ERR_STR_(clEnqueueSVMUnmap) #define __ENQUEUE_MAP_IMAGE_ERR CL_HPP_ERR_STR_(clEnqueueMapImage) #define __ENQUEUE_UNMAP_MEM_OBJECT_ERR CL_HPP_ERR_STR_(clEnqueueUnMapMemObject) #define __ENQUEUE_NDRANGE_KERNEL_ERR CL_HPP_ERR_STR_(clEnqueueNDRangeKernel) @@ -908,7 +931,6 @@ static inline cl_int errHandler (cl_int err, const char * errStr = NULL) #define __CREATE_PIPE_ERR CL_HPP_ERR_STR_(clCreatePipe) #define __GET_PIPE_INFO_ERR CL_HPP_ERR_STR_(clGetPipeInfo) - #define __RETAIN_ERR CL_HPP_ERR_STR_(Retain Object) #define __RELEASE_ERR CL_HPP_ERR_STR_(Release Object) #define __FLUSH_ERR CL_HPP_ERR_STR_(clFlush) @@ -924,6 +946,47 @@ static inline cl_int errHandler (cl_int err, const char * errStr = NULL) #define __SET_PROGRAM_SPECIALIZATION_CONSTANT_ERR CL_HPP_ERR_STR_(clSetProgramSpecializationConstant) #endif +#ifdef cl_khr_external_memory +#define __ENQUEUE_ACQUIRE_EXTERNAL_MEMORY_ERR CL_HPP_ERR_STR_(clEnqueueAcquireExternalMemObjectsKHR) +#define __ENQUEUE_RELEASE_EXTERNAL_MEMORY_ERR CL_HPP_ERR_STR_(clEnqueueReleaseExternalMemObjectsKHR) +#endif + +#ifdef cl_khr_semaphore +#define __GET_SEMAPHORE_KHR_INFO_ERR CL_HPP_ERR_STR_(clGetSemaphoreInfoKHR) +#define __CREATE_SEMAPHORE_KHR_WITH_PROPERTIES_ERR CL_HPP_ERR_STR_(clCreateSemaphoreWithPropertiesKHR) +#define __ENQUEUE_WAIT_SEMAPHORE_KHR_ERR CL_HPP_ERR_STR_(clEnqueueWaitSemaphoresKHR) +#define __ENQUEUE_SIGNAL_SEMAPHORE_KHR_ERR CL_HPP_ERR_STR_(clEnqueueSignalSemaphoresKHR) +#define __RETAIN_SEMAPHORE_KHR_ERR CL_HPP_ERR_STR_(clRetainSemaphoreKHR) +#define __RELEASE_SEMAPHORE_KHR_ERR CL_HPP_ERR_STR_(clReleaseSemaphoreKHR) +#endif + +#ifdef cl_khr_external_semaphore +#define __GET_SEMAPHORE_HANDLE_FOR_TYPE_KHR_ERR CL_HPP_ERR_STR_(clGetSemaphoreHandleForTypeKHR) +#endif // cl_khr_external_semaphore + +#if defined(cl_khr_command_buffer) +#define __CREATE_COMMAND_BUFFER_KHR_ERR CL_HPP_ERR_STR_(clCreateCommandBufferKHR) +#define __GET_COMMAND_BUFFER_INFO_KHR_ERR CL_HPP_ERR_STR_(clGetCommandBufferInfoKHR) +#define __FINALIZE_COMMAND_BUFFER_KHR_ERR CL_HPP_ERR_STR_(clFinalizeCommandBufferKHR) +#define __ENQUEUE_COMMAND_BUFFER_KHR_ERR CL_HPP_ERR_STR_(clEnqueueCommandBufferKHR) +#define __COMMAND_BARRIER_WITH_WAIT_LIST_KHR_ERR CL_HPP_ERR_STR_(clCommandBarrierWithWaitListKHR) +#define __COMMAND_COPY_BUFFER_KHR_ERR CL_HPP_ERR_STR_(clCommandCopyBufferKHR) +#define __COMMAND_COPY_BUFFER_RECT_KHR_ERR CL_HPP_ERR_STR_(clCommandCopyBufferRectKHR) +#define __COMMAND_COPY_BUFFER_TO_IMAGE_KHR_ERR CL_HPP_ERR_STR_(clCommandCopyBufferToImageKHR) +#define __COMMAND_COPY_IMAGE_KHR_ERR CL_HPP_ERR_STR_(clCommandCopyImageKHR) +#define __COMMAND_COPY_IMAGE_TO_BUFFER_KHR_ERR CL_HPP_ERR_STR_(clCommandCopyImageToBufferKHR) +#define __COMMAND_FILL_BUFFER_KHR_ERR CL_HPP_ERR_STR_(clCommandFillBufferKHR) +#define __COMMAND_FILL_IMAGE_KHR_ERR CL_HPP_ERR_STR_(clCommandFillImageKHR) +#define __COMMAND_NDRANGE_KERNEL_KHR_ERR CL_HPP_ERR_STR_(clCommandNDRangeKernelKHR) +#define __UPDATE_MUTABLE_COMMANDS_KHR_ERR CL_HPP_ERR_STR_(clUpdateMutableCommandsKHR) +#define __GET_MUTABLE_COMMAND_INFO_KHR_ERR CL_HPP_ERR_STR_(clGetMutableCommandInfoKHR) +#define __RETAIN_COMMAND_BUFFER_KHR_ERR CL_HPP_ERR_STR_(clRetainCommandBufferKHR) +#define __RELEASE_COMMAND_BUFFER_KHR_ERR CL_HPP_ERR_STR_(clReleaseCommandBufferKHR) +#endif // cl_khr_command_buffer + +#if defined(cl_ext_image_requirements_info) +#define __GET_IMAGE_REQUIREMENT_INFO_EXT_ERR CL_HPP_ERR_STR_(clGetImageRequirementsInfoEXT) +#endif //cl_ext_image_requirements_info /** * CL 1.2 version that uses device fission. @@ -972,7 +1035,88 @@ static inline cl_int errHandler (cl_int err, const char * errStr = NULL) #endif // CL_HPP_USER_OVERRIDE_ERROR_STRINGS //! \endcond -//! \cond DOXYGEN_DETAIL +#ifdef cl_khr_external_memory +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clEnqueueAcquireExternalMemObjectsKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clEnqueueReleaseExternalMemObjectsKHR); + +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clEnqueueAcquireExternalMemObjectsKHR pfn_clEnqueueAcquireExternalMemObjectsKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clEnqueueReleaseExternalMemObjectsKHR pfn_clEnqueueReleaseExternalMemObjectsKHR = nullptr; +#endif // cl_khr_external_memory + +#ifdef cl_khr_semaphore +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clCreateSemaphoreWithPropertiesKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clReleaseSemaphoreKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clRetainSemaphoreKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clEnqueueWaitSemaphoresKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clEnqueueSignalSemaphoresKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clGetSemaphoreInfoKHR); + +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clCreateSemaphoreWithPropertiesKHR pfn_clCreateSemaphoreWithPropertiesKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clReleaseSemaphoreKHR pfn_clReleaseSemaphoreKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clRetainSemaphoreKHR pfn_clRetainSemaphoreKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clEnqueueWaitSemaphoresKHR pfn_clEnqueueWaitSemaphoresKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clEnqueueSignalSemaphoresKHR pfn_clEnqueueSignalSemaphoresKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clGetSemaphoreInfoKHR pfn_clGetSemaphoreInfoKHR = nullptr; +#endif // cl_khr_semaphore + +#ifdef cl_khr_external_semaphore +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clGetSemaphoreHandleForTypeKHR); +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clGetSemaphoreHandleForTypeKHR pfn_clGetSemaphoreHandleForTypeKHR = nullptr; +#endif // cl_khr_external_semaphore + +#if defined(cl_khr_command_buffer) +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clCreateCommandBufferKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clFinalizeCommandBufferKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clRetainCommandBufferKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clReleaseCommandBufferKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clGetCommandBufferInfoKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clEnqueueCommandBufferKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clCommandBarrierWithWaitListKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clCommandCopyBufferKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clCommandCopyBufferRectKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clCommandCopyBufferToImageKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clCommandCopyImageKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clCommandCopyImageToBufferKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clCommandFillBufferKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clCommandFillImageKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clCommandNDRangeKernelKHR); + +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clCreateCommandBufferKHR pfn_clCreateCommandBufferKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clFinalizeCommandBufferKHR pfn_clFinalizeCommandBufferKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clRetainCommandBufferKHR pfn_clRetainCommandBufferKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clReleaseCommandBufferKHR pfn_clReleaseCommandBufferKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clGetCommandBufferInfoKHR pfn_clGetCommandBufferInfoKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clEnqueueCommandBufferKHR pfn_clEnqueueCommandBufferKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clCommandBarrierWithWaitListKHR pfn_clCommandBarrierWithWaitListKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clCommandCopyBufferKHR pfn_clCommandCopyBufferKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clCommandCopyBufferRectKHR pfn_clCommandCopyBufferRectKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clCommandCopyBufferToImageKHR pfn_clCommandCopyBufferToImageKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clCommandCopyImageKHR pfn_clCommandCopyImageKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clCommandCopyImageToBufferKHR pfn_clCommandCopyImageToBufferKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clCommandFillBufferKHR pfn_clCommandFillBufferKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clCommandFillImageKHR pfn_clCommandFillImageKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clCommandNDRangeKernelKHR pfn_clCommandNDRangeKernelKHR = nullptr; +#endif /* cl_khr_command_buffer */ + +#if defined(cl_khr_command_buffer_mutable_dispatch) +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clUpdateMutableCommandsKHR); +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clGetMutableCommandInfoKHR); + +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clUpdateMutableCommandsKHR pfn_clUpdateMutableCommandsKHR = nullptr; +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clGetMutableCommandInfoKHR pfn_clGetMutableCommandInfoKHR = nullptr; +#endif /* cl_khr_command_buffer_mutable_dispatch */ + +#if defined(cl_ext_image_requirements_info) +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clGetImageRequirementsInfoEXT); +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clGetImageRequirementsInfoEXT pfn_clGetImageRequirementsInfoEXT = nullptr; +#endif + +#if defined(cl_ext_device_fission) +CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_(clCreateSubDevicesEXT); +CL_HPP_DEFINE_STATIC_MEMBER_ PFN_clCreateSubDevicesEXT + pfn_clCreateSubDevicesEXT = nullptr; +#endif + namespace detail { // Generic getInfoHelper. The final parameter is used to guide overload @@ -982,7 +1126,7 @@ namespace detail { template inline cl_int getInfoHelper(Functor f, cl_uint name, T* param, long) { - return f(name, sizeof(T), param, NULL); + return f(name, sizeof(T), param, nullptr); } // Specialized for getInfo @@ -1003,14 +1147,13 @@ inline cl_int getInfoHelper(Func f, cl_uint name, vector>* binariesPointers[i] = (*param)[i].data(); } - cl_int err = f(name, numBinaries * sizeof(unsigned char*), binariesPointers.data(), NULL); + cl_int err = f(name, numBinaries * sizeof(unsigned char*), binariesPointers.data(), nullptr); if (err != CL_SUCCESS) { return err; } } - return CL_SUCCESS; } @@ -1019,7 +1162,7 @@ template inline cl_int getInfoHelper(Func f, cl_uint name, vector* param, long) { size_type required; - cl_int err = f(name, 0, NULL, &required); + cl_int err = f(name, 0, nullptr, &required); if (err != CL_SUCCESS) { return err; } @@ -1027,7 +1170,7 @@ inline cl_int getInfoHelper(Func f, cl_uint name, vector* param, long) // Temporary to avoid changing param on an error vector localData(elements); - err = f(name, required, localData.data(), NULL); + err = f(name, required, localData.data(), nullptr); if (err != CL_SUCCESS) { return err; } @@ -1049,7 +1192,7 @@ inline cl_int getInfoHelper( Func f, cl_uint name, vector* param, int, typename T::cl_type = 0) { size_type required; - cl_int err = f(name, 0, NULL, &required); + cl_int err = f(name, 0, nullptr, &required); if (err != CL_SUCCESS) { return err; } @@ -1057,7 +1200,7 @@ inline cl_int getInfoHelper( const size_type elements = required / sizeof(typename T::cl_type); vector value(elements); - err = f(name, required, value.data(), NULL); + err = f(name, required, value.data(), nullptr); if (err != CL_SUCCESS) { return err; } @@ -1080,7 +1223,7 @@ template inline cl_int getInfoHelper(Func f, cl_uint name, string* param, long) { size_type required; - cl_int err = f(name, 0, NULL, &required); + cl_int err = f(name, 0, nullptr, &required); if (err != CL_SUCCESS) { return err; } @@ -1089,12 +1232,12 @@ inline cl_int getInfoHelper(Func f, cl_uint name, string* param, long) // a char vector does not if (required > 0) { vector value(required); - err = f(name, required, value.data(), NULL); + err = f(name, required, value.data(), nullptr); if (err != CL_SUCCESS) { return err; } if (param) { - param->assign(begin(value), prev(end(value))); + param->assign(value.begin(), value.end() - 1); } } else if (param) { @@ -1108,7 +1251,7 @@ template inline cl_int getInfoHelper(Func f, cl_uint name, array* param, long) { size_type required; - cl_int err = f(name, 0, NULL, &required); + cl_int err = f(name, 0, nullptr, &required); if (err != CL_SUCCESS) { return err; } @@ -1116,11 +1259,11 @@ inline cl_int getInfoHelper(Func f, cl_uint name, array* param, lo size_type elements = required / sizeof(size_type); vector value(elements, 0); - err = f(name, required, value.data(), NULL); + err = f(name, required, value.data(), nullptr); if (err != CL_SUCCESS) { return err; } - + // Bound the copy with N to prevent overruns // if passed N > than the amount copied if (elements > N) { @@ -1145,12 +1288,12 @@ template inline cl_int getInfoHelper(Func f, cl_uint name, T* param, int, typename T::cl_type = 0) { typename T::cl_type value; - cl_int err = f(name, sizeof(value), &value, NULL); + cl_int err = f(name, sizeof(value), &value, nullptr); if (err != CL_SUCCESS) { return err; } *param = value; - if (value != NULL) + if (value != nullptr) { err = param->retain(); if (err != CL_SUCCESS) { @@ -1211,7 +1354,7 @@ inline cl_int getInfoHelper(Func f, cl_uint name, T* param, int, typename T::cl_ F(cl_device_info, CL_DEVICE_AVAILABLE, cl_bool) \ F(cl_device_info, CL_DEVICE_COMPILER_AVAILABLE, cl_bool) \ F(cl_device_info, CL_DEVICE_EXECUTION_CAPABILITIES, cl_device_exec_capabilities) \ - F(cl_device_info, CL_DEVICE_PLATFORM, cl_platform_id) \ + F(cl_device_info, CL_DEVICE_PLATFORM, cl::Platform) \ F(cl_device_info, CL_DEVICE_NAME, string) \ F(cl_device_info, CL_DEVICE_VENDOR, string) \ F(cl_device_info, CL_DRIVER_VERSION, string) \ @@ -1389,8 +1532,8 @@ inline cl_int getInfoHelper(Func f, cl_uint name, T* param, int, typename T::cl_ F(cl_program_info, CL_PROGRAM_SCOPE_GLOBAL_CTORS_PRESENT, cl_bool) \ F(cl_program_info, CL_PROGRAM_SCOPE_GLOBAL_DTORS_PRESENT, cl_bool) -#define CL_HPP_PARAM_NAME_DEVICE_FISSION_(F) \ - F(cl_device_info, CL_DEVICE_PARENT_DEVICE_EXT, cl_device_id) \ +#define CL_HPP_PARAM_NAME_DEVICE_FISSION_EXT_(F) \ + F(cl_device_info, CL_DEVICE_PARENT_DEVICE_EXT, cl::Device) \ F(cl_device_info, CL_DEVICE_PARTITION_TYPES_EXT, cl::vector) \ F(cl_device_info, CL_DEVICE_AFFINITY_DOMAINS_EXT, cl::vector) \ F(cl_device_info, CL_DEVICE_REFERENCE_COUNT_EXT , cl_uint) \ @@ -1408,6 +1551,37 @@ inline cl_int getInfoHelper(Func f, cl_uint name, T* param, int, typename T::cl_ #define CL_HPP_PARAM_NAME_CL_KHR_EXTENDED_VERSIONING_KHRONLY_(F) \ F(cl_device_info, CL_DEVICE_OPENCL_C_NUMERIC_VERSION_KHR, cl_version_khr) +// Note: the query for CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR is handled specially! +#define CL_HPP_PARAM_NAME_CL_KHR_SEMAPHORE_(F) \ + F(cl_semaphore_info_khr, CL_SEMAPHORE_CONTEXT_KHR, cl::Context) \ + F(cl_semaphore_info_khr, CL_SEMAPHORE_REFERENCE_COUNT_KHR, cl_uint) \ + F(cl_semaphore_info_khr, CL_SEMAPHORE_PROPERTIES_KHR, cl::vector) \ + F(cl_semaphore_info_khr, CL_SEMAPHORE_TYPE_KHR, cl_semaphore_type_khr) \ + F(cl_semaphore_info_khr, CL_SEMAPHORE_PAYLOAD_KHR, cl_semaphore_payload_khr) \ + F(cl_platform_info, CL_PLATFORM_SEMAPHORE_TYPES_KHR, cl::vector) \ + F(cl_device_info, CL_DEVICE_SEMAPHORE_TYPES_KHR, cl::vector) \ + +#define CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_MEMORY_(F) \ + F(cl_device_info, CL_DEVICE_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR, cl::vector) \ + F(cl_platform_info, CL_PLATFORM_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR, cl::vector) + +#define CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_(F) \ + F(cl_platform_info, CL_PLATFORM_SEMAPHORE_IMPORT_HANDLE_TYPES_KHR, cl::vector) \ + F(cl_platform_info, CL_PLATFORM_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR, cl::vector) \ + F(cl_device_info, CL_DEVICE_SEMAPHORE_IMPORT_HANDLE_TYPES_KHR, cl::vector) \ + F(cl_device_info, CL_DEVICE_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR, cl::vector) \ + F(cl_semaphore_info_khr, CL_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR, cl::vector) \ + +#define CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXT(F) \ + F(cl_external_semaphore_handle_type_khr, CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR, int) \ + +#define CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_SYNC_FD_EXT(F) \ + F(cl_external_semaphore_handle_type_khr, CL_SEMAPHORE_HANDLE_SYNC_FD_KHR, int) \ + +#define CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_WIN32_EXT(F) \ + F(cl_external_semaphore_handle_type_khr, CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR, void*) \ + F(cl_external_semaphore_handle_type_khr, CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR, void*) \ + #define CL_HPP_PARAM_NAME_INFO_3_0_(F) \ F(cl_platform_info, CL_PLATFORM_NUMERIC_VERSION, cl_version) \ F(cl_platform_info, CL_PLATFORM_EXTENSIONS_WITH_VERSION, cl::vector) \ @@ -1431,7 +1605,32 @@ inline cl_int getInfoHelper(Func f, cl_uint name, T* param, int, typename T::cl_ F(cl_command_queue_info, CL_QUEUE_PROPERTIES_ARRAY, cl::vector) \ F(cl_mem_info, CL_MEM_PROPERTIES, cl::vector) \ F(cl_pipe_info, CL_PIPE_PROPERTIES, cl::vector) \ - F(cl_sampler_info, CL_SAMPLER_PROPERTIES, cl::vector) + F(cl_sampler_info, CL_SAMPLER_PROPERTIES, cl::vector) \ + +#define CL_HPP_PARAM_NAME_CL_IMAGE_REQUIREMENTS_EXT(F) \ + F(cl_image_requirements_info_ext, CL_IMAGE_REQUIREMENTS_ROW_PITCH_ALIGNMENT_EXT, size_type) \ + F(cl_image_requirements_info_ext, CL_IMAGE_REQUIREMENTS_BASE_ADDRESS_ALIGNMENT_EXT, size_type) \ + F(cl_image_requirements_info_ext, CL_IMAGE_REQUIREMENTS_SIZE_EXT, size_type) \ + F(cl_image_requirements_info_ext, CL_IMAGE_REQUIREMENTS_MAX_WIDTH_EXT, cl_uint) \ + F(cl_image_requirements_info_ext, CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT, cl_uint) \ + F(cl_image_requirements_info_ext, CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT, cl_uint) \ + F(cl_image_requirements_info_ext, CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT, cl_uint) \ + +#define CL_HPP_PARAM_NAME_CL_IMAGE_REQUIREMENTS_SLICE_PITCH_ALIGNMENT_EXT(F) \ + F(cl_image_requirements_info_ext, CL_IMAGE_REQUIREMENTS_SLICE_PITCH_ALIGNMENT_EXT, size_type) \ + +#define CL_HPP_PARAM_NAME_CL_INTEL_COMMAND_QUEUE_FAMILIES_(F) \ + F(cl_device_info, CL_DEVICE_QUEUE_FAMILY_PROPERTIES_INTEL, cl::vector) \ + \ + F(cl_command_queue_info, CL_QUEUE_FAMILY_INTEL, cl_uint) \ + F(cl_command_queue_info, CL_QUEUE_INDEX_INTEL, cl_uint) + +#define CL_HPP_PARAM_NAME_CL_INTEL_UNIFIED_SHARED_MEMORY_(F) \ + F(cl_device_info, CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL, cl_device_unified_shared_memory_capabilities_intel ) \ + F(cl_device_info, CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL, cl_device_unified_shared_memory_capabilities_intel ) \ + F(cl_device_info, CL_DEVICE_SINGLE_DEVICE_SHARED_MEM_CAPABILITIES_INTEL, cl_device_unified_shared_memory_capabilities_intel ) \ + F(cl_device_info, CL_DEVICE_CROSS_DEVICE_SHARED_MEM_CAPABILITIES_INTEL, cl_device_unified_shared_memory_capabilities_intel ) \ + F(cl_device_info, CL_DEVICE_SHARED_SYSTEM_MEM_CAPABILITIES_INTEL, cl_device_unified_shared_memory_capabilities_intel ) template struct param_traits {}; @@ -1465,13 +1664,13 @@ CL_HPP_PARAM_NAME_INFO_2_2_(CL_HPP_DECLARE_PARAM_TRAITS_) CL_HPP_PARAM_NAME_INFO_3_0_(CL_HPP_DECLARE_PARAM_TRAITS_) #endif // CL_HPP_TARGET_OPENCL_VERSION >= 300 -#if defined(CL_HPP_USE_CL_SUB_GROUPS_KHR) && CL_HPP_TARGET_OPENCL_VERSION < 210 +#if defined(cl_khr_subgroups) && CL_HPP_TARGET_OPENCL_VERSION < 210 CL_HPP_PARAM_NAME_INFO_SUBGROUP_KHR_(CL_HPP_DECLARE_PARAM_TRAITS_) -#endif // #if defined(CL_HPP_USE_CL_SUB_GROUPS_KHR) && CL_HPP_TARGET_OPENCL_VERSION < 210 +#endif // #if defined(cl_khr_subgroups) && CL_HPP_TARGET_OPENCL_VERSION < 210 -#if defined(CL_HPP_USE_IL_KHR) +#if defined(cl_khr_il_program) && CL_HPP_TARGET_OPENCL_VERSION < 210 CL_HPP_PARAM_NAME_INFO_IL_KHR_(CL_HPP_DECLARE_PARAM_TRAITS_) -#endif // #if defined(CL_HPP_USE_IL_KHR) +#endif // #if defined(cl_khr_il_program) && CL_HPP_TARGET_OPENCL_VERSION < 210 // Flags deprecated in OpenCL 2.0 @@ -1496,9 +1695,9 @@ CL_HPP_PARAM_NAME_INFO_1_1_DEPRECATED_IN_2_0_(CL_HPP_DECLARE_PARAM_TRAITS_) CL_HPP_PARAM_NAME_INFO_1_2_DEPRECATED_IN_2_0_(CL_HPP_DECLARE_PARAM_TRAITS_) #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200 -#if defined(CL_HPP_USE_CL_DEVICE_FISSION) -CL_HPP_PARAM_NAME_DEVICE_FISSION_(CL_HPP_DECLARE_PARAM_TRAITS_); -#endif // CL_HPP_USE_CL_DEVICE_FISSION +#if defined(cl_ext_device_fission) +CL_HPP_PARAM_NAME_DEVICE_FISSION_EXT_(CL_HPP_DECLARE_PARAM_TRAITS_) +#endif // cl_ext_device_fission #if defined(cl_khr_extended_versioning) #if CL_HPP_TARGET_OPENCL_VERSION < 300 @@ -1507,6 +1706,31 @@ CL_HPP_PARAM_NAME_CL_KHR_EXTENDED_VERSIONING_CL3_SHARED_(CL_HPP_DECLARE_PARAM_TR CL_HPP_PARAM_NAME_CL_KHR_EXTENDED_VERSIONING_KHRONLY_(CL_HPP_DECLARE_PARAM_TRAITS_) #endif // cl_khr_extended_versioning +#if defined(cl_khr_semaphore) +CL_HPP_PARAM_NAME_CL_KHR_SEMAPHORE_(CL_HPP_DECLARE_PARAM_TRAITS_) +#if defined(CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_semaphore_info_khr, CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR, cl::vector) +#endif // defined(CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR) +#endif // defined(cl_khr_semaphore) + +#ifdef cl_khr_external_memory +CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_MEMORY_(CL_HPP_DECLARE_PARAM_TRAITS_) +#endif // cl_khr_external_memory + +#if defined(cl_khr_external_semaphore) +CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_(CL_HPP_DECLARE_PARAM_TRAITS_) +#endif // cl_khr_external_semaphore + +#if defined(cl_khr_external_semaphore_opaque_fd) +CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXT(CL_HPP_DECLARE_PARAM_TRAITS_) +#endif // cl_khr_external_semaphore_opaque_fd +#if defined(cl_khr_external_semaphore_sync_fd) +CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_SYNC_FD_EXT(CL_HPP_DECLARE_PARAM_TRAITS_) +#endif // cl_khr_external_semaphore_sync_fd +#if defined(cl_khr_external_semaphore_win32) +CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_WIN32_EXT(CL_HPP_DECLARE_PARAM_TRAITS_) +#endif // cl_khr_external_semaphore_win32 + #if defined(cl_khr_device_uuid) using uuid_array = array; using luid_array = array; @@ -1521,9 +1745,31 @@ CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_NODE_MASK_KHR, cl_uint) CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_PCI_BUS_INFO_KHR, cl_device_pci_bus_info_khr) #endif +// Note: some headers do not define cl_khr_image2d_from_buffer +#if CL_HPP_TARGET_OPENCL_VERSION < 200 +#if defined(CL_DEVICE_IMAGE_PITCH_ALIGNMENT_KHR) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_IMAGE_PITCH_ALIGNMENT_KHR, cl_uint) +#endif +#if defined(CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR, cl_uint) +#endif +#endif // CL_HPP_TARGET_OPENCL_VERSION < 200 + #if defined(cl_khr_integer_dot_product) CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIES_KHR, cl_device_integer_dot_product_capabilities_khr) -#endif +#if defined(CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT_KHR) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT_KHR, cl_device_integer_dot_product_acceleration_properties_khr) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_4x8BIT_PACKED_KHR, cl_device_integer_dot_product_acceleration_properties_khr) +#endif // defined(CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT_KHR) +#endif // defined(cl_khr_integer_dot_product) + +#if defined(cl_ext_image_requirements_info) +CL_HPP_PARAM_NAME_CL_IMAGE_REQUIREMENTS_EXT(CL_HPP_DECLARE_PARAM_TRAITS_) +#endif // cl_ext_image_requirements_info + +#if defined(cl_ext_image_from_buffer) +CL_HPP_PARAM_NAME_CL_IMAGE_REQUIREMENTS_SLICE_PITCH_ALIGNMENT_EXT(CL_HPP_DECLARE_PARAM_TRAITS_) +#endif // cl_ext_image_from_buffer #ifdef CL_PLATFORM_ICD_SUFFIX_KHR CL_HPP_DECLARE_PARAM_TRAITS_(cl_platform_info, CL_PLATFORM_ICD_SUFFIX_KHR, string) @@ -1562,6 +1808,9 @@ CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUT #ifdef CL_DEVICE_LOCAL_MEM_BANKS_AMD CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_LOCAL_MEM_BANKS_AMD, cl_uint) #endif +#ifdef CL_DEVICE_BOARD_NAME_AMD +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_BOARD_NAME_AMD, string) +#endif #ifdef CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM, cl_ulong) @@ -1572,12 +1821,27 @@ CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_JOB_SLOTS_ARM, cl_uint) #ifdef CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM, cl_bitfield) #endif +#ifdef CL_DEVICE_SUPPORTED_REGISTER_ALLOCATIONS_ARM +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SUPPORTED_REGISTER_ALLOCATIONS_ARM, vector) +#endif +#ifdef CL_DEVICE_MAX_WARP_COUNT_ARM +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_MAX_WARP_COUNT_ARM, cl_uint) +#endif +#ifdef CL_KERNEL_MAX_WARP_COUNT_ARM +CL_HPP_DECLARE_PARAM_TRAITS_(cl_kernel_info, CL_KERNEL_MAX_WARP_COUNT_ARM, cl_uint) +#endif #ifdef CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_ARM CL_HPP_DECLARE_PARAM_TRAITS_(cl_kernel_exec_info, CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_ARM, cl_uint) #endif #ifdef CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_MODIFIER_ARM CL_HPP_DECLARE_PARAM_TRAITS_(cl_kernel_exec_info, CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_MODIFIER_ARM, cl_int) #endif +#ifdef CL_KERNEL_EXEC_INFO_WARP_COUNT_LIMIT_ARM +CL_HPP_DECLARE_PARAM_TRAITS_(cl_kernel_exec_info, CL_KERNEL_EXEC_INFO_WARP_COUNT_LIMIT_ARM, cl_uint) +#endif +#ifdef CL_KERNEL_EXEC_INFO_COMPUTE_UNIT_MAX_QUEUED_BATCHES_ARM +CL_HPP_DECLARE_PARAM_TRAITS_(cl_kernel_exec_info, CL_KERNEL_EXEC_INFO_COMPUTE_UNIT_MAX_QUEUED_BATCHES_ARM, cl_uint) +#endif #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, cl_uint) @@ -1601,6 +1865,77 @@ CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV, c CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_INTEGRATED_MEMORY_NV, cl_bool) #endif +#if defined(cl_khr_command_buffer) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_COMMAND_BUFFER_CAPABILITIES_KHR, cl_device_command_buffer_capabilities_khr) +#if CL_KHR_COMMAND_BUFFER_EXTENSION_VERSION > CL_MAKE_VERSION(0, 9, 5) +CL_HPP_DECLARE_PARAM_TRAITS_( + cl_device_info, CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR, + cl_command_queue_properties) +#endif +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_COMMAND_BUFFER_REQUIRED_QUEUE_PROPERTIES_KHR, cl_command_queue_properties) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_command_buffer_info_khr, CL_COMMAND_BUFFER_QUEUES_KHR, cl::vector) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_command_buffer_info_khr, CL_COMMAND_BUFFER_NUM_QUEUES_KHR, cl_uint) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_command_buffer_info_khr, CL_COMMAND_BUFFER_REFERENCE_COUNT_KHR, cl_uint) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_command_buffer_info_khr, CL_COMMAND_BUFFER_STATE_KHR, cl_command_buffer_state_khr) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_command_buffer_info_khr, CL_COMMAND_BUFFER_PROPERTIES_ARRAY_KHR, cl::vector) +#endif /* cl_khr_command_buffer */ + +#if defined(cl_khr_command_buffer_mutable_dispatch) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_mutable_command_info_khr, CL_MUTABLE_COMMAND_COMMAND_QUEUE_KHR, CommandQueue) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_mutable_command_info_khr, CL_MUTABLE_COMMAND_COMMAND_BUFFER_KHR, CommandBufferKhr) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_mutable_command_info_khr, CL_MUTABLE_COMMAND_COMMAND_TYPE_KHR, cl_command_type) + +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION > CL_MAKE_VERSION(0, 9, 2) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_mutable_command_info_khr, CL_MUTABLE_COMMAND_PROPERTIES_ARRAY_KHR, cl::vector) +#else +CL_HPP_DECLARE_PARAM_TRAITS_(cl_mutable_command_info_khr, CL_MUTABLE_DISPATCH_PROPERTIES_ARRAY_KHR, cl::vector) +#endif +CL_HPP_DECLARE_PARAM_TRAITS_(cl_mutable_command_info_khr, CL_MUTABLE_DISPATCH_KERNEL_KHR, cl_kernel) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_mutable_command_info_khr, CL_MUTABLE_DISPATCH_DIMENSIONS_KHR, cl_uint) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_mutable_command_info_khr, CL_MUTABLE_DISPATCH_GLOBAL_WORK_OFFSET_KHR, cl::vector) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_mutable_command_info_khr, CL_MUTABLE_DISPATCH_GLOBAL_WORK_SIZE_KHR, cl::vector) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_mutable_command_info_khr, CL_MUTABLE_DISPATCH_LOCAL_WORK_SIZE_KHR, cl::vector) +#endif /* cl_khr_command_buffer_mutable_dispatch */ + +#if defined(cl_khr_kernel_clock) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_KERNEL_CLOCK_CAPABILITIES_KHR, cl_device_kernel_clock_capabilities_khr) +#endif /* cl_khr_kernel_clock */ + +#if defined(cl_khr_spirv_queries) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SPIRV_EXTENDED_INSTRUCTION_SETS_KHR, cl::vector) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SPIRV_EXTENSIONS_KHR, cl::vector) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SPIRV_CAPABILITIES_KHR, cl::vector) +#endif /* cl_khr_spirv_queries */ + +#if defined(cl_ext_float_atomics) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SINGLE_FP_ATOMIC_CAPABILITIES_EXT, cl_device_fp_atomic_capabilities_ext) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_DOUBLE_FP_ATOMIC_CAPABILITIES_EXT, cl_device_fp_atomic_capabilities_ext) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_HALF_FP_ATOMIC_CAPABILITIES_EXT, cl_device_fp_atomic_capabilities_ext) +#endif /* cl_ext_float_atomics */ + +#if defined(cl_intel_command_queue_families) +CL_HPP_PARAM_NAME_CL_INTEL_COMMAND_QUEUE_FAMILIES_(CL_HPP_DECLARE_PARAM_TRAITS_) +#endif // cl_intel_command_queue_families + +#if defined(cl_intel_device_attribute_query) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_IP_VERSION_INTEL, cl_uint) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_ID_INTEL, cl_uint) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_NUM_SLICES_INTEL, cl_uint) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_NUM_SUB_SLICES_PER_SLICE_INTEL, cl_uint) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_NUM_EUS_PER_SUB_SLICE_INTEL, cl_uint) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_NUM_THREADS_PER_EU_INTEL, cl_uint) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_FEATURE_CAPABILITIES_INTEL, cl_device_feature_capabilities_intel) +#endif // cl_intel_device_attribute_query + +#if defined(cl_intel_required_subgroup_size) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SUB_GROUP_SIZES_INTEL, cl::vector) +CL_HPP_DECLARE_PARAM_TRAITS_(cl_kernel_work_group_info, CL_KERNEL_SPILL_MEM_SIZE_INTEL, cl_ulong) +#endif // cl_intel_required_subgroup_size + +#if defined(cl_intel_unified_shared_memory) +CL_HPP_PARAM_NAME_CL_INTEL_UNIFIED_SHARED_MEMORY_(CL_HPP_DECLARE_PARAM_TRAITS_) +#endif // cl_intel_unified_shared_memory + // Convenience functions template @@ -1659,25 +1994,25 @@ struct ReferenceHandler /** * Retain the device. * \param device A valid device created using createSubDevices - * \return + * \return * CL_SUCCESS if the function executed successfully. * CL_INVALID_DEVICE if device was not a valid subdevice * CL_OUT_OF_RESOURCES * CL_OUT_OF_HOST_MEMORY */ static cl_int retain(cl_device_id device) - { return ::clRetainDevice(device); } + { return CL_(clRetainDevice)(device); } /** * Retain the device. * \param device A valid device created using createSubDevices - * \return + * \return * CL_SUCCESS if the function executed successfully. * CL_INVALID_DEVICE if device was not a valid subdevice * CL_OUT_OF_RESOURCES * CL_OUT_OF_HOST_MEMORY */ static cl_int release(cl_device_id device) - { return ::clReleaseDevice(device); } + { return CL_(clReleaseDevice)(device); } }; #else // CL_HPP_TARGET_OPENCL_VERSION >= 120 /** @@ -1710,67 +2045,124 @@ template <> struct ReferenceHandler { static cl_int retain(cl_context context) - { return ::clRetainContext(context); } + { return CL_(clRetainContext)(context); } static cl_int release(cl_context context) - { return ::clReleaseContext(context); } + { return CL_(clReleaseContext)(context); } }; template <> struct ReferenceHandler { static cl_int retain(cl_command_queue queue) - { return ::clRetainCommandQueue(queue); } + { return CL_(clRetainCommandQueue)(queue); } static cl_int release(cl_command_queue queue) - { return ::clReleaseCommandQueue(queue); } + { return CL_(clReleaseCommandQueue)(queue); } }; template <> struct ReferenceHandler { static cl_int retain(cl_mem memory) - { return ::clRetainMemObject(memory); } + { return CL_(clRetainMemObject)(memory); } static cl_int release(cl_mem memory) - { return ::clReleaseMemObject(memory); } + { return CL_(clReleaseMemObject)(memory); } }; template <> struct ReferenceHandler { static cl_int retain(cl_sampler sampler) - { return ::clRetainSampler(sampler); } + { return CL_(clRetainSampler)(sampler); } static cl_int release(cl_sampler sampler) - { return ::clReleaseSampler(sampler); } + { return CL_(clReleaseSampler)(sampler); } }; template <> struct ReferenceHandler { static cl_int retain(cl_program program) - { return ::clRetainProgram(program); } + { return CL_(clRetainProgram)(program); } static cl_int release(cl_program program) - { return ::clReleaseProgram(program); } + { return CL_(clReleaseProgram)(program); } }; template <> struct ReferenceHandler { static cl_int retain(cl_kernel kernel) - { return ::clRetainKernel(kernel); } + { return CL_(clRetainKernel)(kernel); } static cl_int release(cl_kernel kernel) - { return ::clReleaseKernel(kernel); } + { return CL_(clReleaseKernel)(kernel); } }; template <> struct ReferenceHandler { static cl_int retain(cl_event event) - { return ::clRetainEvent(event); } + { return CL_(clRetainEvent)(event); } static cl_int release(cl_event event) - { return ::clReleaseEvent(event); } + { return CL_(clReleaseEvent)(event); } }; +#ifdef cl_khr_semaphore +template <> +struct ReferenceHandler +{ + static cl_int retain(cl_semaphore_khr semaphore) + { + if (pfn_clRetainSemaphoreKHR != nullptr) { + return pfn_clRetainSemaphoreKHR(semaphore); + } -#if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120 + return CL_INVALID_OPERATION; + } + + static cl_int release(cl_semaphore_khr semaphore) + { + if (pfn_clReleaseSemaphoreKHR != nullptr) { + return pfn_clReleaseSemaphoreKHR(semaphore); + } + + return CL_INVALID_OPERATION; + } +}; +#endif // cl_khr_semaphore +#if defined(cl_khr_command_buffer) +template <> +struct ReferenceHandler +{ + static cl_int retain(cl_command_buffer_khr cmdBufferKhr) + { + if (pfn_clRetainCommandBufferKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, __RETAIN_COMMAND_BUFFER_KHR_ERR); + } + return pfn_clRetainCommandBufferKHR(cmdBufferKhr); + } + + static cl_int release(cl_command_buffer_khr cmdBufferKhr) + { + if (pfn_clReleaseCommandBufferKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, __RELEASE_COMMAND_BUFFER_KHR_ERR); + } + return pfn_clReleaseCommandBufferKHR(cmdBufferKhr); + } +}; + +template <> +struct ReferenceHandler +{ + // cl_mutable_command_khr does not have retain(). + static cl_int retain(cl_mutable_command_khr) + { return CL_SUCCESS; } + // cl_mutable_command_khr does not have release(). + static cl_int release(cl_mutable_command_khr) + { return CL_SUCCESS; } +}; +#endif // cl_khr_command_buffer + + +#if (CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120) || \ + (CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200) // Extracts version number with major in the upper 16 bits, minor in the lower 16 static cl_uint getVersion(const vector &versionInfo) { @@ -1794,17 +2186,17 @@ static cl_uint getVersion(const vector &versionInfo) static cl_uint getPlatformVersion(cl_platform_id platform) { size_type size = 0; - clGetPlatformInfo(platform, CL_PLATFORM_VERSION, 0, NULL, &size); + CL_(clGetPlatformInfo)(platform, CL_PLATFORM_VERSION, 0, nullptr, &size); vector versionInfo(size); - clGetPlatformInfo(platform, CL_PLATFORM_VERSION, size, versionInfo.data(), &size); + CL_(clGetPlatformInfo)(platform, CL_PLATFORM_VERSION, size, versionInfo.data(), &size); return getVersion(versionInfo); } static cl_uint getDevicePlatformVersion(cl_device_id device) { cl_platform_id platform; - clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(platform), &platform, NULL); + CL_(clGetDeviceInfo)(device, CL_DEVICE_PLATFORM, sizeof(platform), &platform, nullptr); return getPlatformVersion(platform); } @@ -1813,14 +2205,14 @@ static cl_uint getContextPlatformVersion(cl_context context) // The platform cannot be queried directly, so we first have to grab a // device and obtain its context size_type size = 0; - clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, &size); + CL_(clGetContextInfo)(context, CL_CONTEXT_DEVICES, 0, nullptr, &size); if (size == 0) return 0; vector devices(size/sizeof(cl_device_id)); - clGetContextInfo(context, CL_CONTEXT_DEVICES, size, devices.data(), NULL); + CL_(clGetContextInfo)(context, CL_CONTEXT_DEVICES, size, devices.data(), nullptr); return getDevicePlatformVersion(devices[0]); } -#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120 +#endif // CL_HPP_TARGET_OPENCL_VERSION && CL_HPP_MINIMUM_OPENCL_VERSION template class Wrapper @@ -1832,18 +2224,18 @@ class Wrapper cl_type object_; public: - Wrapper() : object_(NULL) { } - - Wrapper(const cl_type &obj, bool retainObject) : object_(obj) + Wrapper() : object_(nullptr) { } + + Wrapper(const cl_type &obj, bool retainObject) : object_(obj) { - if (retainObject) { - detail::errHandler(retain(), __RETAIN_ERR); + if (retainObject) { + detail::errHandler(retain(), __RETAIN_ERR); } } ~Wrapper() { - if (object_ != NULL) { release(); } + if (object_ != nullptr) { release(); } } Wrapper(const Wrapper& rhs) @@ -1852,10 +2244,10 @@ class Wrapper detail::errHandler(retain(), __RETAIN_ERR); } - Wrapper(Wrapper&& rhs) CL_HPP_NOEXCEPT_ + Wrapper(Wrapper&& rhs) noexcept { object_ = rhs.object_; - rhs.object_ = NULL; + rhs.object_ = nullptr; } Wrapper& operator = (const Wrapper& rhs) @@ -1873,7 +2265,7 @@ class Wrapper if (this != &rhs) { detail::errHandler(release(), __RELEASE_ERR); object_ = rhs.object_; - rhs.object_ = NULL; + rhs.object_ = nullptr; } return *this; } @@ -1929,31 +2321,30 @@ class Wrapper static bool isReferenceCountable(cl_device_id device) { bool retVal = false; -#if CL_HPP_TARGET_OPENCL_VERSION >= 120 -#if CL_HPP_MINIMUM_OPENCL_VERSION < 120 - if (device != NULL) { +#if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120 + if (device != nullptr) { int version = getDevicePlatformVersion(device); if(version > ((1 << 16) + 1)) { retVal = true; } } -#else // CL_HPP_MINIMUM_OPENCL_VERSION < 120 +#elif CL_HPP_TARGET_OPENCL_VERSION >= 120 retVal = true; -#endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120 -#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 +#endif // CL_HPP_TARGET_OPENCL_VERSION + (void)device; return retVal; } public: - Wrapper() : object_(NULL), referenceCountable_(false) - { + Wrapper() : object_(nullptr), referenceCountable_(false) + { } - - Wrapper(const cl_type &obj, bool retainObject) : - object_(obj), - referenceCountable_(false) + + Wrapper(const cl_type &obj, bool retainObject) : + object_(obj), + referenceCountable_(false) { - referenceCountable_ = isReferenceCountable(obj); + referenceCountable_ = isReferenceCountable(obj); if (retainObject) { detail::errHandler(retain(), __RETAIN_ERR); @@ -1964,19 +2355,19 @@ class Wrapper { release(); } - + Wrapper(const Wrapper& rhs) { object_ = rhs.object_; - referenceCountable_ = isReferenceCountable(object_); + referenceCountable_ = isReferenceCountable(object_); detail::errHandler(retain(), __RETAIN_ERR); } - Wrapper(Wrapper&& rhs) CL_HPP_NOEXCEPT_ + Wrapper(Wrapper&& rhs) noexcept { object_ = rhs.object_; referenceCountable_ = rhs.referenceCountable_; - rhs.object_ = NULL; + rhs.object_ = nullptr; rhs.referenceCountable_ = false; } @@ -1997,7 +2388,7 @@ class Wrapper detail::errHandler(release(), __RELEASE_ERR); object_ = rhs.object_; referenceCountable_ = rhs.referenceCountable_; - rhs.object_ = NULL; + rhs.object_ = nullptr; rhs.referenceCountable_ = false; } return *this; @@ -2007,7 +2398,7 @@ class Wrapper { detail::errHandler(release(), __RELEASE_ERR); object_ = rhs; - referenceCountable_ = isReferenceCountable(object_); + referenceCountable_ = isReferenceCountable(object_); return *this; } @@ -2061,51 +2452,7 @@ inline bool operator!=(const Wrapper &lhs, const Wrapper &rhs) //! \endcond -using BuildLogType = vector::param_type>>; -#if defined(CL_HPP_ENABLE_EXCEPTIONS) -/** -* Exception class for build errors to carry build info -*/ -class BuildError : public Error -{ -private: - BuildLogType buildLogs; -public: - BuildError(cl_int err, const char * errStr, const BuildLogType &vec) : Error(err, errStr), buildLogs(vec) - { - } - - BuildLogType getBuildLog() const - { - return buildLogs; - } -}; -namespace detail { - static inline cl_int buildErrHandler( - cl_int err, - const char * errStr, - const BuildLogType &buildLogs) - { - if (err != CL_SUCCESS) { - throw BuildError(err, errStr, buildLogs); - } - return err; - } -} // namespace detail -#else -namespace detail { - static inline cl_int buildErrHandler( - cl_int err, - const char * errStr, - const BuildLogType &buildLogs) - { - (void)buildLogs; // suppress unused variable warning - (void)errStr; - return err; - } -} // namespace detail -#endif // #if defined(CL_HPP_ENABLE_EXCEPTIONS) /*! \stuct ImageFormat @@ -2182,14 +2529,14 @@ class Device : public detail::Wrapper } #endif // #ifdef CL_HPP_UNIT_TEST_ENABLE - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. Device() : detail::Wrapper() { } /*! \brief Constructor from cl_device_id. - * + * * This simply copies the device ID value, which is an inexpensive operation. */ - explicit Device(const cl_device_id &device, bool retainObject = false) : + explicit Device(const cl_device_id &device, bool retainObject = false) : detail::Wrapper(device, retainObject) { } /*! \brief Returns the first device on the default context. @@ -2197,11 +2544,11 @@ class Device : public detail::Wrapper * \see Context::getDefault() */ static Device getDefault( - cl_int *errResult = NULL) + cl_int *errResult = nullptr) { std::call_once(default_initialized_, makeDefault); detail::errHandler(default_error_); - if (errResult != NULL) { + if (errResult != nullptr) { *errResult = default_error_; } return default_; @@ -2222,7 +2569,7 @@ class Device : public detail::Wrapper } /*! \brief Assignment operator from cl_device_id. - * + * * This simply copies the device ID value, which is an inexpensive operation. */ Device& operator = (const cl_device_id& rhs) @@ -2230,59 +2577,31 @@ class Device : public detail::Wrapper detail::Wrapper::operator=(rhs); return *this; } - - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Device(const Device& dev) : detail::Wrapper(dev) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Device& operator = (const Device &dev) - { - detail::Wrapper::operator=(dev); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Device(Device&& dev) CL_HPP_NOEXCEPT_ : detail::Wrapper(std::move(dev)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Device& operator = (Device &&dev) - { - detail::Wrapper::operator=(std::move(dev)); - return *this; - } + //! \brief Wrapper for clGetDeviceInfo(). template cl_int getInfo(cl_device_info name, T* param) const { return detail::errHandler( - detail::getInfo(&::clGetDeviceInfo, object_, name, param), + detail::getInfo(CL_(clGetDeviceInfo), object_, name, param), __GET_DEVICE_INFO_ERR); } //! \brief Wrapper for clGetDeviceInfo() that returns by value. template typename detail::param_traits::param_type - getInfo(cl_int* err = NULL) const + getInfo(cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_device_info, name>::param_type param; cl_int result = getInfo(name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; } - #if CL_HPP_TARGET_OPENCL_VERSION >= 210 /** * Return the current value of the host clock as seen by the device. @@ -2293,8 +2612,8 @@ class Device : public detail::Wrapper cl_ulong getHostTimer(cl_int *error = nullptr) { cl_ulong retVal = 0; - cl_int err = - clGetHostTimer(this->get(), &retVal); + cl_int err = + CL_(clGetHostTimer)(this->get(), &retVal); detail::errHandler( err, __GET_HOST_TIMER_ERR); @@ -2308,7 +2627,7 @@ class Device : public detail::Wrapper * Return a synchronized pair of host and device timestamps as seen by device. * Use to correlate the clocks and get the host timer only using getHostTimer * as a lower cost mechanism in between calls. - * The resolution of the host timer may be queried with the + * The resolution of the host timer may be queried with the * CL_PLATFORM_HOST_TIMER_RESOLUTION query. * The resolution of the device timer may be queried with the * CL_DEVICE_PROFILING_TIMER_RESOLUTION query. @@ -2318,7 +2637,7 @@ class Device : public detail::Wrapper { std::pair retVal; cl_int err = - clGetDeviceAndHostTimer(this->get(), &(retVal.first), &(retVal.second)); + CL_(clGetDeviceAndHostTimer)(this->get(), &(retVal.first), &(retVal.second)); detail::errHandler( err, __GET_DEVICE_AND_HOST_TIMER_ERR); @@ -2329,91 +2648,64 @@ class Device : public detail::Wrapper } #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 210 - /** - * CL 1.2 version - */ #if CL_HPP_TARGET_OPENCL_VERSION >= 120 //! \brief Wrapper for clCreateSubDevices(). - cl_int createSubDevices( - const cl_device_partition_property * properties, - vector* devices) - { - cl_uint n = 0; - cl_int err = clCreateSubDevices(object_, properties, 0, NULL, &n); - if (err != CL_SUCCESS) { - return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR); - } - - vector ids(n); - err = clCreateSubDevices(object_, properties, n, ids.data(), NULL); - if (err != CL_SUCCESS) { - return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR); - } - - // Cannot trivially assign because we need to capture intermediates - // with safe construction - if (devices) { - devices->resize(ids.size()); - - // Assign to param, constructing with retain behaviour - // to correctly capture each underlying CL object - for (size_type i = 0; i < ids.size(); i++) { - // We do not need to retain because this device is being created - // by the runtime - (*devices)[i] = Device(ids[i], false); - } - } + cl_int createSubDevices(const cl_device_partition_property* properties, + vector* devices); +#endif // defined (CL_HPP_TARGET_OPENCL_VERSION >= 120) - return CL_SUCCESS; - } -#elif defined(CL_HPP_USE_CL_DEVICE_FISSION) +#if defined(cl_ext_device_fission) + //! \brief Wrapper for clCreateSubDevices(). + cl_int createSubDevices(const cl_device_partition_property_ext* properties, + vector* devices); +#endif // defined(cl_ext_device_fission) +}; +using BuildLogType = vector::param_type>>; +#if defined(CL_HPP_ENABLE_EXCEPTIONS) /** - * CL 1.1 version that uses device fission extension. - */ - cl_int createSubDevices( - const cl_device_partition_property_ext * properties, - vector* devices) +* Exception class for build errors to carry build info +*/ +class BuildError : public Error +{ +private: + BuildLogType buildLogs; +public: + BuildError(cl_int err, const char * errStr, const BuildLogType &vec) : Error(err, errStr), buildLogs(vec) { - typedef CL_API_ENTRY cl_int - ( CL_API_CALL * PFN_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; - - static PFN_clCreateSubDevicesEXT pfn_clCreateSubDevicesEXT = NULL; - CL_HPP_INIT_CL_EXT_FCN_PTR_(clCreateSubDevicesEXT); - - cl_uint n = 0; - cl_int err = pfn_clCreateSubDevicesEXT(object_, properties, 0, NULL, &n); - if (err != CL_SUCCESS) { - return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR); - } + } - vector ids(n); - err = pfn_clCreateSubDevicesEXT(object_, properties, n, ids.data(), NULL); + BuildLogType getBuildLog() const + { + return buildLogs; + } +}; +namespace detail { + static inline cl_int buildErrHandler( + cl_int err, + const char * errStr, + const BuildLogType &buildLogs) + { if (err != CL_SUCCESS) { - return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR); - } - // Cannot trivially assign because we need to capture intermediates - // with safe construction - if (devices) { - devices->resize(ids.size()); - - // Assign to param, constructing with retain behaviour - // to correctly capture each underlying CL object - for (size_type i = 0; i < ids.size(); i++) { - // We do not need to retain because this device is being created - // by the runtime - (*devices)[i] = Device(ids[i], false); - } + throw BuildError(err, errStr, buildLogs); } - return CL_SUCCESS; + return err; } -#endif // defined(CL_HPP_USE_CL_DEVICE_FISSION) -}; +} // namespace detail + +#else +namespace detail { + static inline cl_int buildErrHandler( + cl_int err, + const char * errStr, + const BuildLogType &buildLogs) + { + (void)buildLogs; // suppress unused variable warning + (void)errStr; + return err; + } +} // namespace detail +#endif // #if defined(CL_HPP_ENABLE_EXCEPTIONS) CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag Device::default_initialized_; CL_HPP_DEFINE_STATIC_MEMBER_ Device Device::default_; @@ -2450,7 +2742,7 @@ class Platform : public detail::Wrapper // Otherwise set it cl_uint n = 0; - cl_int err = ::clGetPlatformIDs(0, NULL, &n); + cl_int err = CL_(clGetPlatformIDs)(0, nullptr, &n); if (err != CL_SUCCESS) { default_error_ = err; return; @@ -2461,7 +2753,7 @@ class Platform : public detail::Wrapper } vector ids(n); - err = ::clGetPlatformIDs(n, ids.data(), NULL); + err = CL_(clGetPlatformIDs)(n, ids.data(), nullptr); if (err != CL_SUCCESS) { default_error_ = err; return; @@ -2484,7 +2776,7 @@ class Platform : public detail::Wrapper static void makeDefaultProvided(const Platform &p) { default_ = p; } - + public: #ifdef CL_HPP_UNIT_TEST_ENABLE /*! \brief Reset the default. @@ -2498,21 +2790,21 @@ class Platform : public detail::Wrapper } #endif // #ifdef CL_HPP_UNIT_TEST_ENABLE - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. Platform() : detail::Wrapper() { } /*! \brief Constructor from cl_platform_id. - * + * * \param retainObject will cause the constructor to retain its cl object. * Defaults to false to maintain compatibility with * earlier versions. * This simply copies the platform ID value, which is an inexpensive operation. */ - explicit Platform(const cl_platform_id &platform, bool retainObject = false) : + explicit Platform(const cl_platform_id &platform, bool retainObject = false) : detail::Wrapper(platform, retainObject) { } /*! \brief Assignment operator from cl_platform_id. - * + * * This simply copies the platform ID value, which is an inexpensive operation. */ Platform& operator = (const cl_platform_id& rhs) @@ -2522,21 +2814,21 @@ class Platform : public detail::Wrapper } static Platform getDefault( - cl_int *errResult = NULL) + cl_int *errResult = nullptr) { std::call_once(default_initialized_, makeDefault); detail::errHandler(default_error_); - if (errResult != NULL) { + if (errResult != nullptr) { *errResult = default_error_; } return default_; } /** - * Modify the default platform to be used by + * Modify the default platform to be used by * subsequent operations. * Will only set the default if no default was previously created. - * @return updated default platform. + * @return updated default platform. * Should be compared to the passed value to ensure that it was updated. */ static Platform setDefault(const Platform &default_platform) @@ -2551,26 +2843,26 @@ class Platform : public detail::Wrapper cl_int getInfo(cl_platform_info name, T* param) const { return detail::errHandler( - detail::getInfo(&::clGetPlatformInfo, object_, name, param), + detail::getInfo(CL_(clGetPlatformInfo), object_, name, param), __GET_PLATFORM_INFO_ERR); } //! \brief Wrapper for clGetPlatformInfo() that returns by value. template typename detail::param_traits::param_type - getInfo(cl_int* err = NULL) const + getInfo(cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_platform_info, name>::param_type param; cl_int result = getInfo(name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; } /*! \brief Gets a list of devices for this platform. - * + * * Wraps clGetDeviceIDs(). */ cl_int getDevices( @@ -2578,23 +2870,23 @@ class Platform : public detail::Wrapper vector* devices) const { cl_uint n = 0; - if( devices == NULL ) { + if( devices == nullptr ) { return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR); } - cl_int err = ::clGetDeviceIDs(object_, type, 0, NULL, &n); + cl_int err = CL_(clGetDeviceIDs)(object_, type, 0, nullptr, &n); if (err != CL_SUCCESS && err != CL_DEVICE_NOT_FOUND) { return detail::errHandler(err, __GET_DEVICE_IDS_ERR); } vector ids(n); if (n>0) { - err = ::clGetDeviceIDs(object_, type, n, ids.data(), NULL); + err = CL_(clGetDeviceIDs)(object_, type, n, ids.data(), nullptr); if (err != CL_SUCCESS) { return detail::errHandler(err, __GET_DEVICE_IDS_ERR); } } - // Cannot trivially assign because we need to capture intermediates + // Cannot trivially assign because we need to capture intermediates // with safe construction // We must retain things we obtain from the API to avoid releasing // API-owned objects. @@ -2621,7 +2913,7 @@ class Platform : public detail::Wrapper * * \param devices returns a vector of OpenCL D3D10 devices found. The cl::Device * values returned in devices can be used to identify a specific OpenCL - * device. If \a devices argument is NULL, this argument is ignored. + * device. If \a devices argument is nullptr, this argument is ignored. * * \return One of the following values: * - CL_SUCCESS if the function is executed successfully. @@ -2641,29 +2933,34 @@ class Platform : public detail::Wrapper vector* devices) const { typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clGetDeviceIDsFromD3D10KHR)( - cl_platform_id platform, - cl_d3d10_device_source_khr d3d_device_source, + cl_platform_id platform, + cl_d3d10_device_source_khr d3d_device_source, void * d3d_object, cl_d3d10_device_set_khr d3d_device_set, cl_uint num_entries, cl_device_id * devices, cl_uint* num_devices); - if( devices == NULL ) { + if( devices == nullptr ) { return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR); } - static PFN_clGetDeviceIDsFromD3D10KHR pfn_clGetDeviceIDsFromD3D10KHR = NULL; + static PFN_clGetDeviceIDsFromD3D10KHR pfn_clGetDeviceIDsFromD3D10KHR = nullptr; +#if CL_HPP_TARGET_OPENCL_VERSION >= 120 CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(object_, clGetDeviceIDsFromD3D10KHR); +#endif +#if CL_HPP_MINIMUM_OPENCL_VERSION < 120 + CL_HPP_INIT_CL_EXT_FCN_PTR_(clGetDeviceIDsFromD3D10KHR); +#endif cl_uint n = 0; cl_int err = pfn_clGetDeviceIDsFromD3D10KHR( - object_, - d3d_device_source, + object_, + d3d_device_source, d3d_object, - d3d_device_set, - 0, - NULL, + d3d_device_set, + 0, + nullptr, &n); if (err != CL_SUCCESS) { return detail::errHandler(err, __GET_DEVICE_IDS_ERR); @@ -2671,18 +2968,18 @@ class Platform : public detail::Wrapper vector ids(n); err = pfn_clGetDeviceIDsFromD3D10KHR( - object_, - d3d_device_source, + object_, + d3d_device_source, d3d_object, d3d_device_set, - n, - ids.data(), - NULL); + n, + ids.data(), + nullptr); if (err != CL_SUCCESS) { return detail::errHandler(err, __GET_DEVICE_IDS_ERR); } - // Cannot trivially assign because we need to capture intermediates + // Cannot trivially assign because we need to capture intermediates // with safe construction // We must retain things we obtain from the API to avoid releasing // API-owned objects. @@ -2700,7 +2997,7 @@ class Platform : public detail::Wrapper #endif /*! \brief Gets a list of available platforms. - * + * * Wraps clGetPlatformIDs(). */ static cl_int get( @@ -2708,17 +3005,17 @@ class Platform : public detail::Wrapper { cl_uint n = 0; - if( platforms == NULL ) { + if( platforms == nullptr ) { return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR); } - cl_int err = ::clGetPlatformIDs(0, NULL, &n); + cl_int err = CL_(clGetPlatformIDs)(0, nullptr, &n); if (err != CL_SUCCESS) { return detail::errHandler(err, __GET_PLATFORM_IDS_ERR); } vector ids(n); - err = ::clGetPlatformIDs(n, ids.data(), NULL); + err = CL_(clGetPlatformIDs)(n, ids.data(), nullptr); if (err != CL_SUCCESS) { return detail::errHandler(err, __GET_PLATFORM_IDS_ERR); } @@ -2735,7 +3032,7 @@ class Platform : public detail::Wrapper } /*! \brief Gets the first available platform. - * + * * Wraps clGetPlatformIDs(), returning the first result. */ static cl_int get( @@ -2758,7 +3055,7 @@ class Platform : public detail::Wrapper * Wraps clGetPlatformIDs(), returning the first result. */ static Platform get( - cl_int * errResult = NULL) + cl_int * errResult = nullptr) { cl_int err; Platform default_platform = Platform::getDefault(&err); @@ -2766,18 +3063,105 @@ class Platform : public detail::Wrapper *errResult = err; } return default_platform; - } - + } + #if CL_HPP_TARGET_OPENCL_VERSION >= 120 //! \brief Wrapper for clUnloadCompiler(). cl_int unloadCompiler() { - return ::clUnloadPlatformCompiler(object_); + return CL_(clUnloadPlatformCompiler)(object_); } #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 }; // class Platform +#if CL_HPP_TARGET_OPENCL_VERSION >= 120 + //! \brief Wrapper for clCreateSubDevices(). +inline cl_int Device::createSubDevices(const cl_device_partition_property* properties, + vector* devices) +{ + cl_uint n = 0; + cl_int err = CL_(clCreateSubDevices)(object_, properties, 0, nullptr, &n); + if (err != CL_SUCCESS) + { + return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR); + } + + vector ids(n); + err = CL_(clCreateSubDevices)(object_, properties, n, ids.data(), nullptr); + if (err != CL_SUCCESS) + { + return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR); + } + + // Cannot trivially assign because we need to capture intermediates + // with safe construction + if (devices) + { + devices->resize(ids.size()); + + // Assign to param, constructing with retain behaviour + // to correctly capture each underlying CL object + for (size_type i = 0; i < ids.size(); i++) + { + // We do not need to retain because this device is being created + // by the runtime + (*devices)[i] = Device(ids[i], false); + } + } + + return CL_SUCCESS; +} +#endif // defined (CL_HPP_TARGET_OPENCL_VERSION >= 120) + +#if defined(cl_ext_device_fission) + //! \brief Wrapper for clCreateSubDevices(). +inline cl_int Device::createSubDevices(const cl_device_partition_property_ext* properties, + vector* devices) +{ +#if CL_HPP_TARGET_OPENCL_VERSION >= 120 + cl::Device device(object_); + cl_platform_id platform = device.getInfo()(); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCreateSubDevicesEXT); +#endif +#if CL_HPP_MINIMUM_OPENCL_VERSION < 120 + CL_HPP_INIT_CL_EXT_FCN_PTR_(clCreateSubDevicesEXT); +#endif + + cl_uint n = 0; + cl_int err = pfn_clCreateSubDevicesEXT(object_, properties, 0, nullptr, &n); + if (err != CL_SUCCESS) + { + return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR); + } + + vector ids(n); + err = + pfn_clCreateSubDevicesEXT(object_, properties, n, ids.data(), nullptr); + if (err != CL_SUCCESS) + { + return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR); + } + // Cannot trivially assign because we need to capture intermediates + // with safe construction + if (devices) + { + devices->resize(ids.size()); + + // Assign to param, constructing with retain behaviour + // to correctly capture each underlying CL object + for (size_type i = 0; i < ids.size(); i++) + { + // We do not need to retain because this device is being created + // by the runtime + (*devices)[i] = Device(ids[i], false); + } + } + + return CL_SUCCESS; +} +#endif // defined(cl_ext_device_fission) + CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag Platform::default_initialized_; CL_HPP_DEFINE_STATIC_MEMBER_ Platform Platform::default_; CL_HPP_DEFINE_STATIC_MEMBER_ cl_int Platform::default_error_ = CL_SUCCESS; @@ -2796,10 +3180,29 @@ UnloadCompiler() CL_API_SUFFIX__VERSION_1_1_DEPRECATED; inline cl_int UnloadCompiler() { - return ::clUnloadCompiler(); + return CL_(clUnloadCompiler)(); } #endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) + +#if defined(cl_ext_image_requirements_info) +enum ImageRequirementsInfoExt : cl_image_requirements_info_ext +{ + RowPitchAlign = CL_IMAGE_REQUIREMENTS_ROW_PITCH_ALIGNMENT_EXT, + BaseAddAlign = CL_IMAGE_REQUIREMENTS_BASE_ADDRESS_ALIGNMENT_EXT, + Size = CL_IMAGE_REQUIREMENTS_SIZE_EXT, + MaxWidth = CL_IMAGE_REQUIREMENTS_MAX_WIDTH_EXT, + MaxHeight = CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT, + MaxDepth = CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT, + MaxArraySize = CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT, +#if defined(cl_ext_image_from_buffer) + SlicePitchAlign = CL_IMAGE_REQUIREMENTS_SLICE_PITCH_ALIGNMENT_EXT, +#endif +}; + +#endif // cl_ext_image_requirements_info + + /*! \brief Class interface for cl_context. * * \note Copies of these objects are shallow, meaning that the copy will refer @@ -2808,7 +3211,7 @@ UnloadCompiler() * * \see cl_context */ -class Context +class Context : public detail::Wrapper { private: @@ -2842,8 +3245,8 @@ class Context default_ = Context( CL_DEVICE_TYPE_DEFAULT, properties, - NULL, - NULL, + nullptr, + nullptr, &default_error_); } #if defined(CL_HPP_ENABLE_EXCEPTIONS) @@ -2863,6 +3266,51 @@ class Context default_ = c; } +#if defined(cl_ext_image_requirements_info) + struct ImageRequirementsInfo { + + ImageRequirementsInfo(cl_mem_flags f, const cl_mem_properties* mem_properties, const ImageFormat* format, const cl_image_desc* desc) + { + flags = f; + properties = mem_properties; + image_format = format; + image_desc = desc; + } + + cl_mem_flags flags = 0; + const cl_mem_properties* properties; + const ImageFormat* image_format; + const cl_image_desc* image_desc; + }; + + static cl_int getImageRequirementsInfoExtHelper(const Context &context, + const ImageRequirementsInfo &info, + cl_image_requirements_info_ext param_name, + size_type param_value_size, + void* param_value, + size_type* param_value_size_ret) + { + +#if CL_HPP_TARGET_OPENCL_VERSION >= 120 + Device device = context.getInfo().at(0); + cl_platform_id platform = device.getInfo()(); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clGetImageRequirementsInfoEXT); +#else + CL_HPP_INIT_CL_EXT_FCN_PTR_(clGetImageRequirementsInfoEXT); +#endif + + if (pfn_clGetImageRequirementsInfoEXT == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, __GET_IMAGE_REQUIREMENT_INFO_EXT_ERR); + } + + return detail::errHandler( + pfn_clGetImageRequirementsInfoEXT(context(), info.properties, + info.flags, info.image_format, info.image_desc, param_name, + param_value_size, param_value, param_value_size_ret), + __GET_IMAGE_REQUIREMENT_INFO_EXT_ERR); + } +#endif // cl_ext_image_requirements_info + public: #ifdef CL_HPP_UNIT_TEST_ENABLE /*! \brief Reset the default. @@ -2882,14 +3330,14 @@ class Context */ Context( const vector& devices, - const cl_context_properties* properties = NULL, + const cl_context_properties* properties = nullptr, void (CL_CALLBACK * notifyFptr)( const char *, const void *, size_type, - void *) = NULL, - void* data = NULL, - cl_int* err = NULL) + void *) = nullptr, + void* data = nullptr, + cl_int* err = nullptr) { cl_int error; @@ -2900,13 +3348,13 @@ class Context deviceIDs[deviceIndex] = (devices[deviceIndex])(); } - object_ = ::clCreateContext( + object_ = CL_(clCreateContext)( properties, (cl_uint) numDevices, deviceIDs.data(), notifyFptr, data, &error); detail::errHandler(error, __CREATE_CONTEXT_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -2917,57 +3365,57 @@ class Context */ Context( const Device& device, - const cl_context_properties* properties = NULL, + const cl_context_properties* properties = nullptr, void (CL_CALLBACK * notifyFptr)( const char *, const void *, size_type, - void *) = NULL, - void* data = NULL, - cl_int* err = NULL) + void *) = nullptr, + void* data = nullptr, + cl_int* err = nullptr) { cl_int error; cl_device_id deviceID = device(); - object_ = ::clCreateContext( + object_ = CL_(clCreateContext)( properties, 1, &deviceID, notifyFptr, data, &error); detail::errHandler(error, __CREATE_CONTEXT_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } - + /*! \brief Constructs a context including all or a subset of devices of a specified type. * * Wraps clCreateContextFromType(). */ Context( cl_device_type type, - const cl_context_properties* properties = NULL, + const cl_context_properties* properties = nullptr, void (CL_CALLBACK * notifyFptr)( const char *, const void *, size_type, - void *) = NULL, - void* data = NULL, - cl_int* err = NULL) + void *) = nullptr, + void* data = nullptr, + cl_int* err = nullptr) { cl_int error; #if !defined(__APPLE__) && !defined(__MACOS) cl_context_properties prop[4] = {CL_CONTEXT_PLATFORM, 0, 0, 0 }; - if (properties == NULL) { + if (properties == nullptr) { // Get a valid platform ID as we cannot send in a blank one vector platforms; error = Platform::get(&platforms); if (error != CL_SUCCESS) { detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } return; @@ -2996,7 +3444,7 @@ class Context // Only squash CL_SUCCESS and CL_DEVICE_NOT_FOUND if (error != CL_SUCCESS && error != CL_DEVICE_NOT_FOUND) { detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -3009,7 +3457,7 @@ class Context if (platform_id == 0) { detail::errHandler(CL_DEVICE_NOT_FOUND, __CREATE_CONTEXT_FROM_TYPE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = CL_DEVICE_NOT_FOUND; } return; @@ -3019,53 +3467,25 @@ class Context properties = &prop[0]; } #endif - object_ = ::clCreateContextFromType( + object_ = CL_(clCreateContextFromType)( properties, type, notifyFptr, data, &error); detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Context(const Context& ctx) : detail::Wrapper(ctx) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Context& operator = (const Context &ctx) - { - detail::Wrapper::operator=(ctx); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Context(Context&& ctx) CL_HPP_NOEXCEPT_ : detail::Wrapper(std::move(ctx)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Context& operator = (Context &&ctx) - { - detail::Wrapper::operator=(std::move(ctx)); - return *this; - } - /*! \brief Returns a singleton context including all devices of CL_DEVICE_TYPE_DEFAULT. * * \note All calls to this function return the same cl_context as the first. */ - static Context getDefault(cl_int * err = NULL) + static Context getDefault(cl_int * err = nullptr) { std::call_once(default_initialized_, makeDefault); detail::errHandler(default_error_); - if (err != NULL) { + if (err != nullptr) { *err = default_error_; } return default_; @@ -3085,19 +3505,19 @@ class Context return default_; } - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. Context() : detail::Wrapper() { } /*! \brief Constructor from cl_context - takes ownership. - * + * * This effectively transfers ownership of a refcount on the cl_context * into the new Context object. */ - explicit Context(const cl_context& context, bool retainObject = false) : + explicit Context(const cl_context& context, bool retainObject = false) : detail::Wrapper(context, retainObject) { } /*! \brief Assignment operator from cl_context - takes ownership. - * + * * This effectively transfers ownership of a refcount on the rhs and calls * clReleaseContext() on the value previously held by this instance. */ @@ -3112,26 +3532,26 @@ class Context cl_int getInfo(cl_context_info name, T* param) const { return detail::errHandler( - detail::getInfo(&::clGetContextInfo, object_, name, param), + detail::getInfo(CL_(clGetContextInfo), object_, name, param), __GET_CONTEXT_INFO_ERR); } //! \brief Wrapper for clGetContextInfo() that returns by value. template typename detail::param_traits::param_type - getInfo(cl_int* err = NULL) const + getInfo(cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_context_info, name>::param_type param; cl_int result = getInfo(name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; } /*! \brief Gets a list of supported image formats. - * + * * Wraps clGetSupportedImageFormats(). */ cl_int getSupportedImageFormats( @@ -3140,17 +3560,17 @@ class Context vector* formats) const { cl_uint numEntries; - + if (!formats) { return CL_SUCCESS; } - cl_int err = ::clGetSupportedImageFormats( - object_, + cl_int err = CL_(clGetSupportedImageFormats)( + object_, flags, - type, - 0, - NULL, + type, + 0, + nullptr, &numEntries); if (err != CL_SUCCESS) { return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR); @@ -3158,18 +3578,18 @@ class Context if (numEntries > 0) { vector value(numEntries); - err = ::clGetSupportedImageFormats( + err = CL_(clGetSupportedImageFormats)( object_, flags, type, numEntries, (cl_image_format*)value.data(), - NULL); + nullptr); if (err != CL_SUCCESS) { return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR); } - formats->assign(begin(value), end(value)); + formats->assign(value.begin(), value.end()); } else { // If no values are being returned, ensure an empty vector comes back @@ -3178,6 +3598,65 @@ class Context return CL_SUCCESS; } + +#if defined(cl_ext_image_requirements_info) + template + cl_int getImageRequirementsInfoExt(cl_image_requirements_info_ext name, + T* param, + cl_mem_flags flags = 0, + const cl_mem_properties* properties = nullptr, + const ImageFormat* image_format = nullptr, + const cl_image_desc* image_desc = nullptr) const + { + ImageRequirementsInfo imageInfo = {flags, properties, image_format, image_desc}; + + return detail::errHandler( + detail::getInfo( + Context::getImageRequirementsInfoExtHelper, *this, imageInfo, name, param), + __GET_IMAGE_REQUIREMENT_INFO_EXT_ERR); + } + + template typename + detail::param_traits::param_type + getImageRequirementsInfoExt(cl_mem_flags flags = 0, + const cl_mem_properties* properties = nullptr, + const ImageFormat* image_format = nullptr, + const cl_image_desc* image_desc = nullptr, + cl_int* err = nullptr) const + { + typename detail::param_traits< + detail::cl_image_requirements_info_ext, type>::param_type param; + cl_int result = getImageRequirementsInfoExt(type, ¶m, flags, properties, image_format, image_desc); + if (err != nullptr) { + *err = result; + } + return param; + } +#endif // cl_ext_image_requirements_info + +#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + /*! \brief Registers a destructor callback function with a context. + * + * Wraps clSetContextDestructorCallback(). + * + * Each call to this function registers the specified callback function on + * a destructor callback stack associated with context. The registered + * callback functions are called in the reverse order in which they were registered. + * If a context callback function was specified when context was created, + * it will not be called after any context destructor callback is called. + */ + cl_int setDestructorCallback( + void (CL_CALLBACK * pfn_notify)(cl_context, void *), + void * user_data = nullptr) + { + return detail::errHandler( + CL_(clSetContextDestructorCallback)( + object_, + pfn_notify, + user_data), + __SET_CONTEXT_DESCTRUCTOR_CALLBACK_ERR); + } +#endif // CL_HPP_TARGET_OPENCL_VERSION >= 300 }; inline void Device::makeDefault() @@ -3224,18 +3703,18 @@ CL_HPP_DEFINE_STATIC_MEMBER_ cl_int Context::default_error_ = CL_SUCCESS; class Event : public detail::Wrapper { public: - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. Event() : detail::Wrapper() { } /*! \brief Constructor from cl_event - takes ownership. - * + * * \param retainObject will cause the constructor to retain its cl object. * Defaults to false to maintain compatibility with * earlier versions. * This effectively transfers ownership of a refcount on the cl_event * into the new Event object. */ - explicit Event(const cl_event& event, bool retainObject = false) : + explicit Event(const cl_event& event, bool retainObject = false) : detail::Wrapper(event, retainObject) { } /*! \brief Assignment operator from cl_event - takes ownership. @@ -3254,19 +3733,19 @@ class Event : public detail::Wrapper cl_int getInfo(cl_event_info name, T* param) const { return detail::errHandler( - detail::getInfo(&::clGetEventInfo, object_, name, param), + detail::getInfo(CL_(clGetEventInfo), object_, name, param), __GET_EVENT_INFO_ERR); } //! \brief Wrapper for clGetEventInfo() that returns by value. template typename detail::param_traits::param_type - getInfo(cl_int* err = NULL) const + getInfo(cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_event_info, name>::param_type param; cl_int result = getInfo(name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; @@ -3277,32 +3756,32 @@ class Event : public detail::Wrapper cl_int getProfilingInfo(cl_profiling_info name, T* param) const { return detail::errHandler(detail::getInfo( - &::clGetEventProfilingInfo, object_, name, param), + CL_(clGetEventProfilingInfo), object_, name, param), __GET_EVENT_PROFILE_INFO_ERR); } //! \brief Wrapper for clGetEventProfilingInfo() that returns by value. template typename detail::param_traits::param_type - getProfilingInfo(cl_int* err = NULL) const + getProfilingInfo(cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_profiling_info, name>::param_type param; cl_int result = getProfilingInfo(name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; } /*! \brief Blocks the calling thread until this event completes. - * + * * Wraps clWaitForEvents(). */ cl_int wait() const { return detail::errHandler( - ::clWaitForEvents(1, &object_), + CL_(clWaitForEvents)(1, &object_), __WAIT_FOR_EVENTS_ERR); } @@ -3314,35 +3793,38 @@ class Event : public detail::Wrapper cl_int setCallback( cl_int type, void (CL_CALLBACK * pfn_notify)(cl_event, cl_int, void *), - void * user_data = NULL) + void * user_data = nullptr) { return detail::errHandler( - ::clSetEventCallback( + CL_(clSetEventCallback)( object_, type, pfn_notify, - user_data), + user_data), __SET_EVENT_CALLBACK_ERR); } #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110 /*! \brief Blocks the calling thread until every event specified is complete. - * + * * Wraps clWaitForEvents(). */ static cl_int waitForEvents(const vector& events) { + static_assert(sizeof(cl::Event) == sizeof(cl_event), + "Size of cl::Event must be equal to size of cl_event"); + return detail::errHandler( - ::clWaitForEvents( - (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL), + CL_(clWaitForEvents)( + (cl_uint) events.size(), (events.size() > 0) ? (const cl_event*)&events.front() : nullptr), __WAIT_FOR_EVENTS_ERR); } }; #if CL_HPP_TARGET_OPENCL_VERSION >= 110 /*! \brief Class interface for user events (a subset of cl_event's). - * + * * See Event for details about copy semantics, etc. */ class UserEvent : public Event @@ -3354,20 +3836,20 @@ class UserEvent : public Event */ UserEvent( const Context& context, - cl_int * err = NULL) + cl_int * err = nullptr) { cl_int error; - object_ = ::clCreateUserEvent( + object_ = CL_(clCreateUserEvent)( context(), &error); detail::errHandler(error, __CREATE_USER_EVENT_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. UserEvent() : Event() { } /*! \brief Sets the execution status of a user event object. @@ -3377,22 +3859,22 @@ class UserEvent : public Event cl_int setStatus(cl_int status) { return detail::errHandler( - ::clSetUserEventStatus(object_,status), + CL_(clSetUserEventStatus)(object_,status), __SET_USER_EVENT_STATUS_ERR); } }; #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110 /*! \brief Blocks the calling thread until every event specified is complete. - * + * * Wraps clWaitForEvents(). */ inline static cl_int WaitForEvents(const vector& events) { return detail::errHandler( - ::clWaitForEvents( - (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL), + CL_(clWaitForEvents)( + (cl_uint) events.size(), (events.size() > 0) ? (const cl_event*)&events.front() : nullptr), __WAIT_FOR_EVENTS_ERR); } @@ -3407,7 +3889,7 @@ WaitForEvents(const vector& events) class Memory : public detail::Wrapper { public: - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. Memory() : detail::Wrapper() { } /*! \brief Constructor from cl_mem - takes ownership. @@ -3435,53 +3917,24 @@ class Memory : public detail::Wrapper return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Memory(const Memory& mem) : detail::Wrapper(mem) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Memory& operator = (const Memory &mem) - { - detail::Wrapper::operator=(mem); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Memory(Memory&& mem) CL_HPP_NOEXCEPT_ : detail::Wrapper(std::move(mem)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Memory& operator = (Memory &&mem) - { - detail::Wrapper::operator=(std::move(mem)); - return *this; - } - - //! \brief Wrapper for clGetMemObjectInfo(). template cl_int getInfo(cl_mem_info name, T* param) const { return detail::errHandler( - detail::getInfo(&::clGetMemObjectInfo, object_, name, param), + detail::getInfo(CL_(clGetMemObjectInfo), object_, name, param), __GET_MEM_OBJECT_INFO_ERR); } //! \brief Wrapper for clGetMemObjectInfo() that returns by value. template typename detail::param_traits::param_type - getInfo(cl_int* err = NULL) const + getInfo(cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_mem_info, name>::param_type param; cl_int result = getInfo(name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; @@ -3503,13 +3956,13 @@ class Memory : public detail::Wrapper */ cl_int setDestructorCallback( void (CL_CALLBACK * pfn_notify)(cl_mem, void *), - void * user_data = NULL) + void * user_data = nullptr) { return detail::errHandler( - ::clSetMemObjectDestructorCallback( + CL_(clSetMemObjectDestructorCallback)( object_, pfn_notify, - user_data), + user_data), __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR); } #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110 @@ -3615,8 +4068,8 @@ inline cl_int enqueueMapSVM( cl_bool blocking, cl_map_flags flags, size_type size, - const vector* events = NULL, - Event* event = NULL); + const vector* events = nullptr, + Event* event = nullptr); /** * STL-like allocator class for managing SVM objects provided for convenience. @@ -3678,12 +4131,12 @@ class SVMAllocator { { } - pointer address(reference r) CL_HPP_NOEXCEPT_ + pointer address(reference r) noexcept { return std::addressof(r); } - const_pointer address(const_reference r) CL_HPP_NOEXCEPT_ + const_pointer address(const_reference r) noexcept { return std::addressof(r); } @@ -3692,15 +4145,16 @@ class SVMAllocator { * Allocate an SVM pointer. * * If the allocator is coarse-grained, this will take ownership to allow - * containers to correctly construct data in place. + * containers to correctly construct data in place. */ pointer allocate( size_type size, - typename cl::SVMAllocator::const_pointer = 0) + typename cl::SVMAllocator::const_pointer = 0, + bool map = true) { // Allocate memory with default alignment matching the size of the type void* voidPointer = - clSVMAlloc( + CL_(clSVMAlloc)( context_(), SVMTrait::getSVMMemFlags(), size*sizeof(T), @@ -3715,11 +4169,15 @@ class SVMAllocator { #endif // #if defined(CL_HPP_ENABLE_EXCEPTIONS) // If allocation was coarse-grained then map it - if (!(SVMTrait::getSVMMemFlags() & CL_MEM_SVM_FINE_GRAIN_BUFFER)) { + if (map && !(SVMTrait::getSVMMemFlags() & CL_MEM_SVM_FINE_GRAIN_BUFFER)) { cl_int err = enqueueMapSVM(retValue, CL_TRUE, CL_MAP_READ | CL_MAP_WRITE, size*sizeof(T)); if (err != CL_SUCCESS) { + CL_(clSVMFree)(context_(), retValue); + retValue = nullptr; +#if defined(CL_HPP_ENABLE_EXCEPTIONS) std::bad_alloc excep; throw excep; +#endif } } @@ -3729,20 +4187,20 @@ class SVMAllocator { void deallocate(pointer p, size_type) { - clSVMFree(context_(), p); + CL_(clSVMFree)(context_(), p); } /** * Return the maximum possible allocation size. * This is the minimum of the maximum sizes of all devices in the context. */ - size_type max_size() const CL_HPP_NOEXCEPT_ + size_type max_size() const noexcept { size_type maxSize = std::numeric_limits::max() / sizeof(T); for (const Device &d : context_.getInfo()) { maxSize = std::min( - maxSize, + maxSize, static_cast(d.getInfo())); } @@ -3834,10 +4292,18 @@ cl::pointer> allocate_pointer(const Alloc &alloc_, Arg T* tmp = std::allocator_traits::allocate(alloc, copies); if (!tmp) { +#if defined(CL_HPP_ENABLE_EXCEPTIONS) std::bad_alloc excep; throw excep; +#else + return nullptr; +#endif } - try { + +#if defined(CL_HPP_ENABLE_EXCEPTIONS) + try +#endif + { std::allocator_traits::construct( alloc, std::addressof(*tmp), @@ -3845,11 +4311,13 @@ cl::pointer> allocate_pointer(const Alloc &alloc_, Arg return cl::pointer>(tmp, detail::Deleter{alloc, copies}); } - catch (std::bad_alloc& b) +#if defined(CL_HPP_ENABLE_EXCEPTIONS) + catch (std::bad_alloc&) { std::allocator_traits::deallocate(alloc, tmp, copies); throw; } +#endif } template< class T, class SVMTrait, class... Args > @@ -3868,7 +4336,7 @@ cl::pointer>> allocate_svm(const cl #endif // #if !defined(CL_HPP_NO_STD_UNIQUE_PTR) /*! \brief Vector alias to simplify contruction of coarse-grained SVM containers. - * + * */ template < class T > using coarse_svm_vector = vector>>; @@ -3889,7 +4357,7 @@ using atomic_svm_vector = vector>> /*! \brief Class interface for Buffer Memory Objects. - * + * * See Memory for details about copy semantics, etc. * * \see Memory @@ -3909,44 +4377,90 @@ class Buffer : public Memory const Context& context, cl_mem_flags flags, size_type size, - void* host_ptr = NULL, - cl_int* err = NULL) + void* host_ptr = nullptr, + cl_int* err = nullptr) { cl_int error; - object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error); + object_ = CL_(clCreateBuffer)(context(), flags, size, host_ptr, &error); detail::errHandler(error, __CREATE_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } - /*! \brief Constructs a Buffer in the default context. +#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + /*! \brief Constructs a Buffer in a specified context and with specified properties. * - * Wraps clCreateBuffer(). + * Wraps clCreateBufferWithProperties(). * + * \param properties Optional list of properties for the buffer object and + * their corresponding values. The non-empty list must + * end with 0. * \param host_ptr Storage to be used if the CL_MEM_USE_HOST_PTR flag was - * specified. Note alignment & exclusivity requirements. - * - * \see Context::getDefault() + * specified. Note alignment & exclusivity requirements. */ Buffer( - cl_mem_flags flags, + const Context& context, + const vector& properties, + cl_mem_flags flags, size_type size, - void* host_ptr = NULL, - cl_int* err = NULL) + void* host_ptr = nullptr, + cl_int* err = nullptr) { cl_int error; - Context context = Context::getDefault(err); - - object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error); + if (properties.empty()) { + object_ = CL_(clCreateBufferWithProperties)(context(), nullptr, flags, + size, host_ptr, &error); + } + else { + object_ = CL_(clCreateBufferWithProperties)( + context(), properties.data(), flags, size, host_ptr, &error); + } detail::errHandler(error, __CREATE_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } +#endif + + /*! \brief Constructs a Buffer in the default context. + * + * Wraps clCreateBuffer(). + * + * \param host_ptr Storage to be used if the CL_MEM_USE_HOST_PTR flag was + * specified. Note alignment & exclusivity requirements. + * + * \see Context::getDefault() + */ + Buffer( + cl_mem_flags flags, + size_type size, + void* host_ptr = nullptr, + cl_int* err = nullptr) : Buffer(Context::getDefault(err), flags, size, host_ptr, err) { } + +#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + /*! \brief Constructs a Buffer in the default context and with specified properties. + * + * Wraps clCreateBufferWithProperties(). + * + * \param properties Optional list of properties for the buffer object and + * their corresponding values. The non-empty list must + * end with 0. + * \param host_ptr Storage to be used if the CL_MEM_USE_HOST_PTR flag was + * specified. Note alignment & exclusivity requirements. + * + * \see Context::getDefault() + */ + Buffer( + const vector& properties, + cl_mem_flags flags, + size_type size, + void* host_ptr = nullptr, + cl_int* err = nullptr) : Buffer(Context::getDefault(err), properties, flags, size, host_ptr, err) { } +#endif /*! * \brief Construct a Buffer from a host container via iterators. @@ -3959,7 +4473,7 @@ class Buffer : public Memory IteratorType endIterator, bool readOnly, bool useHostPtr = false, - cl_int* err = NULL) + cl_int* err = nullptr) { typedef typename std::iterator_traits::value_type DataType; cl_int error; @@ -3974,26 +4488,26 @@ class Buffer : public Memory if( useHostPtr ) { flags |= CL_MEM_USE_HOST_PTR; } - + size_type size = sizeof(DataType)*(endIterator - startIterator); Context context = Context::getDefault(err); if( useHostPtr ) { - object_ = ::clCreateBuffer(context(), flags, size, static_cast(&*startIterator), &error); + object_ = CL_(clCreateBuffer)(context(), flags, size, const_cast(&*startIterator), &error); } else { - object_ = ::clCreateBuffer(context(), flags, size, 0, &error); + object_ = CL_(clCreateBuffer)(context(), flags, size, 0, &error); } detail::errHandler(error, __CREATE_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } if( !useHostPtr ) { error = cl::copy(startIterator, endIterator, *this); detail::errHandler(error, __CREATE_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -4006,17 +4520,17 @@ class Buffer : public Memory */ template< typename IteratorType > Buffer(const Context &context, IteratorType startIterator, IteratorType endIterator, - bool readOnly, bool useHostPtr = false, cl_int* err = NULL); - + bool readOnly, bool useHostPtr = false, cl_int* err = nullptr); + /*! * \brief Construct a Buffer from a host container via iterators using a specified queue. * If useHostPtr is specified iterators must be random access. */ template< typename IteratorType > Buffer(const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator, - bool readOnly, bool useHostPtr = false, cl_int* err = NULL); + bool readOnly, bool useHostPtr = false, cl_int* err = nullptr); - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. Buffer() : Memory() { } /*! \brief Constructor from cl_mem - takes ownership. @@ -4039,33 +4553,6 @@ class Buffer : public Memory return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Buffer(const Buffer& buf) : Memory(buf) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Buffer& operator = (const Buffer &buf) - { - Memory::operator=(buf); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Buffer(Buffer&& buf) CL_HPP_NOEXCEPT_ : Memory(std::move(buf)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Buffer& operator = (Buffer &&buf) - { - Memory::operator=(std::move(buf)); - return *this; - } #if CL_HPP_TARGET_OPENCL_VERSION >= 110 /*! \brief Creates a new buffer object from this. @@ -4076,19 +4563,19 @@ class Buffer : public Memory cl_mem_flags flags, cl_buffer_create_type buffer_create_type, const void * buffer_create_info, - cl_int * err = NULL) + cl_int * err = nullptr) { Buffer result; cl_int error; - result.object_ = ::clCreateSubBuffer( - object_, - flags, - buffer_create_type, - buffer_create_info, + result.object_ = CL_(clCreateSubBuffer)( + object_, + flags, + buffer_create_type, + buffer_create_info, &error); detail::errHandler(error, __CREATE_SUBBUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } @@ -4101,7 +4588,7 @@ class Buffer : public Memory /*! \brief Class interface for creating OpenCL buffers from ID3D10Buffer's. * * This is provided to facilitate interoperability with Direct3D. - * + * * See Memory for details about copy semantics, etc. * * \see Memory @@ -4109,7 +4596,7 @@ class Buffer : public Memory class BufferD3D10 : public Buffer { public: - + /*! \brief Constructs a BufferD3D10, in a specified context, from a * given ID3D10Buffer. @@ -4120,7 +4607,7 @@ class BufferD3D10 : public Buffer const Context& context, cl_mem_flags flags, ID3D10Buffer* bufobj, - cl_int * err = NULL) : pfn_clCreateFromD3D10BufferKHR(nullptr) + cl_int * err = nullptr) : pfn_clCreateFromD3D10BufferKHR(nullptr) { typedef CL_API_ENTRY cl_mem (CL_API_CALL *PFN_clCreateFromD3D10BufferKHR)( cl_context context, cl_mem_flags flags, ID3D10Buffer* buffer, @@ -4128,14 +4615,15 @@ class BufferD3D10 : public Buffer PFN_clCreateFromD3D10BufferKHR pfn_clCreateFromD3D10BufferKHR; #if CL_HPP_TARGET_OPENCL_VERSION >= 120 vector props = context.getInfo(); - cl_platform platform = -1; + cl_platform platform = nullptr; for( int i = 0; i < props.size(); ++i ) { if( props[i] == CL_CONTEXT_PLATFORM ) { platform = props[i+1]; } } CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCreateFromD3D10BufferKHR); -#elif CL_HPP_TARGET_OPENCL_VERSION >= 110 +#endif +#if CL_HPP_MINIMUM_OPENCL_VERSION < 120 CL_HPP_INIT_CL_EXT_FCN_PTR_(clCreateFromD3D10BufferKHR); #endif @@ -4146,23 +4634,24 @@ class BufferD3D10 : public Buffer bufobj, &error); + // TODO: This should really have a D3D10 rerror code! detail::errHandler(error, __CREATE_GL_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. BufferD3D10() : Buffer() { } /*! \brief Constructor from cl_mem - takes ownership. * * \param retainObject will cause the constructor to retain its cl object. - * Defaults to false to maintain compatibility with + * Defaults to false to maintain compatibility with * earlier versions. * See Memory for further details. */ - explicit BufferD3D10(const cl_mem& buffer, bool retainObject = false) : + explicit BufferD3D10(const cl_mem& buffer, bool retainObject = false) : Buffer(buffer, retainObject) { } /*! \brief Assignment from cl_mem - performs shallow copy. @@ -4174,44 +4663,15 @@ class BufferD3D10 : public Buffer Buffer::operator=(rhs); return *this; } - - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - BufferD3D10(const BufferD3D10& buf) : - Buffer(buf) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - BufferD3D10& operator = (const BufferD3D10 &buf) - { - Buffer::operator=(buf); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - BufferD3D10(BufferD3D10&& buf) CL_HPP_NOEXCEPT_ : Buffer(std::move(buf)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - BufferD3D10& operator = (BufferD3D10 &&buf) - { - Buffer::operator=(std::move(buf)); - return *this; - } }; #endif /*! \brief Class interface for GL Buffer Memory Objects. * * This is provided to facilitate interoperability with OpenGL. - * + * * See Memory for details about copy semantics, etc. - * + * * \see Memory */ class BufferGL : public Buffer @@ -4226,22 +4686,22 @@ class BufferGL : public Buffer const Context& context, cl_mem_flags flags, cl_GLuint bufobj, - cl_int * err = NULL) + cl_int * err = nullptr) { cl_int error; - object_ = ::clCreateFromGLBuffer( + object_ = CL_(clCreateFromGLBuffer)( context(), flags, bufobj, &error); detail::errHandler(error, __CREATE_GL_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. BufferGL() : Buffer() { } /*! \brief Constructor from cl_mem - takes ownership. @@ -4264,33 +4724,6 @@ class BufferGL : public Buffer return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - BufferGL(const BufferGL& buf) : Buffer(buf) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - BufferGL& operator = (const BufferGL &buf) - { - Buffer::operator=(buf); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - BufferGL(BufferGL&& buf) CL_HPP_NOEXCEPT_ : Buffer(std::move(buf)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - BufferGL& operator = (BufferGL &&buf) - { - Buffer::operator=(std::move(buf)); - return *this; - } //! \brief Wrapper for clGetGLObjectInfo(). cl_int getObjectInfo( @@ -4298,7 +4731,7 @@ class BufferGL : public Buffer cl_GLuint * gl_object_name) { return detail::errHandler( - ::clGetGLObjectInfo(object_,type,gl_object_name), + CL_(clGetGLObjectInfo)(object_,type,gl_object_name), __GET_GL_OBJECT_INFO_ERR); } }; @@ -4306,9 +4739,9 @@ class BufferGL : public Buffer /*! \brief Class interface for GL Render Buffer Memory Objects. * * This is provided to facilitate interoperability with OpenGL. - * + * * See Memory for details about copy semantics, etc. - * + * * \see Memory */ class BufferRenderGL : public Buffer @@ -4323,28 +4756,28 @@ class BufferRenderGL : public Buffer const Context& context, cl_mem_flags flags, cl_GLuint bufobj, - cl_int * err = NULL) + cl_int * err = nullptr) { cl_int error; - object_ = ::clCreateFromGLRenderbuffer( + object_ = CL_(clCreateFromGLRenderbuffer)( context(), flags, bufobj, &error); detail::errHandler(error, __CREATE_GL_RENDER_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. BufferRenderGL() : Buffer() { } /*! \brief Constructor from cl_mem - takes ownership. * * \param retainObject will cause the constructor to retain its cl object. - * Defaults to false to maintain compatibility with + * Defaults to false to maintain compatibility with * earlier versions. * See Memory for further details. */ @@ -4361,33 +4794,6 @@ class BufferRenderGL : public Buffer return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - BufferRenderGL(const BufferRenderGL& buf) : Buffer(buf) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - BufferRenderGL& operator = (const BufferRenderGL &buf) - { - Buffer::operator=(buf); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - BufferRenderGL(BufferRenderGL&& buf) CL_HPP_NOEXCEPT_ : Buffer(std::move(buf)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - BufferRenderGL& operator = (BufferRenderGL &&buf) - { - Buffer::operator=(std::move(buf)); - return *this; - } //! \brief Wrapper for clGetGLObjectInfo(). cl_int getObjectInfo( @@ -4395,7 +4801,7 @@ class BufferRenderGL : public Buffer cl_GLuint * gl_object_name) { return detail::errHandler( - ::clGetGLObjectInfo(object_,type,gl_object_name), + CL_(clGetGLObjectInfo)(object_,type,gl_object_name), __GET_GL_OBJECT_INFO_ERR); } }; @@ -4403,13 +4809,13 @@ class BufferRenderGL : public Buffer /*! \brief C++ base class for Image Memory objects. * * See Memory for details about copy semantics, etc. - * + * * \see Memory */ class Image : public Memory { protected: - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. Image() : Memory() { } /*! \brief Constructor from cl_mem - takes ownership. @@ -4432,34 +4838,6 @@ class Image : public Memory return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image(const Image& img) : Memory(img) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image& operator = (const Image &img) - { - Memory::operator=(img); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Image(Image&& img) CL_HPP_NOEXCEPT_ : Memory(std::move(img)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Image& operator = (Image &&img) - { - Memory::operator=(std::move(img)); - return *this; - } - public: //! \brief Wrapper for clGetImageInfo(). @@ -4467,19 +4845,19 @@ class Image : public Memory cl_int getImageInfo(cl_image_info name, T* param) const { return detail::errHandler( - detail::getInfo(&::clGetImageInfo, object_, name, param), + detail::getInfo(CL_(clGetImageInfo), object_, name, param), __GET_IMAGE_INFO_ERR); } - + //! \brief Wrapper for clGetImageInfo() that returns by value. template typename detail::param_traits::param_type - getImageInfo(cl_int* err = NULL) const + getImageInfo(cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_image_info, name>::param_type param; cl_int result = getImageInfo(name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; @@ -4490,7 +4868,7 @@ class Image : public Memory /*! \brief Class interface for 1D Image Memory objects. * * See Memory for details about copy semantics, etc. - * + * * \see Memory */ class Image1D : public Image @@ -4505,32 +4883,68 @@ class Image1D : public Image cl_mem_flags flags, ImageFormat format, size_type width, - void* host_ptr = NULL, - cl_int* err = NULL) + void* host_ptr = nullptr, + cl_int* err = nullptr) { cl_int error; - cl_image_desc desc = {0}; + cl_image_desc desc = {}; desc.image_type = CL_MEM_OBJECT_IMAGE1D; desc.image_width = width; - object_ = ::clCreateImage( - context(), - flags, - &format, - &desc, - host_ptr, + object_ = CL_(clCreateImage)( + context(), + flags, + &format, + &desc, + host_ptr, &error); detail::errHandler(error, __CREATE_IMAGE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. Image1D() { } +#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + /*! \brief Constructs a Image1D with specified properties. + * + * Wraps clCreateImageWithProperties(). + * + * \param properties Optional list of properties for the image object and + * their corresponding values. The non-empty list must + * end with 0. + * \param host_ptr Storage to be used if the CL_MEM_USE_HOST_PTR flag was + * specified. Note alignment & exclusivity requirements. + */ + Image1D(const Context &context, const vector &properties, + cl_mem_flags flags, ImageFormat format, size_type width, + void *host_ptr = nullptr, cl_int *err = nullptr) { + cl_int error; + + cl_image_desc desc = {}; + desc.image_type = CL_MEM_OBJECT_IMAGE1D; + desc.image_width = width; + + if (properties.empty()) { + object_ = CL_(clCreateImageWithProperties)( + context(), nullptr, flags, &format, &desc, host_ptr, &error); + } else { + object_ = + CL_(clCreateImageWithProperties)(context(), properties.data(), flags, + &format, &desc, host_ptr, &error); + } + + detail::errHandler(error, __CREATE_IMAGE_ERR); + if (err != nullptr) { + *err = error; + } + } +#endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + /*! \brief Constructor from cl_mem - takes ownership. * * \param retainObject will cause the constructor to retain its cl object. @@ -4551,33 +4965,6 @@ class Image1D : public Image return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image1D(const Image1D& img) : Image(img) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image1D& operator = (const Image1D &img) - { - Image::operator=(img); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Image1D(Image1D&& img) CL_HPP_NOEXCEPT_ : Image(std::move(img)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Image1D& operator = (Image1D &&img) - { - Image::operator=(std::move(img)); - return *this; - } }; @@ -4593,31 +4980,68 @@ class Image1DBuffer : public Image ImageFormat format, size_type width, const Buffer &buffer, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; - cl_image_desc desc = {0}; + cl_image_desc desc = {}; desc.image_type = CL_MEM_OBJECT_IMAGE1D_BUFFER; desc.image_width = width; desc.buffer = buffer(); - object_ = ::clCreateImage( - context(), - flags, - &format, - &desc, - NULL, + object_ = CL_(clCreateImage)( + context(), + flags, + &format, + &desc, + nullptr, &error); detail::errHandler(error, __CREATE_IMAGE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } Image1DBuffer() { } +#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + /*! \brief Constructs a Image1DBuffer with specified properties. + * + * Wraps clCreateImageWithProperties(). + * + * \param properties Optional list of properties for the image object and + * their corresponding values. The non-empty list must + * end with 0. + * \param buffer Refer to a valid buffer or image memory object. + */ + Image1DBuffer(const Context &context, + const vector &properties, + cl_mem_flags flags, ImageFormat format, size_type width, + const Buffer &buffer, cl_int *err = nullptr) { + cl_int error; + + cl_image_desc desc = {}; + desc.image_type = CL_MEM_OBJECT_IMAGE1D_BUFFER; + desc.image_width = width; + desc.buffer = buffer(); + + if (properties.empty()) { + object_ = CL_(clCreateImageWithProperties)( + context(), nullptr, flags, &format, &desc, nullptr, &error); + } else { + object_ = + CL_(clCreateImageWithProperties)(context(), properties.data(), flags, + &format, &desc, nullptr, &error); + } + + detail::errHandler(error, __CREATE_IMAGE_ERR); + if (err != nullptr) { + *err = error; + } + } +#endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + /*! \brief Constructor from cl_mem - takes ownership. * * \param retainObject will cause the constructor to retain its cl object. @@ -4633,35 +5057,6 @@ class Image1DBuffer : public Image Image::operator=(rhs); return *this; } - - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image1DBuffer(const Image1DBuffer& img) : Image(img) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image1DBuffer& operator = (const Image1DBuffer &img) - { - Image::operator=(img); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Image1DBuffer(Image1DBuffer&& img) CL_HPP_NOEXCEPT_ : Image(std::move(img)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Image1DBuffer& operator = (Image1DBuffer &&img) - { - Image::operator=(std::move(img)); - return *this; - } - }; /*! \class Image1DArray @@ -4677,33 +5072,73 @@ class Image1DArray : public Image size_type arraySize, size_type width, size_type rowPitch, - void* host_ptr = NULL, - cl_int* err = NULL) + void* host_ptr = nullptr, + cl_int* err = nullptr) { cl_int error; - cl_image_desc desc = {0}; + cl_image_desc desc = {}; desc.image_type = CL_MEM_OBJECT_IMAGE1D_ARRAY; desc.image_width = width; desc.image_array_size = arraySize; desc.image_row_pitch = rowPitch; - object_ = ::clCreateImage( - context(), - flags, - &format, - &desc, - host_ptr, + object_ = CL_(clCreateImage)( + context(), + flags, + &format, + &desc, + host_ptr, &error); detail::errHandler(error, __CREATE_IMAGE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } Image1DArray() { } +#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + /*! \brief Constructs a Image1DArray with specified properties. + * + * Wraps clCreateImageWithProperties(). + * + * \param properties Optional list of properties for the image object and + * their corresponding values. The non-empty list must + * end with 0. + * \param host_ptr Storage to be used if the CL_MEM_USE_HOST_PTR flag was + * specified. Note alignment & exclusivity requirements. + */ + Image1DArray(const Context &context, + const vector &properties, + cl_mem_flags flags, ImageFormat format, size_type arraySize, + size_type width, size_type rowPitch = 0, + void *host_ptr = nullptr, cl_int *err = nullptr) { + cl_int error; + + cl_image_desc desc = {}; + desc.image_type = CL_MEM_OBJECT_IMAGE1D_ARRAY; + desc.image_width = width; + desc.image_array_size = arraySize; + desc.image_row_pitch = rowPitch; + + if (properties.empty()) { + object_ = CL_(clCreateImageWithProperties)( + context(), nullptr, flags, &format, &desc, host_ptr, &error); + } else { + object_ = + CL_(clCreateImageWithProperties)(context(), properties.data(), flags, + &format, &desc, host_ptr, &error); + } + + detail::errHandler(error, __CREATE_IMAGE_ERR); + if (err != nullptr) { + *err = error; + } + } +#endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + /*! \brief Constructor from cl_mem - takes ownership. * * \param retainObject will cause the constructor to retain its cl object. @@ -4721,33 +5156,6 @@ class Image1DArray : public Image return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image1DArray(const Image1DArray& img) : Image(img) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image1DArray& operator = (const Image1DArray &img) - { - Image::operator=(img); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Image1DArray(Image1DArray&& img) CL_HPP_NOEXCEPT_ : Image(std::move(img)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Image1DArray& operator = (Image1DArray &&img) - { - Image::operator=(std::move(img)); - return *this; - } }; #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 120 @@ -4756,7 +5164,7 @@ class Image1DArray : public Image /*! \brief Class interface for 2D Image Memory objects. * * See Memory for details about copy semantics, etc. - * + * * \see Memory */ class Image2D : public Image @@ -4773,8 +5181,8 @@ class Image2D : public Image size_type width, size_type height, size_type row_pitch = 0, - void* host_ptr = NULL, - cl_int* err = NULL) + void* host_ptr = nullptr, + cl_int* err = nullptr) { cl_int error; bool useCreateImage; @@ -4794,13 +5202,13 @@ class Image2D : public Image #if CL_HPP_TARGET_OPENCL_VERSION >= 120 if (useCreateImage) { - cl_image_desc desc = {0}; + cl_image_desc desc = {}; desc.image_type = CL_MEM_OBJECT_IMAGE2D; desc.image_width = width; desc.image_height = height; desc.image_row_pitch = row_pitch; - object_ = ::clCreateImage( + object_ = CL_(clCreateImage)( context(), flags, &format, @@ -4809,7 +5217,7 @@ class Image2D : public Image &error); detail::errHandler(error, __CREATE_IMAGE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -4817,21 +5225,24 @@ class Image2D : public Image #if CL_HPP_MINIMUM_OPENCL_VERSION < 120 if (!useCreateImage) { - object_ = ::clCreateImage2D( + object_ = CL_(clCreateImage2D)( context(), flags,&format, width, height, row_pitch, host_ptr, &error); detail::errHandler(error, __CREATE_IMAGE2D_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120 } -#if CL_HPP_TARGET_OPENCL_VERSION >= 200 || defined(CL_HPP_USE_CL_IMAGE2D_FROM_BUFFER_KHR) +#if CL_HPP_TARGET_OPENCL_VERSION >= 120 /*! \brief Constructs a 2D Image from a buffer. * \note This will share storage with the underlying buffer. * + * Requires OpenCL 2.0 or newer or OpenCL 1.2 and the + * cl_khr_image2d_from_buffer extension. + * * Wraps clCreateImage(). */ Image2D( @@ -4845,14 +5256,14 @@ class Image2D : public Image { cl_int error; - cl_image_desc desc = {0}; + cl_image_desc desc = {}; desc.image_type = CL_MEM_OBJECT_IMAGE2D; desc.image_width = width; desc.image_height = height; desc.image_row_pitch = row_pitch; desc.buffer = sourceBuffer(); - object_ = ::clCreateImage( + object_ = CL_(clCreateImage)( context(), 0, // flags inherited from buffer &format, @@ -4865,17 +5276,17 @@ class Image2D : public Image *err = error; } } -#endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 200 || defined(CL_HPP_USE_CL_IMAGE2D_FROM_BUFFER_KHR) +#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 #if CL_HPP_TARGET_OPENCL_VERSION >= 200 /*! \brief Constructs a 2D Image from an image. * \note This will share storage with the underlying image but may * reinterpret the channel order and type. * - * The image will be created matching with a descriptor matching the source. + * The image will be created matching with a descriptor matching the source. * * \param order is the channel order to reinterpret the image data as. - * The channel order may differ as described in the OpenCL + * The channel order may differ as described in the OpenCL * 2.0 API specification. * * Wraps clCreateImage(). @@ -4889,9 +5300,9 @@ class Image2D : public Image cl_int error; // Descriptor fields have to match source image - size_type sourceWidth = + size_type sourceWidth = sourceImage.getImageInfo(); - size_type sourceHeight = + size_type sourceHeight = sourceImage.getImageInfo(); size_type sourceRowPitch = sourceImage.getImageInfo(); @@ -4902,11 +5313,11 @@ class Image2D : public Image cl_image_format sourceFormat = sourceImage.getImageInfo(); - // Update only the channel order. + // Update only the channel order. // Channel format inherited from source. sourceFormat.image_channel_order = order; - cl_image_desc desc = {0}; + cl_image_desc desc = {}; desc.image_type = CL_MEM_OBJECT_IMAGE2D; desc.image_width = sourceWidth; desc.image_height = sourceHeight; @@ -4915,7 +5326,7 @@ class Image2D : public Image desc.num_samples = sourceNumSamples; desc.buffer = sourceImage(); - object_ = ::clCreateImage( + object_ = CL_(clCreateImage)( context(), 0, // flags should be inherited from mem_object &sourceFormat, @@ -4930,7 +5341,84 @@ class Image2D : public Image } #endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 200 - //! \brief Default constructor - initializes to NULL. +#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + /*! \brief Constructs a Image2D with specified properties. + * + * Wraps clCreateImageWithProperties(). + * + * \param properties Optional list of properties for the image object and + * their corresponding values. The non-empty list must + * end with 0. + * \param host_ptr Storage to be used if the CL_MEM_USE_HOST_PTR flag was + * specified. Note alignment & exclusivity requirements. + */ + Image2D(const Context &context, const vector &properties, + cl_mem_flags flags, ImageFormat format, size_type width, + size_type height, size_type row_pitch = 0, void *host_ptr = nullptr, + cl_int *err = nullptr) { + cl_int error; + + cl_image_desc desc = {}; + desc.image_type = CL_MEM_OBJECT_IMAGE2D; + desc.image_width = width; + desc.image_height = height; + desc.image_row_pitch = row_pitch; + + if (properties.empty()) { + object_ = CL_(clCreateImageWithProperties)( + context(), nullptr, flags, &format, &desc, host_ptr, &error); + } else { + object_ = + CL_(clCreateImageWithProperties)(context(), properties.data(), flags, + &format, &desc, host_ptr, &error); + } + + detail::errHandler(error, __CREATE_IMAGE_ERR); + if (err != nullptr) { + *err = error; + } + } + + /*! \brief Constructs a Image2D with specified properties. + * + * Wraps clCreateImageWithProperties(). + * + * \param properties Optional list of properties for the image object and + * their corresponding values. The non-empty list must + * end with 0. + * \param buffer Refer to a valid buffer or image memory object. + */ + Image2D(const Context &context, const vector &properties, + cl_mem_flags flags, ImageFormat format, const Buffer &buffer, + size_type width, size_type height, size_type row_pitch = 0, + cl_int *err = nullptr) { + cl_int error; + + cl_image_desc desc = {}; + desc.image_type = CL_MEM_OBJECT_IMAGE2D; + desc.image_width = width; + desc.image_height = height; + desc.image_row_pitch = row_pitch; + desc.buffer = buffer(); + + if (properties.empty()) { + object_ = CL_(clCreateImageWithProperties)( + context(), nullptr, flags, &format, &desc, nullptr, &error); + } else { + object_ = + CL_(clCreateImageWithProperties)(context(), properties.data(), flags, + &format, &desc, nullptr, &error); + } + + detail::errHandler(error, __CREATE_IMAGE_ERR); + if (err != nullptr) { + *err = error; + } + } + +#endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + + //! \brief Default constructor - initializes to nullptr. Image2D() { } /*! \brief Constructor from cl_mem - takes ownership. @@ -4952,35 +5440,6 @@ class Image2D : public Image Image::operator=(rhs); return *this; } - - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image2D(const Image2D& img) : Image(img) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image2D& operator = (const Image2D &img) - { - Image::operator=(img); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Image2D(Image2D&& img) CL_HPP_NOEXCEPT_ : Image(std::move(img)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Image2D& operator = (Image2D &&img) - { - Image::operator=(std::move(img)); - return *this; - } - }; @@ -4988,13 +5447,13 @@ class Image2D : public Image /*! \brief Class interface for GL 2D Image Memory objects. * * This is provided to facilitate interoperability with OpenGL. - * + * * See Memory for details about copy semantics, etc. - * + * * \see Memory * \note Deprecated for OpenCL 1.2. Please use ImageGL instead. */ -class CL_API_PREFIX__VERSION_1_1_DEPRECATED Image2DGL : public Image2D +class CL_API_PREFIX__VERSION_1_1_DEPRECATED Image2DGL : public Image2D { public: /*! \brief Constructs an Image2DGL in a specified context, from a given @@ -5008,10 +5467,10 @@ class CL_API_PREFIX__VERSION_1_1_DEPRECATED Image2DGL : public Image2D cl_GLenum target, cl_GLint miplevel, cl_GLuint texobj, - cl_int * err = NULL) + cl_int * err = nullptr) { cl_int error; - object_ = ::clCreateFromGLTexture2D( + object_ = CL_(clCreateFromGLTexture2D)( context(), flags, target, @@ -5020,13 +5479,13 @@ class CL_API_PREFIX__VERSION_1_1_DEPRECATED Image2DGL : public Image2D &error); detail::errHandler(error, __CREATE_GL_TEXTURE_2D_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } - - //! \brief Default constructor - initializes to NULL. + + //! \brief Default constructor - initializes to nullptr. Image2DGL() : Image2D() { } /*! \brief Constructor from cl_mem - takes ownership. @@ -5036,7 +5495,7 @@ class CL_API_PREFIX__VERSION_1_1_DEPRECATED Image2DGL : public Image2D * earlier versions. * See Memory for further details. */ - explicit Image2DGL(const cl_mem& image, bool retainObject = false) : + explicit Image2DGL(const cl_mem& image, bool retainObject = false) : Image2D(image, retainObject) { } /*! \brief Assignment from cl_mem - performs shallow copy. @@ -5049,33 +5508,7 @@ class CL_API_PREFIX__VERSION_1_1_DEPRECATED Image2DGL : public Image2D return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image2DGL(const Image2DGL& img) : Image2D(img) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image2DGL& operator = (const Image2DGL &img) - { - Image2D::operator=(img); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Image2DGL(Image2DGL&& img) CL_HPP_NOEXCEPT_ : Image2D(std::move(img)) {} - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Image2DGL& operator = (Image2DGL &&img) - { - Image2D::operator=(std::move(img)); - return *this; - } } CL_API_SUFFIX__VERSION_1_1_DEPRECATED; #endif // CL_USE_DEPRECATED_OPENCL_1_1_APIS @@ -5096,12 +5529,12 @@ class Image2DArray : public Image size_type height, size_type rowPitch, size_type slicePitch, - void* host_ptr = NULL, - cl_int* err = NULL) + void* host_ptr = nullptr, + cl_int* err = nullptr) { cl_int error; - cl_image_desc desc = {0}; + cl_image_desc desc = {}; desc.image_type = CL_MEM_OBJECT_IMAGE2D_ARRAY; desc.image_width = width; desc.image_height = height; @@ -5109,22 +5542,65 @@ class Image2DArray : public Image desc.image_row_pitch = rowPitch; desc.image_slice_pitch = slicePitch; - object_ = ::clCreateImage( - context(), - flags, - &format, - &desc, - host_ptr, + object_ = CL_(clCreateImage)( + context(), + flags, + &format, + &desc, + host_ptr, &error); detail::errHandler(error, __CREATE_IMAGE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } - Image2DArray() { } +#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + /*! \brief Constructs a Image2DArray with specified properties. + * + * Wraps clCreateImageWithProperties(). + * + * \param properties Optional list of properties for the image object and + * their corresponding values. The non-empty list must + * end with 0. + * \param host_ptr Storage to be used if the CL_MEM_USE_HOST_PTR flag was + * specified. Note alignment & exclusivity requirements. + */ + Image2DArray(const Context &context, + const vector &properties, + cl_mem_flags flags, ImageFormat format, size_type arraySize, + size_type width, size_type height, size_type rowPitch = 0, + size_type slicePitch = 0, void *host_ptr = nullptr, + cl_int *err = nullptr) { + cl_int error; + + cl_image_desc desc = {}; + desc.image_type = CL_MEM_OBJECT_IMAGE2D_ARRAY; + desc.image_width = width; + desc.image_height = height; + desc.image_array_size = arraySize; + desc.image_row_pitch = rowPitch; + desc.image_slice_pitch = slicePitch; + + if (properties.empty()) { + object_ = CL_(clCreateImageWithProperties)( + context(), nullptr, flags, &format, &desc, host_ptr, &error); + } else { + object_ = + CL_(clCreateImageWithProperties)(context(), properties.data(), flags, + &format, &desc, host_ptr, &error); + } + + detail::errHandler(error, __CREATE_IMAGE_ERR); + if (err != nullptr) { + *err = error; + } + } +#endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + Image2DArray() { } + /*! \brief Constructor from cl_mem - takes ownership. * * \param retainObject will cause the constructor to retain its cl object. @@ -5140,40 +5616,13 @@ class Image2DArray : public Image return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image2DArray(const Image2DArray& img) : Image(img) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image2DArray& operator = (const Image2DArray &img) - { - Image::operator=(img); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Image2DArray(Image2DArray&& img) CL_HPP_NOEXCEPT_ : Image(std::move(img)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Image2DArray& operator = (Image2DArray &&img) - { - Image::operator=(std::move(img)); - return *this; - } }; #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 120 /*! \brief Class interface for 3D Image Memory objects. * * See Memory for details about copy semantics, etc. - * + * * \see Memory */ class Image3D : public Image @@ -5192,8 +5641,8 @@ class Image3D : public Image size_type depth, size_type row_pitch = 0, size_type slice_pitch = 0, - void* host_ptr = NULL, - cl_int* err = NULL) + void* host_ptr = nullptr, + cl_int* err = nullptr) { cl_int error; bool useCreateImage; @@ -5213,7 +5662,7 @@ class Image3D : public Image #if CL_HPP_TARGET_OPENCL_VERSION >= 120 if (useCreateImage) { - cl_image_desc desc = {0}; + cl_image_desc desc = {}; desc.image_type = CL_MEM_OBJECT_IMAGE3D; desc.image_width = width; desc.image_height = height; @@ -5221,16 +5670,16 @@ class Image3D : public Image desc.image_row_pitch = row_pitch; desc.image_slice_pitch = slice_pitch; - object_ = ::clCreateImage( - context(), - flags, - &format, - &desc, - host_ptr, + object_ = CL_(clCreateImage)( + context(), + flags, + &format, + &desc, + host_ptr, &error); detail::errHandler(error, __CREATE_IMAGE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -5238,19 +5687,61 @@ class Image3D : public Image #if CL_HPP_MINIMUM_OPENCL_VERSION < 120 if (!useCreateImage) { - object_ = ::clCreateImage3D( + object_ = CL_(clCreateImage3D)( context(), flags, &format, width, height, depth, row_pitch, slice_pitch, host_ptr, &error); detail::errHandler(error, __CREATE_IMAGE3D_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120 } - //! \brief Default constructor - initializes to NULL. +#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + /*! \brief Constructs a Image3D with specified properties. + * + * Wraps clCreateImageWithProperties(). + * + * \param properties Optional list of properties for the image object and + * their corresponding values. The non-empty list must + * end with 0. + * \param host_ptr Storage to be used if the CL_MEM_USE_HOST_PTR flag was + * specified. Note alignment & exclusivity requirements. + */ + Image3D(const Context &context, const vector &properties, + cl_mem_flags flags, ImageFormat format, size_type width, + size_type height, size_type depth, size_type row_pitch = 0, + size_type slice_pitch = 0, void *host_ptr = nullptr, + cl_int *err = nullptr) { + cl_int error; + + cl_image_desc desc = {}; + desc.image_type = CL_MEM_OBJECT_IMAGE3D; + desc.image_width = width; + desc.image_height = height; + desc.image_depth = depth; + desc.image_row_pitch = row_pitch; + desc.image_slice_pitch = slice_pitch; + + if (properties.empty()) { + object_ = CL_(clCreateImageWithProperties)( + context(), nullptr, flags, &format, &desc, host_ptr, &error); + } else { + object_ = + CL_(clCreateImageWithProperties)(context(), properties.data(), flags, + &format, &desc, host_ptr, &error); + } + + detail::errHandler(error, __CREATE_IMAGE_ERR); + if (err != nullptr) { + *err = error; + } + } +#endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 300 + + //! \brief Default constructor - initializes to nullptr. Image3D() : Image() { } /*! \brief Constructor from cl_mem - takes ownership. @@ -5260,7 +5751,7 @@ class Image3D : public Image * earlier versions. * See Memory for further details. */ - explicit Image3D(const cl_mem& image3D, bool retainObject = false) : + explicit Image3D(const cl_mem& image3D, bool retainObject = false) : Image(image3D, retainObject) { } /*! \brief Assignment from cl_mem - performs shallow copy. @@ -5273,42 +5764,15 @@ class Image3D : public Image return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image3D(const Image3D& img) : Image(img) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image3D& operator = (const Image3D &img) - { - Image::operator=(img); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Image3D(Image3D&& img) CL_HPP_NOEXCEPT_ : Image(std::move(img)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Image3D& operator = (Image3D &&img) - { - Image::operator=(std::move(img)); - return *this; - } }; #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) /*! \brief Class interface for GL 3D Image Memory objects. * * This is provided to facilitate interoperability with OpenGL. - * + * * See Memory for details about copy semantics, etc. - * + * * \see Memory */ class Image3DGL : public Image3D @@ -5325,10 +5789,10 @@ class Image3DGL : public Image3D cl_GLenum target, cl_GLint miplevel, cl_GLuint texobj, - cl_int * err = NULL) + cl_int * err = nullptr) { cl_int error; - object_ = ::clCreateFromGLTexture3D( + object_ = CL_(clCreateFromGLTexture3D)( context(), flags, target, @@ -5337,12 +5801,12 @@ class Image3DGL : public Image3D &error); detail::errHandler(error, __CREATE_GL_TEXTURE_3D_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. Image3DGL() : Image3D() { } /*! \brief Constructor from cl_mem - takes ownership. @@ -5352,7 +5816,7 @@ class Image3DGL : public Image3D * earlier versions. * See Memory for further details. */ - explicit Image3DGL(const cl_mem& image, bool retainObject = false) : + explicit Image3DGL(const cl_mem& image, bool retainObject = false) : Image3D(image, retainObject) { } /*! \brief Assignment from cl_mem - performs shallow copy. @@ -5365,33 +5829,6 @@ class Image3DGL : public Image3D return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image3DGL(const Image3DGL& img) : Image3D(img) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Image3DGL& operator = (const Image3DGL &img) - { - Image3D::operator=(img); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Image3DGL(Image3DGL&& img) CL_HPP_NOEXCEPT_ : Image3D(std::move(img)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Image3DGL& operator = (Image3DGL &&img) - { - Image3D::operator=(std::move(img)); - return *this; - } }; #endif // CL_USE_DEPRECATED_OPENCL_1_1_APIS @@ -5411,25 +5848,25 @@ class ImageGL : public Image cl_GLenum target, cl_GLint miplevel, cl_GLuint texobj, - cl_int * err = NULL) + cl_int * err = nullptr) { cl_int error; - object_ = ::clCreateFromGLTexture( - context(), - flags, + object_ = CL_(clCreateFromGLTexture)( + context(), + flags, target, miplevel, texobj, &error); detail::errHandler(error, __CREATE_GL_TEXTURE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } ImageGL() : Image() { } - + /*! \brief Constructor from cl_mem - takes ownership. * * \param retainObject will cause the constructor to retain its cl object. @@ -5437,7 +5874,7 @@ class ImageGL : public Image * earlier versions. * See Memory for further details. */ - explicit ImageGL(const cl_mem& image, bool retainObject = false) : + explicit ImageGL(const cl_mem& image, bool retainObject = false) : Image(image, retainObject) { } ImageGL& operator = (const cl_mem& rhs) @@ -5446,33 +5883,6 @@ class ImageGL : public Image return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - ImageGL(const ImageGL& img) : Image(img) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - ImageGL& operator = (const ImageGL &img) - { - Image::operator=(img); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - ImageGL(ImageGL&& img) CL_HPP_NOEXCEPT_ : Image(std::move(img)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - ImageGL& operator = (ImageGL &&img) - { - Image::operator=(std::move(img)); - return *this; - } }; #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 @@ -5502,15 +5912,15 @@ class Pipe : public Memory const Context& context, cl_uint packet_size, cl_uint max_packets, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_HOST_NO_ACCESS; - object_ = ::clCreatePipe(context(), flags, packet_size, max_packets, nullptr, &error); + object_ = CL_(clCreatePipe)(context(), flags, packet_size, max_packets, nullptr, &error); detail::errHandler(error, __CREATE_PIPE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -5526,22 +5936,22 @@ class Pipe : public Memory Pipe( cl_uint packet_size, cl_uint max_packets, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; Context context = Context::getDefault(err); cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_HOST_NO_ACCESS; - object_ = ::clCreatePipe(context(), flags, packet_size, max_packets, nullptr, &error); + object_ = CL_(clCreatePipe)(context(), flags, packet_size, max_packets, nullptr, &error); detail::errHandler(error, __CREATE_PIPE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. Pipe() : Memory() { } /*! \brief Constructor from cl_mem - takes ownership. @@ -5564,52 +5974,26 @@ class Pipe : public Memory return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Pipe(const Pipe& pipe) : Memory(pipe) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Pipe& operator = (const Pipe &pipe) - { - Memory::operator=(pipe); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Pipe(Pipe&& pipe) CL_HPP_NOEXCEPT_ : Memory(std::move(pipe)) {} - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Pipe& operator = (Pipe &&pipe) - { - Memory::operator=(std::move(pipe)); - return *this; - } //! \brief Wrapper for clGetMemObjectInfo(). template cl_int getInfo(cl_pipe_info name, T* param) const { return detail::errHandler( - detail::getInfo(&::clGetPipeInfo, object_, name, param), + detail::getInfo(CL_(clGetPipeInfo), object_, name, param), __GET_PIPE_INFO_ERR); } //! \brief Wrapper for clGetMemObjectInfo() that returns by value. template typename detail::param_traits::param_type - getInfo(cl_int* err = NULL) const + getInfo(cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_pipe_info, name>::param_type param; cl_int result = getInfo(name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; @@ -5624,12 +6008,12 @@ class Pipe : public Memory * to the same underlying cl_sampler as the original. For details, see * clRetainSampler() and clReleaseSampler(). * - * \see cl_sampler + * \see cl_sampler */ class Sampler : public detail::Wrapper { public: - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. Sampler() { } /*! \brief Constructs a Sampler in a specified context. @@ -5641,7 +6025,7 @@ class Sampler : public detail::Wrapper cl_bool normalized_coords, cl_addressing_mode addressing_mode, cl_filter_mode filter_mode, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; @@ -5651,17 +6035,17 @@ class Sampler : public detail::Wrapper CL_SAMPLER_ADDRESSING_MODE, addressing_mode, CL_SAMPLER_FILTER_MODE, filter_mode, 0 }; - object_ = ::clCreateSamplerWithProperties( + object_ = CL_(clCreateSamplerWithProperties)( context(), sampler_properties, &error); detail::errHandler(error, __CREATE_SAMPLER_WITH_PROPERTIES_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } #else - object_ = ::clCreateSampler( + object_ = CL_(clCreateSampler)( context(), normalized_coords, addressing_mode, @@ -5669,21 +6053,21 @@ class Sampler : public detail::Wrapper &error); detail::errHandler(error, __CREATE_SAMPLER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } -#endif +#endif } /*! \brief Constructor from cl_sampler - takes ownership. - * + * * \param retainObject will cause the constructor to retain its cl object. * Defaults to false to maintain compatibility with * earlier versions. * This effectively transfers ownership of a refcount on the cl_sampler * into the new Sampler object. */ - explicit Sampler(const cl_sampler& sampler, bool retainObject = false) : + explicit Sampler(const cl_sampler& sampler, bool retainObject = false) : detail::Wrapper(sampler, retainObject) { } /*! \brief Assignment operator from cl_sampler - takes ownership. @@ -5697,52 +6081,26 @@ class Sampler : public detail::Wrapper return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Sampler(const Sampler& sam) : detail::Wrapper(sam) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Sampler& operator = (const Sampler &sam) - { - detail::Wrapper::operator=(sam); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Sampler(Sampler&& sam) CL_HPP_NOEXCEPT_ : detail::Wrapper(std::move(sam)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Sampler& operator = (Sampler &&sam) - { - detail::Wrapper::operator=(std::move(sam)); - return *this; - } + //! \brief Wrapper for clGetSamplerInfo(). template cl_int getInfo(cl_sampler_info name, T* param) const { return detail::errHandler( - detail::getInfo(&::clGetSamplerInfo, object_, name, param), + detail::getInfo(CL_(clGetSamplerInfo), object_, name, param), __GET_SAMPLER_INFO_ERR); } //! \brief Wrapper for clGetSamplerInfo() that returns by value. template typename detail::param_traits::param_type - getInfo(cl_int* err = NULL) const + getInfo(cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_sampler_info, name>::param_type param; cl_int result = getInfo(name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; @@ -5798,18 +6156,27 @@ class NDRange sizes_[2] = size2; } + //! \brief Constructs one-dimensional range. + NDRange(array a) : NDRange(a[0]){} + + //! \brief Constructs two-dimensional range. + NDRange(array a) : NDRange(a[0], a[1]){} + + //! \brief Constructs three-dimensional range. + NDRange(array a) : NDRange(a[0], a[1], a[2]){} + /*! \brief Conversion operator to const size_type *. - * + * * \returns a pointer to the size of the first dimension. */ - operator const size_type*() const { - return sizes_; + operator const size_type*() const { + return sizes_; } //! \brief Queries the number of dimensions in the range. - size_type dimensions() const - { - return dimensions_; + size_type dimensions() const + { + return dimensions_; } //! \brief Returns the size of the object in bytes based on the @@ -5823,7 +6190,7 @@ class NDRange { return sizes_; } - + const size_type* get() const { return sizes_; @@ -5838,7 +6205,7 @@ struct LocalSpaceArg { size_type size_; }; -//! \cond DOXYGEN_DETAIL + namespace detail { template @@ -5868,10 +6235,10 @@ template <> struct KernelArgumentHandler { static size_type size(const LocalSpaceArg& value) { return value.size_; } - static const void* ptr(const LocalSpaceArg&) { return NULL; } + static const void* ptr(const LocalSpaceArg&) { return nullptr; } }; -} +} //! \endcond /*! Local @@ -5895,20 +6262,21 @@ Local(size_type size) class Kernel : public detail::Wrapper { public: - inline Kernel(const Program& program, const char* name, cl_int* err = NULL); + inline Kernel(const Program& program, const string& name, cl_int* err = nullptr); + inline Kernel(const Program& program, const char* name, cl_int* err = nullptr); - //! \brief Default constructor - initializes to NULL. + //! \brief Default constructor - initializes to nullptr. Kernel() { } /*! \brief Constructor from cl_kernel - takes ownership. - * + * * \param retainObject will cause the constructor to retain its cl object. * Defaults to false to maintain compatibility with * earlier versions. * This effectively transfers ownership of a refcount on the cl_kernel * into the new Kernel object. */ - explicit Kernel(const cl_kernel& kernel, bool retainObject = false) : + explicit Kernel(const cl_kernel& kernel, bool retainObject = false) : detail::Wrapper(kernel, retainObject) { } /*! \brief Assignment operator from cl_kernel - takes ownership. @@ -5922,50 +6290,25 @@ class Kernel : public detail::Wrapper return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Kernel(const Kernel& kernel) : detail::Wrapper(kernel) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Kernel& operator = (const Kernel &kernel) - { - detail::Wrapper::operator=(kernel); - return *this; - } - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Kernel(Kernel&& kernel) CL_HPP_NOEXCEPT_ : detail::Wrapper(std::move(kernel)) {} - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Kernel& operator = (Kernel &&kernel) - { - detail::Wrapper::operator=(std::move(kernel)); - return *this; - } template cl_int getInfo(cl_kernel_info name, T* param) const { return detail::errHandler( - detail::getInfo(&::clGetKernelInfo, object_, name, param), + detail::getInfo(CL_(clGetKernelInfo), object_, name, param), __GET_KERNEL_INFO_ERR); } template typename detail::param_traits::param_type - getInfo(cl_int* err = NULL) const + getInfo(cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_kernel_info, name>::param_type param; cl_int result = getInfo(name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; @@ -5976,18 +6319,18 @@ class Kernel : public detail::Wrapper cl_int getArgInfo(cl_uint argIndex, cl_kernel_arg_info name, T* param) const { return detail::errHandler( - detail::getInfo(&::clGetKernelArgInfo, object_, argIndex, name, param), + detail::getInfo(CL_(clGetKernelArgInfo), object_, argIndex, name, param), __GET_KERNEL_ARG_INFO_ERR); } template typename detail::param_traits::param_type - getArgInfo(cl_uint argIndex, cl_int* err = NULL) const + getArgInfo(cl_uint argIndex, cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_kernel_arg_info, name>::param_type param; cl_int result = getArgInfo(argIndex, name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; @@ -6000,36 +6343,36 @@ class Kernel : public detail::Wrapper { return detail::errHandler( detail::getInfo( - &::clGetKernelWorkGroupInfo, object_, device(), name, param), + CL_(clGetKernelWorkGroupInfo), object_, device(), name, param), __GET_KERNEL_WORK_GROUP_INFO_ERR); } template typename detail::param_traits::param_type - getWorkGroupInfo(const Device& device, cl_int* err = NULL) const + getWorkGroupInfo(const Device& device, cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_kernel_work_group_info, name>::param_type param; cl_int result = getWorkGroupInfo(device, name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; } - -#if (CL_HPP_TARGET_OPENCL_VERSION >= 200 && defined(CL_HPP_USE_CL_SUB_GROUPS_KHR)) || CL_HPP_TARGET_OPENCL_VERSION >= 210 + +#if defined(CL_HPP_USE_CL_SUB_GROUPS_KHR) || CL_HPP_TARGET_OPENCL_VERSION >= 210 cl_int getSubGroupInfo(const cl::Device &dev, cl_kernel_sub_group_info name, const cl::NDRange &range, size_type* param) const { #if CL_HPP_TARGET_OPENCL_VERSION >= 210 return detail::errHandler( - clGetKernelSubGroupInfo(object_, dev(), name, range.size(), range.get(), sizeof(size_type), param, nullptr), + CL_(clGetKernelSubGroupInfo)(object_, dev(), name, range.size(), range.get(), sizeof(size_type), param, nullptr), __GET_KERNEL_SUB_GROUP_INFO_ERR); #else // #if CL_HPP_TARGET_OPENCL_VERSION >= 210 typedef clGetKernelSubGroupInfoKHR_fn PFN_clGetKernelSubGroupInfoKHR; - static PFN_clGetKernelSubGroupInfoKHR pfn_clGetKernelSubGroupInfoKHR = NULL; + static PFN_clGetKernelSubGroupInfoKHR pfn_clGetKernelSubGroupInfoKHR = nullptr; CL_HPP_INIT_CL_EXT_FCN_PTR_(clGetKernelSubGroupInfoKHR); return detail::errHandler( @@ -6040,16 +6383,16 @@ class Kernel : public detail::Wrapper } template - size_type getSubGroupInfo(const cl::Device &dev, const cl::NDRange &range, cl_int* err = NULL) const + size_type getSubGroupInfo(const cl::Device &dev, const cl::NDRange &range, cl_int* err = nullptr) const { size_type param; cl_int result = getSubGroupInfo(dev, name, range, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; } -#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200 +#endif // defined(CL_HPP_USE_CL_SUB_GROUPS_KHR) || CL_HPP_TARGET_OPENCL_VERSION >= 210 #if CL_HPP_TARGET_OPENCL_VERSION >= 200 /*! \brief setArg overload taking a shared_ptr type @@ -6058,7 +6401,7 @@ class Kernel : public detail::Wrapper cl_int setArg(cl_uint index, const cl::pointer &argPtr) { return detail::errHandler( - ::clSetKernelArgSVMPointer(object_, index, argPtr.get()), + CL_(clSetKernelArgSVMPointer)(object_, index, argPtr.get()), __SET_KERNEL_ARGS_ERR); } @@ -6068,7 +6411,7 @@ class Kernel : public detail::Wrapper cl_int setArg(cl_uint index, const cl::vector &argPtr) { return detail::errHandler( - ::clSetKernelArgSVMPointer(object_, index, argPtr.data()), + CL_(clSetKernelArgSVMPointer)(object_, index, argPtr.data()), __SET_KERNEL_ARGS_ERR); } @@ -6079,7 +6422,7 @@ class Kernel : public detail::Wrapper setArg(cl_uint index, const T argPtr) { return detail::errHandler( - ::clSetKernelArgSVMPointer(object_, index, argPtr), + CL_(clSetKernelArgSVMPointer)(object_, index, argPtr), __SET_KERNEL_ARGS_ERR); } #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200 @@ -6091,7 +6434,7 @@ class Kernel : public detail::Wrapper setArg(cl_uint index, const T &value) { return detail::errHandler( - ::clSetKernelArg( + CL_(clSetKernelArg)( object_, index, detail::KernelArgumentHandler::size(value), @@ -6102,19 +6445,19 @@ class Kernel : public detail::Wrapper cl_int setArg(cl_uint index, size_type size, const void* argPtr) { return detail::errHandler( - ::clSetKernelArg(object_, index, size, argPtr), + CL_(clSetKernelArg)(object_, index, size, argPtr), __SET_KERNEL_ARGS_ERR); } #if CL_HPP_TARGET_OPENCL_VERSION >= 200 /*! - * Specify a vector of SVM pointers that the kernel may access in + * Specify a vector of SVM pointers that the kernel may access in * addition to its arguments. */ cl_int setSVMPointers(const vector &pointerList) { return detail::errHandler( - ::clSetKernelExecInfo( + CL_(clSetKernelExecInfo)( object_, CL_KERNEL_EXEC_INFO_SVM_PTRS, sizeof(void*)*pointerList.size(), @@ -6129,7 +6472,7 @@ class Kernel : public detail::Wrapper cl_int setSVMPointers(const std::array &pointerList) { return detail::errHandler( - ::clSetKernelExecInfo( + CL_(clSetKernelExecInfo)( object_, CL_KERNEL_EXEC_INFO_SVM_PTRS, sizeof(void*)*pointerList.size(), @@ -6140,7 +6483,7 @@ class Kernel : public detail::Wrapper * * \note It is only possible to enable fine-grained system SVM if all devices * in the context associated with kernel support it. - * + * * \param svmEnabled True if fine-grained system SVM is requested. False otherwise. * \return CL_SUCCESS if the function was executed succesfully. CL_INVALID_OPERATION * if no devices in the context support fine-grained system SVM. @@ -6151,7 +6494,7 @@ class Kernel : public detail::Wrapper { cl_bool svmEnabled_ = svmEnabled ? CL_TRUE : CL_FALSE; return detail::errHandler( - ::clSetKernelExecInfo( + CL_(clSetKernelExecInfo)( object_, CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM, sizeof(cl_bool), @@ -6159,7 +6502,7 @@ class Kernel : public detail::Wrapper ) ); } - + template void setSVMPointersHelper(std::array &pointerList, const pointer &t0, const pointer &t1, Ts & ... ts) { @@ -6196,7 +6539,7 @@ class Kernel : public detail::Wrapper setSVMPointersHelper<0, 1 + sizeof...(Ts)>(pointerList, t0, ts...); return detail::errHandler( - ::clSetKernelExecInfo( + CL_(clSetKernelExecInfo)( object_, CL_KERNEL_EXEC_INFO_SVM_PTRS, sizeof(void*)*(1 + sizeof...(Ts)), @@ -6207,7 +6550,7 @@ class Kernel : public detail::Wrapper cl_int setExecInfo(cl_kernel_exec_info param_name, const T& val) { return detail::errHandler( - ::clSetKernelExecInfo( + CL_(clSetKernelExecInfo)( object_, param_name, sizeof(T), @@ -6230,7 +6573,7 @@ class Kernel : public detail::Wrapper Kernel clone() { cl_int error; - Kernel retValue(clCloneKernel(this->get(), &error)); + Kernel retValue(CL_(clCloneKernel)(this->get(), &error)); detail::errHandler(error, __CLONE_KERNEL_ERR); return retValue; @@ -6251,11 +6594,11 @@ class Program : public detail::Wrapper typedef vector > Binaries; typedef vector > Sources; #endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY) - + Program( const string& source, bool build = false, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; @@ -6264,29 +6607,29 @@ class Program : public detail::Wrapper Context context = Context::getDefault(err); - object_ = ::clCreateProgramWithSource( + object_ = CL_(clCreateProgramWithSource)( context(), (cl_uint)1, &strings, &length, &error); detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR); if (error == CL_SUCCESS && build) { - error = ::clBuildProgram( + error = CL_(clBuildProgram)( object_, 0, - NULL, + nullptr, #if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD) "-cl-std=CL2.0", #else "", #endif // #if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD) - NULL, - NULL); + nullptr, + nullptr); detail::buildErrHandler(error, __BUILD_PROGRAM_ERR, getBuildInfo()); } - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -6295,35 +6638,35 @@ class Program : public detail::Wrapper const Context& context, const string& source, bool build = false, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; const char * strings = source.c_str(); const size_type length = source.size(); - object_ = ::clCreateProgramWithSource( + object_ = CL_(clCreateProgramWithSource)( context(), (cl_uint)1, &strings, &length, &error); detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR); if (error == CL_SUCCESS && build) { - error = ::clBuildProgram( + error = CL_(clBuildProgram)( object_, 0, - NULL, + nullptr, #if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD) "-cl-std=CL2.0", #else "", #endif // #if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD) - NULL, - NULL); - + nullptr, + nullptr); + detail::buildErrHandler(error, __BUILD_PROGRAM_ERR, getBuildInfo()); } - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -6334,7 +6677,7 @@ class Program : public detail::Wrapper */ Program( const Sources& sources, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; Context context = Context::getDefault(err); @@ -6354,11 +6697,11 @@ class Program : public detail::Wrapper #endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY) } - object_ = ::clCreateProgramWithSource( + object_ = CL_(clCreateProgramWithSource)( context(), (cl_uint)n, strings.data(), lengths.data(), &error); detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -6370,7 +6713,7 @@ class Program : public detail::Wrapper Program( const Context& context, const Sources& sources, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; @@ -6389,25 +6732,25 @@ class Program : public detail::Wrapper #endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY) } - object_ = ::clCreateProgramWithSource( + object_ = CL_(clCreateProgramWithSource)( context(), (cl_uint)n, strings.data(), lengths.data(), &error); detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } - -#if CL_HPP_TARGET_OPENCL_VERSION >= 210 || (CL_HPP_TARGET_OPENCL_VERSION==200 && defined(CL_HPP_USE_IL_KHR)) +#if defined(CL_HPP_USE_IL_KHR) || CL_HPP_TARGET_OPENCL_VERSION >= 210 /** * Program constructor to allow construction of program from SPIR-V or another IL. - * Valid for either OpenCL >= 2.1 or when CL_HPP_USE_IL_KHR is defined. + * + * Requires OpenCL 2.1 or newer or the cl_khr_il_program extension. */ Program( const vector& IL, bool build = false, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; @@ -6415,17 +6758,16 @@ class Program : public detail::Wrapper #if CL_HPP_TARGET_OPENCL_VERSION >= 210 - object_ = ::clCreateProgramWithIL( + object_ = CL_(clCreateProgramWithIL)( context(), static_cast(IL.data()), IL.size(), &error); #else // #if CL_HPP_TARGET_OPENCL_VERSION >= 210 typedef clCreateProgramWithILKHR_fn PFN_clCreateProgramWithILKHR; - static PFN_clCreateProgramWithILKHR pfn_clCreateProgramWithILKHR = NULL; + static PFN_clCreateProgramWithILKHR pfn_clCreateProgramWithILKHR = nullptr; CL_HPP_INIT_CL_EXT_FCN_PTR_(clCreateProgramWithILKHR); - return detail::errHandler( - pfn_clCreateProgramWithILKHR( + object_ = pfn_clCreateProgramWithILKHR( context(), static_cast(IL.data()), IL.size(), &error); #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 210 @@ -6434,22 +6776,22 @@ class Program : public detail::Wrapper if (error == CL_SUCCESS && build) { - error = ::clBuildProgram( + error = CL_(clBuildProgram)( object_, 0, - NULL, + nullptr, #if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD) "-cl-std=CL2.0", #else "", #endif // #if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD) - NULL, - NULL); + nullptr, + nullptr); detail::buildErrHandler(error, __BUILD_PROGRAM_ERR, getBuildInfo()); } - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -6457,29 +6799,29 @@ class Program : public detail::Wrapper /** * Program constructor to allow construction of program from SPIR-V or another IL * for a specific context. - * Valid for either OpenCL >= 2.1 or when CL_HPP_USE_IL_KHR is defined. + * + * Requires OpenCL 2.1 or newer or the cl_khr_il_program extension. */ Program( const Context& context, const vector& IL, bool build = false, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; #if CL_HPP_TARGET_OPENCL_VERSION >= 210 - object_ = ::clCreateProgramWithIL( + object_ = CL_(clCreateProgramWithIL)( context(), static_cast(IL.data()), IL.size(), &error); #else // #if CL_HPP_TARGET_OPENCL_VERSION >= 210 typedef clCreateProgramWithILKHR_fn PFN_clCreateProgramWithILKHR; - static PFN_clCreateProgramWithILKHR pfn_clCreateProgramWithILKHR = NULL; + static PFN_clCreateProgramWithILKHR pfn_clCreateProgramWithILKHR = nullptr; CL_HPP_INIT_CL_EXT_FCN_PTR_(clCreateProgramWithILKHR); - return detail::errHandler( - pfn_clCreateProgramWithILKHR( + object_ = pfn_clCreateProgramWithILKHR( context(), static_cast(IL.data()), IL.size(), &error); #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 210 @@ -6487,26 +6829,26 @@ class Program : public detail::Wrapper detail::errHandler(error, __CREATE_PROGRAM_WITH_IL_ERR); if (error == CL_SUCCESS && build) { - error = ::clBuildProgram( + error = CL_(clBuildProgram)( object_, 0, - NULL, + nullptr, #if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD) "-cl-std=CL2.0", #else "", #endif // #if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD) - NULL, - NULL); + nullptr, + nullptr); detail::buildErrHandler(error, __BUILD_PROGRAM_ERR, getBuildInfo()); } - if (err != NULL) { + if (err != nullptr) { *err = error; } } -#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 210 +#endif // defined(CL_HPP_USE_IL_KHR) || CL_HPP_TARGET_OPENCL_VERSION >= 210 /** * Construct a program object from a list of devices and a per-device list of binaries. @@ -6517,12 +6859,12 @@ class Program : public detail::Wrapper * match the size of binaries and filled with values to specify if each binary * was successfully loaded. * Set to CL_SUCCESS if the binary was successfully loaded. - * Set to CL_INVALID_VALUE if the length is 0 or the binary pointer is NULL. + * Set to CL_INVALID_VALUE if the length is 0 or the binary pointer is nullptr. * Set to CL_INVALID_BINARY if the binary provided is not valid for the matching device. - * \param err if non-NULL will be set to CL_SUCCESS on successful operation or one of the following errors: + * \param err if non-nullptr will be set to CL_SUCCESS on successful operation or one of the following errors: * CL_INVALID_CONTEXT if context is not a valid context. - * CL_INVALID_VALUE if the length of devices is zero; or if the length of binaries does not match the length of devices; - * or if any entry in binaries is NULL or has length 0. + * CL_INVALID_VALUE if the length of devices is zero; or if the length of binaries does not match the length of devices; + * or if any entry in binaries is nullptr or has length 0. * CL_INVALID_DEVICE if OpenCL devices listed in devices are not in the list of devices associated with context. * CL_INVALID_BINARY if an invalid program binary was encountered for any device. binaryStatus will return specific status for each device. * CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host. @@ -6531,24 +6873,23 @@ class Program : public detail::Wrapper const Context& context, const vector& devices, const Binaries& binaries, - vector* binaryStatus = NULL, - cl_int* err = NULL) + vector* binaryStatus = nullptr, + cl_int* err = nullptr) { cl_int error; - + const size_type numDevices = devices.size(); - + // Catch size mismatch early and return if(binaries.size() != numDevices) { error = CL_INVALID_VALUE; detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } return; } - vector lengths(numDevices); vector images(numDevices); #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY) @@ -6572,20 +6913,20 @@ class Program : public detail::Wrapper binaryStatus->resize(numDevices); } - object_ = ::clCreateProgramWithBinary( + object_ = CL_(clCreateProgramWithBinary)( context(), (cl_uint) devices.size(), deviceIDs.data(), - lengths.data(), images.data(), (binaryStatus != NULL && numDevices > 0) + lengths.data(), images.data(), (binaryStatus != nullptr && numDevices > 0) ? &binaryStatus->front() - : NULL, &error); + : nullptr, &error); detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } - + #if CL_HPP_TARGET_OPENCL_VERSION >= 120 /** * Create program using builtin kernels. @@ -6595,7 +6936,7 @@ class Program : public detail::Wrapper const Context& context, const vector& devices, const string& kernelNames, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; @@ -6605,23 +6946,23 @@ class Program : public detail::Wrapper for( size_type deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) { deviceIDs[deviceIndex] = (devices[deviceIndex])(); } - - object_ = ::clCreateProgramWithBuiltInKernels( - context(), + + object_ = CL_(clCreateProgramWithBuiltInKernels)( + context(), (cl_uint) devices.size(), deviceIDs.data(), - kernelNames.c_str(), + kernelNames.c_str(), &error); detail::errHandler(error, __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 Program() { } - + /*! \brief Constructor from cl_program - takes ownership. * @@ -6629,7 +6970,7 @@ class Program : public detail::Wrapper * Defaults to false to maintain compatibility with * earlier versions. */ - explicit Program(const cl_program& program, bool retainObject = false) : + explicit Program(const cl_program& program, bool retainObject = false) : detail::Wrapper(program, retainObject) { } Program& operator = (const cl_program& rhs) @@ -6638,39 +6979,20 @@ class Program : public detail::Wrapper return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - Program(const Program& program) : detail::Wrapper(program) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - Program& operator = (const Program &program) - { - detail::Wrapper::operator=(program); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - Program(Program&& program) CL_HPP_NOEXCEPT_ : detail::Wrapper(std::move(program)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - Program& operator = (Program &&program) + cl_int build( + const vector& devices, + const string& options, + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr) const { - detail::Wrapper::operator=(std::move(program)); - return *this; + return build(devices, options.c_str(), notifyFptr, data); } cl_int build( const vector& devices, - const char* options = NULL, - void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL, - void* data = NULL) const + const char* options = nullptr, + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr) const { size_type numDevices = devices.size(); vector deviceIDs(numDevices); @@ -6679,7 +7001,7 @@ class Program : public detail::Wrapper deviceIDs[deviceIndex] = (devices[deviceIndex])(); } - cl_int buildError = ::clBuildProgram( + cl_int buildError = CL_(clBuildProgram)( object_, (cl_uint) devices.size(), @@ -6693,13 +7015,22 @@ class Program : public detail::Wrapper cl_int build( const Device& device, - const char* options = NULL, - void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL, - void* data = NULL) const + const string& options, + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr) const + { + return build(device, options.c_str(), notifyFptr, data); + } + + cl_int build( + const Device& device, + const char* options = nullptr, + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr) const { cl_device_id deviceID = device(); - cl_int buildError = ::clBuildProgram( + cl_int buildError = CL_(clBuildProgram)( object_, 1, &deviceID, @@ -6707,20 +7038,28 @@ class Program : public detail::Wrapper notifyFptr, data); - BuildLogType buildLog(1); + BuildLogType buildLog(0); buildLog.push_back(std::make_pair(device, getBuildInfo(device))); return detail::buildErrHandler(buildError, __BUILD_PROGRAM_ERR, buildLog); } cl_int build( - const char* options = NULL, - void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL, - void* data = NULL) const + const string& options, + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr) const + { + return build(options.c_str(), notifyFptr, data); + } + + cl_int build( + const char* options = nullptr, + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr) const { - cl_int buildError = ::clBuildProgram( + cl_int buildError = CL_(clBuildProgram)( object_, 0, - NULL, + nullptr, options, notifyFptr, data); @@ -6730,18 +7069,104 @@ class Program : public detail::Wrapper #if CL_HPP_TARGET_OPENCL_VERSION >= 120 cl_int compile( - const char* options = NULL, - void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL, - void* data = NULL) const + const string& options, + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr) const + { + return compile(options.c_str(), notifyFptr, data); + } + + cl_int compile( + const char* options = nullptr, + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr) const { - cl_int error = ::clCompileProgram( + cl_int error = CL_(clCompileProgram)( object_, 0, - NULL, + nullptr, options, 0, - NULL, - NULL, + nullptr, + nullptr, + notifyFptr, + data); + return detail::buildErrHandler(error, __COMPILE_PROGRAM_ERR, getBuildInfo()); + } + + cl_int compile( + const string& options, + const vector& inputHeaders, + const vector& headerIncludeNames, + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr) const + { + return compile(options.c_str(), inputHeaders, headerIncludeNames, notifyFptr, data); + } + + cl_int compile( + const char* options, + const vector& inputHeaders, + const vector& headerIncludeNames, + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr) const + { + static_assert(sizeof(cl::Program) == sizeof(cl_program), + "Size of cl::Program must be equal to size of cl_program"); + vector headerIncludeNamesCStr; + for(const string& name: headerIncludeNames) { + headerIncludeNamesCStr.push_back(name.c_str()); + } + cl_int error = CL_(clCompileProgram)( + object_, + 0, + nullptr, + options, + static_cast(inputHeaders.size()), + reinterpret_cast(inputHeaders.data()), + reinterpret_cast(headerIncludeNamesCStr.data()), + notifyFptr, + data); + return detail::buildErrHandler(error, __COMPILE_PROGRAM_ERR, getBuildInfo()); + } + + cl_int compile( + const string& options, + const vector& deviceList, + const vector& inputHeaders = vector(), + const vector& headerIncludeNames = vector(), + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr) const + { + return compile(options.c_str(), deviceList, inputHeaders, headerIncludeNames, notifyFptr, data); + } + + cl_int compile( + const char* options, + const vector& deviceList, + const vector& inputHeaders = vector(), + const vector& headerIncludeNames = vector(), + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr) const + { + static_assert(sizeof(cl::Program) == sizeof(cl_program), + "Size of cl::Program must be equal to size of cl_program"); + vector headerIncludeNamesCStr; + for(const string& name: headerIncludeNames) { + headerIncludeNamesCStr.push_back(name.c_str()); + } + vector deviceIDList; + for(const Device& device: deviceList) { + deviceIDList.push_back(device()); + } + cl_int error = CL_(clCompileProgram)( + object_, + static_cast(deviceList.size()), + reinterpret_cast(deviceIDList.data()), + options, + static_cast(inputHeaders.size()), + reinterpret_cast(inputHeaders.data()), + reinterpret_cast(headerIncludeNamesCStr.data()), notifyFptr, data); return detail::buildErrHandler(error, __COMPILE_PROGRAM_ERR, getBuildInfo()); @@ -6752,18 +7177,18 @@ class Program : public detail::Wrapper cl_int getInfo(cl_program_info name, T* param) const { return detail::errHandler( - detail::getInfo(&::clGetProgramInfo, object_, name, param), + detail::getInfo(CL_(clGetProgramInfo), object_, name, param), __GET_PROGRAM_INFO_ERR); } template typename detail::param_traits::param_type - getInfo(cl_int* err = NULL) const + getInfo(cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_program_info, name>::param_type param; cl_int result = getInfo(name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; @@ -6775,31 +7200,31 @@ class Program : public detail::Wrapper { return detail::errHandler( detail::getInfo( - &::clGetProgramBuildInfo, object_, device(), name, param), + CL_(clGetProgramBuildInfo), object_, device(), name, param), __GET_PROGRAM_BUILD_INFO_ERR); } template typename detail::param_traits::param_type - getBuildInfo(const Device& device, cl_int* err = NULL) const + getBuildInfo(const Device& device, cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_program_build_info, name>::param_type param; cl_int result = getBuildInfo(device, name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; } - + /** - * Build info function that returns a vector of device/info pairs for the specified + * Build info function that returns a vector of device/info pairs for the specified * info type and for all devices in the program. * On an error reading the info for any device, an empty vector of info will be returned. */ template vector::param_type>> - getBuildInfo(cl_int *err = NULL) const + getBuildInfo(cl_int *err = nullptr) const { cl_int result = CL_SUCCESS; @@ -6809,7 +7234,7 @@ class Program : public detail::Wrapper // If there was an initial error from getInfo return the error if (result != CL_SUCCESS) { - if (err != NULL) { + if (err != nullptr) { *err = result; } return devInfo; @@ -6827,7 +7252,7 @@ class Program : public detail::Wrapper break; } } - if (err != NULL) { + if (err != nullptr) { *err = result; } if (result != CL_SUCCESS) { @@ -6839,15 +7264,15 @@ class Program : public detail::Wrapper cl_int createKernels(vector* kernels) { cl_uint numKernels; - cl_int err = ::clCreateKernelsInProgram(object_, 0, NULL, &numKernels); + cl_int err = CL_(clCreateKernelsInProgram)(object_, 0, nullptr, &numKernels); if (err != CL_SUCCESS) { return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR); } vector value(numKernels); - - err = ::clCreateKernelsInProgram( - object_, numKernels, value.data(), NULL); + + err = CL_(clCreateKernelsInProgram)( + object_, numKernels, value.data(), nullptr); if (err != CL_SUCCESS) { return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR); } @@ -6858,7 +7283,7 @@ class Program : public detail::Wrapper // Assign to param, constructing with retain behaviour // to correctly capture each underlying CL object for (size_type i = 0; i < value.size(); i++) { - // We do not need to retain because this kernel is being created + // We do not need to retain because this kernel is being created // by the runtime (*kernels)[i] = Kernel(value[i], false); } @@ -6880,10 +7305,10 @@ class Program : public detail::Wrapper */ CL_API_PREFIX__VERSION_2_2_DEPRECATED cl_int setReleaseCallback( void (CL_CALLBACK * pfn_notify)(cl_program program, void * user_data), - void * user_data = NULL) CL_API_SUFFIX__VERSION_2_2_DEPRECATED + void * user_data = nullptr) CL_API_SUFFIX__VERSION_2_2_DEPRECATED { return detail::errHandler( - ::clSetProgramReleaseCallback( + CL_(clSetProgramReleaseCallback)( object_, pfn_notify, user_data), @@ -6900,7 +7325,7 @@ class Program : public detail::Wrapper setSpecializationConstant(cl_uint index, const T &value) { return detail::errHandler( - ::clSetProgramSpecializationConstant( + CL_(clSetProgramSpecializationConstant)( object_, index, sizeof(value), @@ -6915,7 +7340,7 @@ class Program : public detail::Wrapper cl_int setSpecializationConstant(cl_uint index, size_type size, const void* value) { return detail::errHandler( - ::clSetProgramSpecializationConstant( + CL_(clSetProgramSpecializationConstant)( object_, index, size, @@ -6927,15 +7352,14 @@ class Program : public detail::Wrapper #if CL_HPP_TARGET_OPENCL_VERSION >= 120 inline Program linkProgram( - Program input1, - Program input2, - const char* options = NULL, - void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL, - void* data = NULL, - cl_int* err = NULL) + const Program& input1, + const Program& input2, + const char* options = nullptr, + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr, + cl_int* err = nullptr) { cl_int error_local = CL_SUCCESS; - cl_program programs[2] = { input1(), input2() }; Context ctx = input1.getInfo(&error_local); @@ -6943,10 +7367,10 @@ inline Program linkProgram( detail::errHandler(error_local, __LINK_PROGRAM_ERR); } - cl_program prog = ::clLinkProgram( + cl_program prog = CL_(clLinkProgram)( ctx(), 0, - NULL, + nullptr, options, 2, programs, @@ -6955,7 +7379,7 @@ inline Program linkProgram( &error_local); detail::errHandler(error_local,__COMPILE_PROGRAM_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error_local; } @@ -6963,44 +7387,63 @@ inline Program linkProgram( } inline Program linkProgram( - vector inputPrograms, - const char* options = NULL, - void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL, - void* data = NULL, - cl_int* err = NULL) + const Program& input1, + const Program& input2, + const string& options, + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr, + cl_int* err = nullptr) { - cl_int error_local = CL_SUCCESS; + return linkProgram(input1, input2, options.c_str(), notifyFptr, data, err); +} - vector programs(inputPrograms.size()); +inline Program linkProgram( + const vector& inputPrograms, + const char* options = nullptr, + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr, + cl_int* err = nullptr) +{ + cl_int error_local = CL_SUCCESS; + Context ctx; - for (unsigned int i = 0; i < inputPrograms.size(); i++) { - programs[i] = inputPrograms[i](); - } + static_assert(sizeof(cl::Program) == sizeof(cl_program), + "Size of cl::Program must be equal to size of cl_program"); - Context ctx; if(inputPrograms.size() > 0) { ctx = inputPrograms[0].getInfo(&error_local); if(error_local!=CL_SUCCESS) { detail::errHandler(error_local, __LINK_PROGRAM_ERR); } } - cl_program prog = ::clLinkProgram( + + cl_program prog = CL_(clLinkProgram)( ctx(), 0, - NULL, + nullptr, options, - (cl_uint)inputPrograms.size(), - programs.data(), + static_cast(inputPrograms.size()), + reinterpret_cast(inputPrograms.data()), notifyFptr, data, &error_local); detail::errHandler(error_local,__COMPILE_PROGRAM_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error_local; } - return Program(prog, false); + return Program(prog); +} + +inline Program linkProgram( + const vector& inputPrograms, + const string& options, + void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr, + void* data = nullptr, + cl_int* err = nullptr) +{ + return linkProgram(inputPrograms, options.c_str(), notifyFptr, data, err); } #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 @@ -7025,7 +7468,7 @@ inline cl_int cl::Program::getInfo(cl_program_info name, vector> cl::Program::getInfo(c vector> binariesVectors; cl_int result = getInfo(CL_PROGRAM_BINARIES, &binariesVectors); - if (err != NULL) { + if (err != nullptr) { *err = result; } return binariesVectors; @@ -7051,7 +7494,7 @@ inline cl_int cl::Program::setSpecializationConstant(cl_uint index, const bool & { cl_uchar ucValue = value ? CL_UCHAR_MAX : 0; return detail::errHandler( - ::clSetProgramSpecializationConstant( + CL_(clSetProgramSpecializationConstant)( object_, index, sizeof(ucValue), @@ -7060,19 +7503,47 @@ inline cl_int cl::Program::setSpecializationConstant(cl_uint index, const bool & } #endif // CL_HPP_TARGET_OPENCL_VERSION >= 220 -inline Kernel::Kernel(const Program& program, const char* name, cl_int* err) +inline Kernel::Kernel(const Program& program, const string& name, cl_int* err) { cl_int error; - object_ = ::clCreateKernel(program(), name, &error); + object_ = CL_(clCreateKernel)(program(), name.c_str(), &error); detail::errHandler(error, __CREATE_KERNEL_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } +} + +inline Kernel::Kernel(const Program& program, const char* name, cl_int* err) +{ + cl_int error; + + object_ = CL_(clCreateKernel)(program(), name, &error); + detail::errHandler(error, __CREATE_KERNEL_ERR); + if (err != nullptr) { + *err = error; + } } +#ifdef cl_khr_external_memory +enum class ExternalMemoryType : cl_external_memory_handle_type_khr +{ + None = 0, +#ifdef cl_khr_external_memory_opaque_fd + OpaqueFd = CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR, +#endif // cl_khr_external_memory_opaque_fd +#ifdef cl_khr_external_memory_win32 + OpaqueWin32 = CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR, + OpaqueWin32Kmt = CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KMT_KHR, +#endif // cl_khr_external_memory_win32 +#ifdef cl_khr_external_memory_dma_buf + DmaBuf = CL_EXTERNAL_MEMORY_HANDLE_DMA_BUF_KHR, +#endif // cl_khr_external_memory_dma_buf +}; +#endif // cl_khr_external_memory + enum class QueueProperties : cl_command_queue_properties { None = 0, @@ -7085,6 +7556,11 @@ inline QueueProperties operator|(QueueProperties lhs, QueueProperties rhs) return static_cast(static_cast(lhs) | static_cast(rhs)); } +inline QueueProperties operator&(QueueProperties lhs, QueueProperties rhs) +{ + return static_cast(static_cast(lhs) & static_cast(rhs)); +} + /*! \class CommandQueue * \brief CommandQueue interface for cl_command_queue. */ @@ -7136,6 +7612,24 @@ class CommandQueue : public detail::Wrapper default_ = c; } +#ifdef cl_khr_external_memory + static std::once_flag ext_memory_initialized_; + + static void initMemoryExtension(const cl::Device& device) + { + auto platform = device.getInfo()(); + + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clEnqueueAcquireExternalMemObjectsKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clEnqueueReleaseExternalMemObjectsKHR); + + if ((pfn_clEnqueueAcquireExternalMemObjectsKHR == nullptr) + && (pfn_clEnqueueReleaseExternalMemObjectsKHR == nullptr)) + { + detail::errHandler(CL_INVALID_VALUE, __ENQUEUE_ACQUIRE_EXTERNAL_MEMORY_ERR); + } + } +#endif // cl_khr_external_memory + public: #ifdef CL_HPP_UNIT_TEST_ENABLE /*! \brief Reset the default. @@ -7148,7 +7642,7 @@ class CommandQueue : public detail::Wrapper default_ = CommandQueue(); } #endif // #ifdef CL_HPP_UNIT_TEST_ENABLE - + /*! * \brief Constructs a CommandQueue based on passed properties. @@ -7156,7 +7650,7 @@ class CommandQueue : public detail::Wrapper */ CommandQueue( cl_command_queue_properties properties, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; @@ -7164,7 +7658,7 @@ class CommandQueue : public detail::Wrapper detail::errHandler(error, __CREATE_CONTEXT_ERR); if (error != CL_SUCCESS) { - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -7189,7 +7683,7 @@ class CommandQueue : public detail::Wrapper cl_queue_properties queue_properties[] = { CL_QUEUE_PROPERTIES, properties, 0 }; if ((properties & CL_QUEUE_ON_DEVICE) == 0) { - object_ = ::clCreateCommandQueueWithProperties( + object_ = CL_(clCreateCommandQueueWithProperties)( context(), device(), queue_properties, &error); } else { @@ -7197,18 +7691,18 @@ class CommandQueue : public detail::Wrapper } detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200 #if CL_HPP_MINIMUM_OPENCL_VERSION < 200 if (!useWithProperties) { - object_ = ::clCreateCommandQueue( + object_ = CL_(clCreateCommandQueue)( context(), device(), properties, &error); detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -7222,7 +7716,7 @@ class CommandQueue : public detail::Wrapper */ CommandQueue( QueueProperties properties, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; @@ -7230,7 +7724,7 @@ class CommandQueue : public detail::Wrapper detail::errHandler(error, __CREATE_CONTEXT_ERR); if (error != CL_SUCCESS) { - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -7255,22 +7749,22 @@ class CommandQueue : public detail::Wrapper cl_queue_properties queue_properties[] = { CL_QUEUE_PROPERTIES, static_cast(properties), 0 }; - object_ = ::clCreateCommandQueueWithProperties( + object_ = CL_(clCreateCommandQueueWithProperties)( context(), device(), queue_properties, &error); detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200 #if CL_HPP_MINIMUM_OPENCL_VERSION < 200 if (!useWithProperties) { - object_ = ::clCreateCommandQueue( + object_ = CL_(clCreateCommandQueue)( context(), device(), static_cast(properties), &error); detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -7286,7 +7780,7 @@ class CommandQueue : public detail::Wrapper explicit CommandQueue( const Context& context, cl_command_queue_properties properties = 0, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; bool useWithProperties; @@ -7297,7 +7791,7 @@ class CommandQueue : public detail::Wrapper if (error != CL_SUCCESS) { - if (err != NULL) { + if (err != nullptr) { *err = error; } return; @@ -7320,7 +7814,7 @@ class CommandQueue : public detail::Wrapper cl_queue_properties queue_properties[] = { CL_QUEUE_PROPERTIES, properties, 0 }; if ((properties & CL_QUEUE_ON_DEVICE) == 0) { - object_ = ::clCreateCommandQueueWithProperties( + object_ = CL_(clCreateCommandQueueWithProperties)( context(), devices[0](), queue_properties, &error); } else { @@ -7328,18 +7822,18 @@ class CommandQueue : public detail::Wrapper } detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200 #if CL_HPP_MINIMUM_OPENCL_VERSION < 200 if (!useWithProperties) { - object_ = ::clCreateCommandQueue( + object_ = CL_(clCreateCommandQueue)( context(), devices[0](), properties, &error); detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -7353,7 +7847,7 @@ class CommandQueue : public detail::Wrapper explicit CommandQueue( const Context& context, QueueProperties properties, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; bool useWithProperties; @@ -7364,7 +7858,7 @@ class CommandQueue : public detail::Wrapper if (error != CL_SUCCESS) { - if (err != NULL) { + if (err != nullptr) { *err = error; } return; @@ -7386,22 +7880,22 @@ class CommandQueue : public detail::Wrapper if (useWithProperties) { cl_queue_properties queue_properties[] = { CL_QUEUE_PROPERTIES, static_cast(properties), 0 }; - object_ = ::clCreateCommandQueueWithProperties( + object_ = CL_(clCreateCommandQueueWithProperties)( context(), devices[0](), queue_properties, &error); detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200 #if CL_HPP_MINIMUM_OPENCL_VERSION < 200 if (!useWithProperties) { - object_ = ::clCreateCommandQueue( + object_ = CL_(clCreateCommandQueue)( context(), devices[0](), static_cast(properties), &error); detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -7416,7 +7910,7 @@ class CommandQueue : public detail::Wrapper const Context& context, const Device& device, cl_command_queue_properties properties = 0, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; bool useWithProperties; @@ -7437,22 +7931,22 @@ class CommandQueue : public detail::Wrapper if (useWithProperties) { cl_queue_properties queue_properties[] = { CL_QUEUE_PROPERTIES, properties, 0 }; - object_ = ::clCreateCommandQueueWithProperties( + object_ = CL_(clCreateCommandQueueWithProperties)( context(), device(), queue_properties, &error); detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200 #if CL_HPP_MINIMUM_OPENCL_VERSION < 200 if (!useWithProperties) { - object_ = ::clCreateCommandQueue( + object_ = CL_(clCreateCommandQueue)( context(), device(), properties, &error); detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -7467,7 +7961,7 @@ class CommandQueue : public detail::Wrapper const Context& context, const Device& device, QueueProperties properties, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; bool useWithProperties; @@ -7488,29 +7982,29 @@ class CommandQueue : public detail::Wrapper if (useWithProperties) { cl_queue_properties queue_properties[] = { CL_QUEUE_PROPERTIES, static_cast(properties), 0 }; - object_ = ::clCreateCommandQueueWithProperties( + object_ = CL_(clCreateCommandQueueWithProperties)( context(), device(), queue_properties, &error); detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200 #if CL_HPP_MINIMUM_OPENCL_VERSION < 200 if (!useWithProperties) { - object_ = ::clCreateCommandQueue( + object_ = CL_(clCreateCommandQueue)( context(), device(), static_cast(properties), &error); detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } #endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200 } - static CommandQueue getDefault(cl_int * err = NULL) + static CommandQueue getDefault(cl_int * err = nullptr) { std::call_once(default_initialized_, makeDefault); #if CL_HPP_TARGET_OPENCL_VERSION >= 200 @@ -7518,7 +8012,7 @@ class CommandQueue : public detail::Wrapper #else // CL_HPP_TARGET_OPENCL_VERSION >= 200 detail::errHandler(default_error_, __CREATE_COMMAND_QUEUE_ERR); #endif // CL_HPP_TARGET_OPENCL_VERSION >= 200 - if (err != NULL) { + if (err != nullptr) { *err = default_error_; } return default_; @@ -7547,7 +8041,7 @@ class CommandQueue : public detail::Wrapper * Defaults to false to maintain compatibility with * earlier versions. */ - explicit CommandQueue(const cl_command_queue& commandQueue, bool retainObject = false) : + explicit CommandQueue(const cl_command_queue& commandQueue, bool retainObject = false) : detail::Wrapper(commandQueue, retainObject) { } CommandQueue& operator = (const cl_command_queue& rhs) @@ -7556,51 +8050,23 @@ class CommandQueue : public detail::Wrapper return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - CommandQueue(const CommandQueue& queue) : detail::Wrapper(queue) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - CommandQueue& operator = (const CommandQueue &queue) - { - detail::Wrapper::operator=(queue); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - CommandQueue(CommandQueue&& queue) CL_HPP_NOEXCEPT_ : detail::Wrapper(std::move(queue)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - CommandQueue& operator = (CommandQueue &&queue) - { - detail::Wrapper::operator=(std::move(queue)); - return *this; - } - template cl_int getInfo(cl_command_queue_info name, T* param) const { return detail::errHandler( detail::getInfo( - &::clGetCommandQueueInfo, object_, name, param), + CL_(clGetCommandQueueInfo), object_, name, param), __GET_COMMAND_QUEUE_INFO_ERR); } template typename detail::param_traits::param_type - getInfo(cl_int* err = NULL) const + getInfo(cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_command_queue_info, name>::param_type param; cl_int result = getInfo(name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; @@ -7612,20 +8078,20 @@ class CommandQueue : public detail::Wrapper size_type offset, size_type size, void* ptr, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueReadBuffer( + CL_(clEnqueueReadBuffer)( object_, buffer(), blocking, offset, size, ptr, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_READ_BUFFER_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -7637,20 +8103,20 @@ class CommandQueue : public detail::Wrapper size_type offset, size_type size, const void* ptr, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueWriteBuffer( + CL_(clEnqueueWriteBuffer)( object_, buffer(), blocking, offset, size, ptr, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_WRITE_BUFFER_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -7662,19 +8128,19 @@ class CommandQueue : public detail::Wrapper size_type src_offset, size_type dst_offset, size_type size, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueCopyBuffer( + CL_(clEnqueueCopyBuffer)( object_, src(), dst(), src_offset, dst_offset, size, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQEUE_COPY_BUFFER_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -7691,14 +8157,14 @@ class CommandQueue : public detail::Wrapper size_type host_row_pitch, size_type host_slice_pitch, void *ptr, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueReadBufferRect( - object_, - buffer(), + CL_(clEnqueueReadBufferRect)( + object_, + buffer(), blocking, buffer_offset.data(), host_offset.data(), @@ -7708,21 +8174,50 @@ class CommandQueue : public detail::Wrapper host_row_pitch, host_slice_pitch, ptr, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_READ_BUFFER_RECT_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; } - cl_int enqueueWriteBufferRect( + cl_int enqueueReadBufferRect( const Buffer& buffer, cl_bool blocking, - const array& buffer_offset, + const array& buffer_offset, + const array& host_offset, + const array& region, + size_type buffer_row_pitch, + size_type buffer_slice_pitch, + size_type host_row_pitch, + size_type host_slice_pitch, + void* ptr, + const vector* events = nullptr, + Event* event = nullptr) const + { + return enqueueReadBufferRect( + buffer, + blocking, + { buffer_offset[0], buffer_offset[1], 0 }, + { host_offset[0], host_offset[1], 0 }, + { region[0], region[1], 1 }, + buffer_row_pitch, + buffer_slice_pitch, + host_row_pitch, + host_slice_pitch, + ptr, + events, + event); + } + + cl_int enqueueWriteBufferRect( + const Buffer& buffer, + cl_bool blocking, + const array& buffer_offset, const array& host_offset, const array& region, size_type buffer_row_pitch, @@ -7730,14 +8225,14 @@ class CommandQueue : public detail::Wrapper size_type host_row_pitch, size_type host_slice_pitch, const void *ptr, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueWriteBufferRect( - object_, - buffer(), + CL_(clEnqueueWriteBufferRect)( + object_, + buffer(), blocking, buffer_offset.data(), host_offset.data(), @@ -7747,17 +8242,46 @@ class CommandQueue : public detail::Wrapper host_row_pitch, host_slice_pitch, ptr, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_WRITE_BUFFER_RECT_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; } + cl_int enqueueWriteBufferRect( + const Buffer& buffer, + cl_bool blocking, + const array& buffer_offset, + const array& host_offset, + const array& region, + size_type buffer_row_pitch, + size_type buffer_slice_pitch, + size_type host_row_pitch, + size_type host_slice_pitch, + const void* ptr, + const vector* events = nullptr, + Event* event = nullptr) const + { + return enqueueWriteBufferRect( + buffer, + blocking, + { buffer_offset[0], buffer_offset[1], 0 }, + { host_offset[0], host_offset[1], 0 }, + { region[0], region[1], 1 }, + buffer_row_pitch, + buffer_slice_pitch, + host_row_pitch, + host_slice_pitch, + ptr, + events, + event); + } + cl_int enqueueCopyBufferRect( const Buffer& src, const Buffer& dst, @@ -7768,15 +8292,15 @@ class CommandQueue : public detail::Wrapper size_type src_slice_pitch, size_type dst_row_pitch, size_type dst_slice_pitch, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueCopyBufferRect( - object_, - src(), - dst(), + CL_(clEnqueueCopyBufferRect)( + object_, + src(), + dst(), src_origin.data(), dst_origin.data(), region.data(), @@ -7784,25 +8308,53 @@ class CommandQueue : public detail::Wrapper src_slice_pitch, dst_row_pitch, dst_slice_pitch, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQEUE_COPY_BUFFER_RECT_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; } + + cl_int enqueueCopyBufferRect( + const Buffer& src, + const Buffer& dst, + const array& src_origin, + const array& dst_origin, + const array& region, + size_type src_row_pitch, + size_type src_slice_pitch, + size_type dst_row_pitch, + size_type dst_slice_pitch, + const vector* events = nullptr, + Event* event = nullptr) const + { + return enqueueCopyBufferRect( + src, + dst, + { src_origin[0], src_origin[1], 0 }, + { dst_origin[0], dst_origin[1], 0 }, + { region[0], region[1], 1 }, + src_row_pitch, + src_slice_pitch, + dst_row_pitch, + dst_slice_pitch, + events, + event); + } + #endif // CL_HPP_TARGET_OPENCL_VERSION >= 110 #if CL_HPP_TARGET_OPENCL_VERSION >= 120 /** * Enqueue a command to fill a buffer object with a pattern * of a given size. The pattern is specified as a vector type. - * \tparam PatternType The datatype of the pattern field. + * \tparam PatternType The datatype of the pattern field. * The pattern type must be an accepted OpenCL data type. - * \tparam offset Is the offset in bytes into the buffer at - * which to start filling. This must be a multiple of + * \tparam offset Is the offset in bytes into the buffer at + * which to start filling. This must be a multiple of * the pattern size. * \tparam size Is the size in bytes of the region to fill. * This must be a multiple of the pattern size. @@ -7813,24 +8365,24 @@ class CommandQueue : public detail::Wrapper PatternType pattern, size_type offset, size_type size, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueFillBuffer( - object_, + CL_(clEnqueueFillBuffer)( + object_, buffer(), static_cast(&pattern), - sizeof(PatternType), - offset, + sizeof(PatternType), + offset, size, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_FILL_BUFFER_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -7845,31 +8397,54 @@ class CommandQueue : public detail::Wrapper size_type row_pitch, size_type slice_pitch, void* ptr, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueReadImage( - object_, - image(), - blocking, + CL_(clEnqueueReadImage)( + object_, + image(), + blocking, origin.data(), - region.data(), - row_pitch, - slice_pitch, + region.data(), + row_pitch, + slice_pitch, ptr, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_READ_IMAGE_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; } + cl_int enqueueReadImage( + const Image& image, + cl_bool blocking, + const array& origin, + const array& region, + size_type row_pitch, + size_type slice_pitch, + void* ptr, + const vector* events = nullptr, + Event* event = nullptr) const + { + return enqueueReadImage( + image, + blocking, + { origin[0], origin[1], 0 }, + { region[0], region[1], 1 }, + row_pitch, + slice_pitch, + ptr, + events, + event); + } + cl_int enqueueWriteImage( const Image& image, cl_bool blocking, @@ -7878,161 +8453,168 @@ class CommandQueue : public detail::Wrapper size_type row_pitch, size_type slice_pitch, const void* ptr, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueWriteImage( - object_, - image(), - blocking, + CL_(clEnqueueWriteImage)( + object_, + image(), + blocking, origin.data(), - region.data(), - row_pitch, - slice_pitch, + region.data(), + row_pitch, + slice_pitch, ptr, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_WRITE_IMAGE_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; } + cl_int enqueueWriteImage( + const Image& image, + cl_bool blocking, + const array& origin, + const array& region, + size_type row_pitch, + size_type slice_pitch, + const void* ptr, + const vector* events = nullptr, + Event* event = nullptr) const + { + return enqueueWriteImage( + image, + blocking, + { origin[0], origin[1], 0 }, + { region[0], region[1], 1 }, + row_pitch, + slice_pitch, + ptr, + events, + event); + } + cl_int enqueueCopyImage( const Image& src, const Image& dst, const array& src_origin, const array& dst_origin, const array& region, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueCopyImage( - object_, - src(), - dst(), + CL_(clEnqueueCopyImage)( + object_, + src(), + dst(), src_origin.data(), - dst_origin.data(), + dst_origin.data(), region.data(), - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_COPY_IMAGE_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; } -#if CL_HPP_TARGET_OPENCL_VERSION >= 120 - /** - * Enqueue a command to fill an image object with a specified color. - * \param fillColor is the color to use to fill the image. - * This is a four component RGBA floating-point color value if - * the image channel data type is not an unnormalized signed or - * unsigned data type. - */ - cl_int enqueueFillImage( - const Image& image, - cl_float4 fillColor, - const array& origin, - const array& region, - const vector* events = NULL, - Event* event = NULL) const - { - cl_event tmp; - cl_int err = detail::errHandler( - ::clEnqueueFillImage( - object_, - image(), - static_cast(&fillColor), - origin.data(), - region.data(), - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), - __ENQUEUE_FILL_IMAGE_ERR); - - if (event != NULL && err == CL_SUCCESS) - *event = tmp; - - return err; + cl_int enqueueCopyImage( + const Image& src, + const Image& dst, + const array& src_origin, + const array& dst_origin, + const array& region, + const vector* events = nullptr, + Event* event = nullptr) const + { + return enqueueCopyImage( + src, + dst, + { src_origin[0], src_origin[1], 0 }, + { dst_origin[0], dst_origin[1], 0 }, + { region[0], region[1], 1 }, + events, + event); } +#if CL_HPP_TARGET_OPENCL_VERSION >= 120 /** * Enqueue a command to fill an image object with a specified color. * \param fillColor is the color to use to fill the image. - * This is a four component RGBA signed integer color value if - * the image channel data type is an unnormalized signed integer - * type. + * This is a four component RGBA floating-point, signed integer + * or unsigned integer color value if the image channel data + * type is an unnormalized signed integer type. */ - cl_int enqueueFillImage( - const Image& image, - cl_int4 fillColor, - const array& origin, - const array& region, - const vector* events = NULL, - Event* event = NULL) const + template + typename std::enable_if::value || + std::is_same::value || + std::is_same::value, + cl_int>::type + enqueueFillImage( + const Image& image, + T fillColor, + const array& origin, + const array& region, + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueFillImage( + CL_(clEnqueueFillImage)( object_, image(), static_cast(&fillColor), origin.data(), region.data(), - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), - __ENQUEUE_FILL_IMAGE_ERR); + (events != nullptr) ? (cl_uint)events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*)&events->front() : NULL, + (event != NULL) ? &tmp : nullptr), + __ENQUEUE_FILL_IMAGE_ERR); - if (event != NULL && err == CL_SUCCESS) - *event = tmp; + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; } - /** + /** * Enqueue a command to fill an image object with a specified color. * \param fillColor is the color to use to fill the image. - * This is a four component RGBA unsigned integer color value if - * the image channel data type is an unnormalized unsigned integer - * type. + * This is a four component RGBA floating-point, signed integer + * or unsigned integer color value if the image channel data + * type is an unnormalized signed integer type. */ - cl_int enqueueFillImage( + template + typename std::enable_if::value || + std::is_same::value || + std::is_same::value, cl_int>::type + enqueueFillImage( const Image& image, - cl_uint4 fillColor, - const array& origin, - const array& region, - const vector* events = NULL, - Event* event = NULL) const - { - cl_event tmp; - cl_int err = detail::errHandler( - ::clEnqueueFillImage( - object_, - image(), - static_cast(&fillColor), - origin.data(), - region.data(), - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), - __ENQUEUE_FILL_IMAGE_ERR); - - if (event != NULL && err == CL_SUCCESS) - *event = tmp; - - return err; + T fillColor, + const array& origin, + const array& region, + const vector* events = nullptr, + Event* event = nullptr) const + { + return enqueueFillImage( + image, + fillColor, + { origin[0], origin[1], 0 }, + { region[0], region[1], 1 }, + events, + event + ); } #endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 @@ -8042,121 +8624,333 @@ class CommandQueue : public detail::Wrapper const array& src_origin, const array& region, size_type dst_offset, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueCopyImageToBuffer( - object_, - src(), - dst(), + CL_(clEnqueueCopyImageToBuffer)( + object_, + src(), + dst(), src_origin.data(), - region.data(), + region.data(), dst_offset, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; } + cl_int enqueueCopyImageToBuffer( + const Image& src, + const Buffer& dst, + const array& src_origin, + const array& region, + size_type dst_offset, + const vector* events = nullptr, + Event* event = nullptr) const + { + return enqueueCopyImageToBuffer( + src, + dst, + { src_origin[0], src_origin[1], 0 }, + { region[0], region[1], 1 }, + dst_offset, + events, + event); + } + cl_int enqueueCopyBufferToImage( const Buffer& src, const Image& dst, size_type src_offset, const array& dst_origin, const array& region, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueCopyBufferToImage( - object_, - src(), - dst(), + CL_(clEnqueueCopyBufferToImage)( + object_, + src(), + dst(), src_offset, - dst_origin.data(), + dst_origin.data(), region.data(), - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; } + cl_int enqueueCopyBufferToImage( + const Buffer& src, + const Image& dst, + size_type src_offset, + const array& dst_origin, + const array& region, + const vector* events = nullptr, + Event* event = nullptr) const + { + return enqueueCopyBufferToImage( + src, + dst, + src_offset, + { dst_origin[0], dst_origin[1], 0 }, + { region[0], region[1], 1 }, + events, + event); + } + void* enqueueMapBuffer( const Buffer& buffer, cl_bool blocking, cl_map_flags flags, size_type offset, size_type size, - const vector* events = NULL, - Event* event = NULL, - cl_int* err = NULL) const + const vector* events = nullptr, + Event* event = nullptr, + cl_int* err = nullptr) const { cl_event tmp; cl_int error; - void * result = ::clEnqueueMapBuffer( + void * result = CL_(clEnqueueMapBuffer)( object_, buffer(), blocking, flags, offset, size, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL, + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr, &error); detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } - if (event != NULL && error == CL_SUCCESS) + if (event != nullptr && error == CL_SUCCESS) *event = tmp; return result; } void* enqueueMapImage( - const Image& buffer, + const Image& image, cl_bool blocking, cl_map_flags flags, const array& origin, const array& region, size_type * row_pitch, size_type * slice_pitch, - const vector* events = NULL, - Event* event = NULL, - cl_int* err = NULL) const + const vector* events = nullptr, + Event* event = nullptr, + cl_int* err = nullptr) const { cl_event tmp; cl_int error; - void * result = ::clEnqueueMapImage( - object_, buffer(), blocking, flags, - origin.data(), + void * result = CL_(clEnqueueMapImage)( + object_, image(), blocking, flags, + origin.data(), region.data(), row_pitch, slice_pitch, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL, + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr, &error); detail::errHandler(error, __ENQUEUE_MAP_IMAGE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } - if (event != NULL && error == CL_SUCCESS) + if (event != nullptr && error == CL_SUCCESS) *event = tmp; return result; } + void* enqueueMapImage( + const Image& image, + cl_bool blocking, + cl_map_flags flags, + const array& origin, + const array& region, + size_type* row_pitch, + size_type* slice_pitch, + const vector* events = nullptr, + Event* event = nullptr, + cl_int* err = nullptr) const + { + return enqueueMapImage(image, blocking, flags, + { origin[0], origin[1], 0 }, + { region[0], region[1], 1 }, row_pitch, + slice_pitch, events, event, err); + } + #if CL_HPP_TARGET_OPENCL_VERSION >= 200 + + /** + * Enqueues a command that copies a region of memory from the source pointer to the destination pointer. + * This function is specifically for transferring data between the host and a coarse-grained SVM buffer. + */ + template + cl_int enqueueMemcpySVM( + T *dst_ptr, + const T *src_ptr, + cl_bool blocking, + size_type size, + const vector *events = nullptr, + Event *event = nullptr) const { + cl_event tmp; + cl_int err = detail::errHandler(CL_(clEnqueueSVMMemcpy)( + object_, blocking, static_cast(dst_ptr), static_cast(src_ptr), size, + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event *) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_COPY_SVM_ERR); + + if (event != nullptr && err == CL_SUCCESS) + *event = tmp; + + return err; + } + + /** + *Enqueues a command that will copy data from one coarse-grained SVM buffer to another. + *This function takes two cl::pointer instances representing the destination and source buffers. + */ + template + cl_int enqueueMemcpySVM( + cl::pointer &dst_ptr, + const cl::pointer &src_ptr, + cl_bool blocking, + size_type size, + const vector *events = nullptr, + Event *event = nullptr) const { + cl_event tmp; + cl_int err = detail::errHandler(CL_(clEnqueueSVMMemcpy)( + object_, blocking, static_cast(dst_ptr.get()), static_cast(src_ptr.get()), + size, + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event *) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_COPY_SVM_ERR); + + if (event != nullptr && err == CL_SUCCESS) + *event = tmp; + + return err; + } + + /** + * Enqueues a command that will allow the host to update a region of a coarse-grained SVM buffer. + * This variant takes a cl::vector instance. + */ + template + cl_int enqueueMemcpySVM( + cl::vector &dst_container, + const cl::vector &src_container, + cl_bool blocking, + const vector *events = nullptr, + Event *event = nullptr) const { + cl_event tmp; + if(src_container.size() != dst_container.size()){ + return detail::errHandler(CL_INVALID_VALUE,__ENQUEUE_COPY_SVM_ERR); + } + cl_int err = detail::errHandler(CL_(clEnqueueSVMMemcpy)( + object_, blocking, static_cast(dst_container.data()), + static_cast(src_container.data()), + dst_container.size() * sizeof(T), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event *) &events->front() : nullptr, + (event != NULL) ? &tmp : nullptr), __ENQUEUE_COPY_SVM_ERR); + + if (event != nullptr && err == CL_SUCCESS) + *event = tmp; + + return err; + } + + /** + * Enqueues a command to fill a SVM buffer with a pattern. + * + */ + template + cl_int enqueueMemFillSVM( + T *ptr, + PatternType pattern, + size_type size, + const vector *events = nullptr, + Event *event = nullptr) const { + cl_event tmp; + cl_int err = detail::errHandler(CL_(clEnqueueSVMMemFill)( + object_, static_cast(ptr), static_cast(&pattern), + sizeof(PatternType), size, + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event *) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_FILL_SVM_ERR); + + if (event != nullptr && err == CL_SUCCESS) + *event = tmp; + + return err; + } + + /** + * Enqueues a command that fills a region of a coarse-grained SVM buffer with a specified pattern. + * This variant takes a cl::pointer instance. + */ + template + cl_int enqueueMemFillSVM( + cl::pointer &ptr, + PatternType pattern, + size_type size, + const vector *events = nullptr, + Event *event = nullptr) const { + cl_event tmp; + cl_int err = detail::errHandler(CL_(clEnqueueSVMMemFill)( + object_, static_cast(ptr.get()), static_cast(&pattern), + sizeof(PatternType), size, + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event *) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_FILL_SVM_ERR); + + if (event != nullptr && err == CL_SUCCESS) + *event = tmp; + + return err; + } + + /** + * Enqueues a command that will allow the host to fill a region of a coarse-grained SVM buffer with a specified pattern. + * This variant takes a cl::vector instance. + */ + template + cl_int enqueueMemFillSVM( + cl::vector &container, + PatternType pattern, + const vector *events = nullptr, + Event* event = nullptr) const + { + cl_event tmp; + cl_int err = detail::errHandler(CL_(clEnqueueSVMMemFill)( + object_, static_cast(container.data()), static_cast(&pattern), + sizeof(PatternType), container.size() * sizeof(T), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event *) &events->front() : nullptr, + (event != nullptr) ? &tmp : NULL), __ENQUEUE_FILL_SVM_ERR); + + if (event != nullptr && err == CL_SUCCESS) + *event = tmp; + + return err; + } + /** * Enqueues a command that will allow the host to update a region of a coarse-grained SVM buffer. * This variant takes a raw SVM pointer. @@ -8167,18 +8961,18 @@ class CommandQueue : public detail::Wrapper cl_bool blocking, cl_map_flags flags, size_type size, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; - cl_int err = detail::errHandler(::clEnqueueSVMMap( + cl_int err = detail::errHandler(CL_(clEnqueueSVMMap)( object_, blocking, flags, static_cast(ptr), size, - (events != NULL) ? (cl_uint)events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL, - (event != NULL) ? &tmp : NULL), - __ENQUEUE_MAP_BUFFER_ERR); + (events != nullptr) ? (cl_uint)events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*)&events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), + __ENQUEUE_MAP_SVM_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8195,18 +8989,18 @@ class CommandQueue : public detail::Wrapper cl_bool blocking, cl_map_flags flags, size_type size, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; - cl_int err = detail::errHandler(::clEnqueueSVMMap( + cl_int err = detail::errHandler(CL_(clEnqueueSVMMap)( object_, blocking, flags, static_cast(ptr.get()), size, - (events != NULL) ? (cl_uint)events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL, - (event != NULL) ? &tmp : NULL), - __ENQUEUE_MAP_BUFFER_ERR); + (events != nullptr) ? (cl_uint)events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*)&events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), + __ENQUEUE_MAP_SVM_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8221,18 +9015,18 @@ class CommandQueue : public detail::Wrapper cl::vector &container, cl_bool blocking, cl_map_flags flags, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; - cl_int err = detail::errHandler(::clEnqueueSVMMap( + cl_int err = detail::errHandler(CL_(clEnqueueSVMMap)( object_, blocking, flags, static_cast(container.data()), container.size()*sizeof(T), - (events != NULL) ? (cl_uint)events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL, - (event != NULL) ? &tmp : NULL), - __ENQUEUE_MAP_BUFFER_ERR); + (events != nullptr) ? (cl_uint)events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*)&events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), + __ENQUEUE_MAP_SVM_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8242,19 +9036,19 @@ class CommandQueue : public detail::Wrapper cl_int enqueueUnmapMemObject( const Memory& memory, void* mapped_ptr, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueUnmapMemObject( + CL_(clEnqueueUnmapMemObject)( object_, memory(), mapped_ptr, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_UNMAP_MEM_OBJECT_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8269,19 +9063,19 @@ class CommandQueue : public detail::Wrapper template cl_int enqueueUnmapSVM( T* ptr, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueSVMUnmap( + CL_(clEnqueueSVMUnmap)( object_, static_cast(ptr), - (events != NULL) ? (cl_uint)events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL, - (event != NULL) ? &tmp : NULL), - __ENQUEUE_UNMAP_MEM_OBJECT_ERR); + (events != nullptr) ? (cl_uint)events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*)&events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), + __ENQUEUE_UNMAP_SVM_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8294,19 +9088,19 @@ class CommandQueue : public detail::Wrapper template cl_int enqueueUnmapSVM( cl::pointer &ptr, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueSVMUnmap( + CL_(clEnqueueSVMUnmap)( object_, static_cast(ptr.get()), - (events != NULL) ? (cl_uint)events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL, - (event != NULL) ? &tmp : NULL), - __ENQUEUE_UNMAP_MEM_OBJECT_ERR); + (events != nullptr) ? (cl_uint)events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*)&events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), + __ENQUEUE_UNMAP_SVM_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8319,19 +9113,19 @@ class CommandQueue : public detail::Wrapper template cl_int enqueueUnmapSVM( cl::vector &container, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueSVMUnmap( + CL_(clEnqueueSVMUnmap)( object_, static_cast(container.data()), - (events != NULL) ? (cl_uint)events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL, - (event != NULL) ? &tmp : NULL), - __ENQUEUE_UNMAP_MEM_OBJECT_ERR); + (events != nullptr) ? (cl_uint)events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*)&events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), + __ENQUEUE_UNMAP_SVM_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8340,30 +9134,30 @@ class CommandQueue : public detail::Wrapper #if CL_HPP_TARGET_OPENCL_VERSION >= 120 /** - * Enqueues a marker command which waits for either a list of events to complete, + * Enqueues a marker command which waits for either a list of events to complete, * or all previously enqueued commands to complete. * - * Enqueues a marker command which waits for either a list of events to complete, - * or if the list is empty it waits for all commands previously enqueued in command_queue - * to complete before it completes. This command returns an event which can be waited on, - * i.e. this event can be waited on to insure that all events either in the event_wait_list - * or all previously enqueued commands, queued before this command to command_queue, + * Enqueues a marker command which waits for either a list of events to complete, + * or if the list is empty it waits for all commands previously enqueued in command_queue + * to complete before it completes. This command returns an event which can be waited on, + * i.e. this event can be waited on to insure that all events either in the event_wait_list + * or all previously enqueued commands, queued before this command to command_queue, * have completed. */ cl_int enqueueMarkerWithWaitList( - const vector *events = 0, - Event *event = 0) const + const vector *events = nullptr, + Event *event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueMarkerWithWaitList( + CL_(clEnqueueMarkerWithWaitList)( object_, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_MARKER_WAIT_LIST_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8372,33 +9166,33 @@ class CommandQueue : public detail::Wrapper /** * A synchronization point that enqueues a barrier operation. * - * Enqueues a barrier command which waits for either a list of events to complete, - * or if the list is empty it waits for all commands previously enqueued in command_queue - * to complete before it completes. This command blocks command execution, that is, any - * following commands enqueued after it do not execute until it completes. This command - * returns an event which can be waited on, i.e. this event can be waited on to insure that - * all events either in the event_wait_list or all previously enqueued commands, queued + * Enqueues a barrier command which waits for either a list of events to complete, + * or if the list is empty it waits for all commands previously enqueued in command_queue + * to complete before it completes. This command blocks command execution, that is, any + * following commands enqueued after it do not execute until it completes. This command + * returns an event which can be waited on, i.e. this event can be waited on to insure that + * all events either in the event_wait_list or all previously enqueued commands, queued * before this command to command_queue, have completed. */ cl_int enqueueBarrierWithWaitList( - const vector *events = 0, - Event *event = 0) const + const vector *events = nullptr, + Event *event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueBarrierWithWaitList( + CL_(clEnqueueBarrierWithWaitList)( object_, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_BARRIER_WAIT_LIST_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; } - + /** * Enqueues a command to indicate with which device a set of memory objects * should be associated. @@ -8406,30 +9200,30 @@ class CommandQueue : public detail::Wrapper cl_int enqueueMigrateMemObjects( const vector &memObjects, cl_mem_migration_flags flags, - const vector* events = NULL, - Event* event = NULL + const vector* events = nullptr, + Event* event = nullptr ) const { cl_event tmp; - + vector localMemObjects(memObjects.size()); for( int i = 0; i < (int)memObjects.size(); ++i ) { localMemObjects[i] = memObjects[i](); } - + cl_int err = detail::errHandler( - ::clEnqueueMigrateMemObjects( - object_, - (cl_uint)memObjects.size(), + CL_(clEnqueueMigrateMemObjects)( + object_, + (cl_uint)memObjects.size(), localMemObjects.data(), flags, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_UNMAP_MEM_OBJECT_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8448,21 +9242,21 @@ class CommandQueue : public detail::Wrapper const cl::vector &svmRawPointers, const cl::vector &sizes, cl_mem_migration_flags flags = 0, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; - cl_int err = detail::errHandler(::clEnqueueSVMMigrateMem( + cl_int err = detail::errHandler(CL_(clEnqueueSVMMigrateMem)( object_, svmRawPointers.size(), static_cast(svmRawPointers.data()), sizes.data(), // array of sizes not passed flags, - (events != NULL) ? (cl_uint)events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint)events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*)&events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_MIGRATE_SVM_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8476,8 +9270,8 @@ class CommandQueue : public detail::Wrapper cl_int enqueueMigrateSVM( const cl::vector &svmRawPointers, cl_mem_migration_flags flags = 0, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { return enqueueMigrateSVM(svmRawPointers, cl::vector(svmRawPointers.size()), flags, events, event); } @@ -8493,8 +9287,8 @@ class CommandQueue : public detail::Wrapper const cl::vector> &svmPointers, const cl::vector &sizes, cl_mem_migration_flags flags = 0, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl::vector svmRawPointers; svmRawPointers.reserve(svmPointers.size()); @@ -8514,8 +9308,8 @@ class CommandQueue : public detail::Wrapper cl_int enqueueMigrateSVM( const cl::vector> &svmPointers, cl_mem_migration_flags flags = 0, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { return enqueueMigrateSVM(svmPointers, cl::vector(svmPointers.size()), flags, events, event); } @@ -8530,8 +9324,8 @@ class CommandQueue : public detail::Wrapper const cl::vector> &svmContainers, const cl::vector &sizes, cl_mem_migration_flags flags = 0, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl::vector svmRawPointers; svmRawPointers.reserve(svmContainers.size()); @@ -8550,35 +9344,35 @@ class CommandQueue : public detail::Wrapper cl_int enqueueMigrateSVM( const cl::vector> &svmContainers, cl_mem_migration_flags flags = 0, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { return enqueueMigrateSVM(svmContainers, cl::vector(svmContainers.size()), flags, events, event); } #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 210 - + cl_int enqueueNDRangeKernel( const Kernel& kernel, const NDRange& offset, const NDRange& global, const NDRange& local = NullRange, - const vector* events = NULL, - Event* event = NULL) const + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueNDRangeKernel( + CL_(clEnqueueNDRangeKernel)( object_, kernel(), (cl_uint) global.dimensions(), - offset.dimensions() != 0 ? (const size_type*) offset : NULL, + offset.dimensions() != 0 ? (const size_type*) offset : nullptr, (const size_type*) global, - local.dimensions() != 0 ? (const size_type*) local : NULL, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + local.dimensions() != 0 ? (const size_type*) local : nullptr, + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_NDRANGE_KERNEL_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8587,19 +9381,19 @@ class CommandQueue : public detail::Wrapper #if defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS) CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_int enqueueTask( const Kernel& kernel, - const vector* events = NULL, - Event* event = NULL) const CL_API_SUFFIX__VERSION_1_2_DEPRECATED + const vector* events = nullptr, + Event* event = nullptr) const CL_API_SUFFIX__VERSION_1_2_DEPRECATED { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueTask( + CL_(clEnqueueTask)( object_, kernel(), - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_TASK_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8609,33 +9403,24 @@ class CommandQueue : public detail::Wrapper cl_int enqueueNativeKernel( void (CL_CALLBACK *userFptr)(void *), std::pair args, - const vector* mem_objects = NULL, - const vector* mem_locs = NULL, - const vector* events = NULL, - Event* event = NULL) const + const vector* mem_objects = nullptr, + const vector* mem_locs = nullptr, + const vector* events = nullptr, + Event* event = nullptr) const { - size_type elements = 0; - if (mem_objects != NULL) { - elements = mem_objects->size(); - } - vector mems(elements); - for (unsigned int i = 0; i < elements; i++) { - mems[i] = ((*mem_objects)[i])(); - } - cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueNativeKernel( + CL_(clEnqueueNativeKernel)( object_, userFptr, args.first, args.second, - (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0, - mems.data(), - (mem_locs != NULL && mem_locs->size() > 0) ? (const void **) &mem_locs->front() : NULL, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (mem_objects != nullptr) ? (cl_uint) mem_objects->size() : 0, + (mem_objects->size() > 0 ) ? reinterpret_cast(mem_objects->data()) : nullptr, + (mem_locs != nullptr && mem_locs->size() > 0) ? const_cast(&mem_locs->front()) : nullptr, + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_NATIVE_KERNEL); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8645,17 +9430,17 @@ class CommandQueue : public detail::Wrapper * Deprecated APIs for 1.2 */ #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) - CL_API_PREFIX__VERSION_1_1_DEPRECATED - cl_int enqueueMarker(Event* event = NULL) const CL_API_SUFFIX__VERSION_1_1_DEPRECATED + CL_API_PREFIX__VERSION_1_1_DEPRECATED + cl_int enqueueMarker(Event* event = nullptr) const CL_API_SUFFIX__VERSION_1_1_DEPRECATED { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueMarker( - object_, - (event != NULL) ? &tmp : NULL), + CL_(clEnqueueMarker)( + object_, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_MARKER_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8665,53 +9450,53 @@ class CommandQueue : public detail::Wrapper cl_int enqueueWaitForEvents(const vector& events) const CL_API_SUFFIX__VERSION_1_1_DEPRECATED { return detail::errHandler( - ::clEnqueueWaitForEvents( + CL_(clEnqueueWaitForEvents)( object_, (cl_uint) events.size(), - events.size() > 0 ? (const cl_event*) &events.front() : NULL), + events.size() > 0 ? (const cl_event*) &events.front() : nullptr), __ENQUEUE_WAIT_FOR_EVENTS_ERR); } #endif // defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) cl_int enqueueAcquireGLObjects( - const vector* mem_objects = NULL, - const vector* events = NULL, - Event* event = NULL) const + const vector* mem_objects = nullptr, + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueAcquireGLObjects( + CL_(clEnqueueAcquireGLObjects)( object_, - (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0, - (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (mem_objects != nullptr) ? (cl_uint) mem_objects->size() : 0, + (mem_objects != nullptr && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): nullptr, + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_ACQUIRE_GL_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; } cl_int enqueueReleaseGLObjects( - const vector* mem_objects = NULL, - const vector* events = NULL, - Event* event = NULL) const + const vector* mem_objects = nullptr, + const vector* events = nullptr, + Event* event = nullptr) const { cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueReleaseGLObjects( + CL_(clEnqueueReleaseGLObjects)( object_, - (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0, - (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (mem_objects != nullptr) ? (cl_uint) mem_objects->size() : 0, + (mem_objects != nullptr && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): nullptr, + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_RELEASE_GL_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8728,66 +9513,66 @@ typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)( const cl_event* event_wait_list, cl_event* event); cl_int enqueueAcquireD3D10Objects( - const vector* mem_objects = NULL, - const vector* events = NULL, - Event* event = NULL) const + const vector* mem_objects = nullptr, + const vector* events = nullptr, + Event* event = nullptr) const { - static PFN_clEnqueueAcquireD3D10ObjectsKHR pfn_clEnqueueAcquireD3D10ObjectsKHR = NULL; + static PFN_clEnqueueAcquireD3D10ObjectsKHR pfn_clEnqueueAcquireD3D10ObjectsKHR = nullptr; #if CL_HPP_TARGET_OPENCL_VERSION >= 120 cl_context context = getInfo(); cl::Device device(getInfo()); cl_platform_id platform = device.getInfo(); CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clEnqueueAcquireD3D10ObjectsKHR); #endif -#if CL_HPP_TARGET_OPENCL_VERSION >= 110 +#if CL_HPP_MINIMUM_OPENCL_VERSION < 120 CL_HPP_INIT_CL_EXT_FCN_PTR_(clEnqueueAcquireD3D10ObjectsKHR); #endif - + cl_event tmp; cl_int err = detail::errHandler( pfn_clEnqueueAcquireD3D10ObjectsKHR( object_, - (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0, - (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (mem_objects != nullptr) ? (cl_uint) mem_objects->size() : 0, + (mem_objects != nullptr && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): nullptr, + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_ACQUIRE_GL_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; } cl_int enqueueReleaseD3D10Objects( - const vector* mem_objects = NULL, - const vector* events = NULL, - Event* event = NULL) const + const vector* mem_objects = nullptr, + const vector* events = nullptr, + Event* event = nullptr) const { - static PFN_clEnqueueReleaseD3D10ObjectsKHR pfn_clEnqueueReleaseD3D10ObjectsKHR = NULL; + static PFN_clEnqueueReleaseD3D10ObjectsKHR pfn_clEnqueueReleaseD3D10ObjectsKHR = nullptr; #if CL_HPP_TARGET_OPENCL_VERSION >= 120 cl_context context = getInfo(); cl::Device device(getInfo()); cl_platform_id platform = device.getInfo(); CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clEnqueueReleaseD3D10ObjectsKHR); -#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120 -#if CL_HPP_TARGET_OPENCL_VERSION >= 110 +#endif +#if CL_HPP_MINIMUM_OPENCL_VERSION < 120 CL_HPP_INIT_CL_EXT_FCN_PTR_(clEnqueueReleaseD3D10ObjectsKHR); -#endif // CL_HPP_TARGET_OPENCL_VERSION >= 110 +#endif cl_event tmp; cl_int err = detail::errHandler( pfn_clEnqueueReleaseD3D10ObjectsKHR( object_, - (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0, - (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (mem_objects != nullptr) ? (cl_uint) mem_objects->size() : 0, + (mem_objects != nullptr && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): nullptr, + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_RELEASE_GL_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -8802,22 +9587,100 @@ typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)( cl_int enqueueBarrier() const CL_API_SUFFIX__VERSION_1_1_DEPRECATED { return detail::errHandler( - ::clEnqueueBarrier(object_), + CL_(clEnqueueBarrier)(object_), __ENQUEUE_BARRIER_ERR); } #endif // CL_USE_DEPRECATED_OPENCL_1_1_APIS cl_int flush() const { - return detail::errHandler(::clFlush(object_), __FLUSH_ERR); + return detail::errHandler(CL_(clFlush)(object_), __FLUSH_ERR); } cl_int finish() const { - return detail::errHandler(::clFinish(object_), __FINISH_ERR); + return detail::errHandler(CL_(clFinish)(object_), __FINISH_ERR); + } + +#ifdef cl_khr_external_memory + cl_int enqueueAcquireExternalMemObjects( + const vector& mem_objects, + const vector* events_wait = nullptr, + Event *event = nullptr) + { + cl_int err = CL_INVALID_OPERATION; + cl_event tmp; + + std::call_once(ext_memory_initialized_, initMemoryExtension, this->getInfo()); + + if (pfn_clEnqueueAcquireExternalMemObjectsKHR) + { + err = pfn_clEnqueueAcquireExternalMemObjectsKHR( + object_, + static_cast(mem_objects.size()), + (mem_objects.size() > 0) ? reinterpret_cast(mem_objects.data()) : nullptr, + (events_wait != nullptr) ? static_cast(events_wait->size()) : 0, + (events_wait != nullptr && events_wait->size() > 0) ? reinterpret_cast(events_wait->data()) : nullptr, + &tmp); + } + + detail::errHandler(err, __ENQUEUE_ACQUIRE_EXTERNAL_MEMORY_ERR); + + if (event != nullptr && err == CL_SUCCESS) + *event = tmp; + + return err; + } + + cl_int enqueueReleaseExternalMemObjects( + const vector& mem_objects, + const vector* events_wait = nullptr, + Event *event = nullptr) + { + cl_int err = CL_INVALID_OPERATION; + cl_event tmp; + + std::call_once(ext_memory_initialized_, initMemoryExtension, this->getInfo()); + + if (pfn_clEnqueueReleaseExternalMemObjectsKHR) + { + err = pfn_clEnqueueReleaseExternalMemObjectsKHR( + object_, + static_cast(mem_objects.size()), + (mem_objects.size() > 0) ? reinterpret_cast(mem_objects.data()) : nullptr, + (events_wait != nullptr) ? static_cast(events_wait->size()) : 0, + (events_wait != nullptr && events_wait->size() > 0) ? reinterpret_cast(events_wait->data()) : nullptr, + &tmp); + } + + detail::errHandler(err, __ENQUEUE_RELEASE_EXTERNAL_MEMORY_ERR); + + if (event != nullptr && err == CL_SUCCESS) + *event = tmp; + + return err; } +#endif // cl_khr_external_memory && CL_HPP_TARGET_OPENCL_VERSION >= 300 + +#ifdef cl_khr_semaphore + cl_int enqueueWaitSemaphores( + const vector &sema_objects, + const vector &sema_payloads = {}, + const vector* events_wait_list = nullptr, + Event *event = nullptr) const; + + cl_int enqueueSignalSemaphores( + const vector &sema_objects, + const vector& sema_payloads = {}, + const vector* events_wait_list = nullptr, + Event* event = nullptr); +#endif // cl_khr_semaphore }; // CommandQueue +#ifdef cl_khr_external_memory +CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag CommandQueue::ext_memory_initialized_; +#endif + CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag CommandQueue::default_initialized_; CL_HPP_DEFINE_STATIC_MEMBER_ CommandQueue CommandQueue::default_; CL_HPP_DEFINE_STATIC_MEMBER_ cl_int CommandQueue::default_error_ = CL_SUCCESS; @@ -8850,7 +9713,7 @@ class DeviceCommandQueue : public detail::Wrapper /*! * Default construct device command queue on default context and device */ - DeviceCommandQueue(DeviceQueueProperties properties, cl_int* err = NULL) + DeviceCommandQueue(DeviceQueueProperties properties, cl_int* err = nullptr) { cl_int error; cl::Context context = cl::Context::getDefault(); @@ -8861,11 +9724,11 @@ class DeviceCommandQueue : public detail::Wrapper cl_queue_properties queue_properties[] = { CL_QUEUE_PROPERTIES, mergedProperties, 0 }; - object_ = ::clCreateCommandQueueWithProperties( + object_ = CL_(clCreateCommandQueueWithProperties)( context(), device(), queue_properties, &error); detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -8877,7 +9740,7 @@ class DeviceCommandQueue : public detail::Wrapper const Context& context, const Device& device, DeviceQueueProperties properties = DeviceQueueProperties::None, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; @@ -8885,11 +9748,11 @@ class DeviceCommandQueue : public detail::Wrapper CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | static_cast(properties); cl_queue_properties queue_properties[] = { CL_QUEUE_PROPERTIES, mergedProperties, 0 }; - object_ = ::clCreateCommandQueueWithProperties( + object_ = CL_(clCreateCommandQueueWithProperties)( context(), device(), queue_properties, &error); detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -8902,7 +9765,7 @@ class DeviceCommandQueue : public detail::Wrapper const Device& device, cl_uint queueSize, DeviceQueueProperties properties = DeviceQueueProperties::None, - cl_int* err = NULL) + cl_int* err = nullptr) { cl_int error; @@ -8910,13 +9773,13 @@ class DeviceCommandQueue : public detail::Wrapper CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | static_cast(properties); cl_queue_properties queue_properties[] = { CL_QUEUE_PROPERTIES, mergedProperties, - CL_QUEUE_SIZE, queueSize, + CL_QUEUE_SIZE, queueSize, 0 }; - object_ = ::clCreateCommandQueueWithProperties( + object_ = CL_(clCreateCommandQueueWithProperties)( context(), device(), queue_properties, &error); detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -8936,51 +9799,23 @@ class DeviceCommandQueue : public detail::Wrapper return *this; } - /*! \brief Copy constructor to forward copy to the superclass correctly. - * Required for MSVC. - */ - DeviceCommandQueue(const DeviceCommandQueue& queue) : detail::Wrapper(queue) {} - - /*! \brief Copy assignment to forward copy to the superclass correctly. - * Required for MSVC. - */ - DeviceCommandQueue& operator = (const DeviceCommandQueue &queue) - { - detail::Wrapper::operator=(queue); - return *this; - } - - /*! \brief Move constructor to forward move to the superclass correctly. - * Required for MSVC. - */ - DeviceCommandQueue(DeviceCommandQueue&& queue) CL_HPP_NOEXCEPT_ : detail::Wrapper(std::move(queue)) {} - - /*! \brief Move assignment to forward move to the superclass correctly. - * Required for MSVC. - */ - DeviceCommandQueue& operator = (DeviceCommandQueue &&queue) - { - detail::Wrapper::operator=(std::move(queue)); - return *this; - } - template cl_int getInfo(cl_command_queue_info name, T* param) const { return detail::errHandler( detail::getInfo( - &::clGetCommandQueueInfo, object_, name, param), + CL_(clGetCommandQueueInfo), object_, name, param), __GET_COMMAND_QUEUE_INFO_ERR); } template typename detail::param_traits::param_type - getInfo(cl_int* err = NULL) const + getInfo(cl_int* err = nullptr) const { typename detail::param_traits< detail::cl_command_queue_info, name>::param_type param; cl_int result = getInfo(name, ¶m); - if (err != NULL) { + if (err != nullptr) { *err = result; } return param; @@ -9005,11 +9840,11 @@ class DeviceCommandQueue : public detail::Wrapper CL_QUEUE_PROPERTIES, properties, 0 }; DeviceCommandQueue deviceQueue( - ::clCreateCommandQueueWithProperties( + CL_(clCreateCommandQueueWithProperties)( context(), device(), queue_properties, &error)); detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } @@ -9033,11 +9868,11 @@ class DeviceCommandQueue : public detail::Wrapper CL_QUEUE_PROPERTIES, properties, 0 }; DeviceCommandQueue deviceQueue( - ::clCreateCommandQueueWithProperties( + CL_(clCreateCommandQueueWithProperties)( context(), device(), queue_properties, &error)); detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } @@ -9045,7 +9880,7 @@ class DeviceCommandQueue : public detail::Wrapper } /*! - * Create a new default device command queue for the specified device + * Create a new default device command queue for the specified device * and of the requested size in bytes. * If there is already a default queue for the specified device this * function will return the pre-existing queue. @@ -9062,11 +9897,11 @@ class DeviceCommandQueue : public detail::Wrapper CL_QUEUE_SIZE, queueSize, 0 }; DeviceCommandQueue deviceQueue( - ::clCreateCommandQueueWithProperties( + CL_(clCreateCommandQueueWithProperties)( context(), device(), queue_properties, &error)); detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } @@ -9085,10 +9920,10 @@ class DeviceCommandQueue : public detail::Wrapper static DeviceCommandQueue updateDefault(const Context &context, const Device &device, const DeviceCommandQueue &default_queue, cl_int *err = nullptr) { cl_int error; - error = clSetDefaultDeviceCommandQueue(context.get(), device.get(), default_queue.get()); + error = CL_(clSetDefaultDeviceCommandQueue)(context.get(), device.get(), default_queue.get()); detail::errHandler(error, __SET_DEFAULT_DEVICE_COMMAND_QUEUE_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } return default_queue; @@ -9097,7 +9932,7 @@ class DeviceCommandQueue : public detail::Wrapper /*! * Return the current default command queue for the specified command queue */ - static DeviceCommandQueue getDefault(const CommandQueue &queue, cl_int * err = NULL) + static DeviceCommandQueue getDefault(const CommandQueue &queue, cl_int * err = nullptr) { return queue.getInfo(err); } @@ -9141,30 +9976,30 @@ Buffer::Buffer( if( useHostPtr ) { flags |= CL_MEM_USE_HOST_PTR; } - + size_type size = sizeof(DataType)*(endIterator - startIterator); if( useHostPtr ) { - object_ = ::clCreateBuffer(context(), flags, size, static_cast(&*startIterator), &error); + object_ = CL_(clCreateBuffer)(context(), flags, size, const_cast(&*startIterator), &error); } else { - object_ = ::clCreateBuffer(context(), flags, size, 0, &error); + object_ = CL_(clCreateBuffer)(context(), flags, size, 0, &error); } detail::errHandler(error, __CREATE_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } if( !useHostPtr ) { CommandQueue queue(context, 0, &error); detail::errHandler(error, __CREATE_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } error = cl::copy(queue, startIterator, endIterator, *this); detail::errHandler(error, __CREATE_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -9198,21 +10033,21 @@ Buffer::Buffer( Context context = queue.getInfo(); if (useHostPtr) { - object_ = ::clCreateBuffer(context(), flags, size, static_cast(&*startIterator), &error); + object_ = CL_(clCreateBuffer)(context(), flags, size, const_cast(&*startIterator), &error); } else { - object_ = ::clCreateBuffer(context(), flags, size, 0, &error); + object_ = CL_(clCreateBuffer)(context(), flags, size, 0, &error); } detail::errHandler(error, __CREATE_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } if (!useHostPtr) { error = cl::copy(queue, startIterator, endIterator, *this); detail::errHandler(error, __CREATE_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } } @@ -9224,8 +10059,8 @@ inline cl_int enqueueReadBuffer( size_type offset, size_type size, void* ptr, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); @@ -9243,8 +10078,8 @@ inline cl_int enqueueWriteBuffer( size_type offset, size_type size, const void* ptr, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); @@ -9262,26 +10097,26 @@ inline void* enqueueMapBuffer( cl_map_flags flags, size_type offset, size_type size, - const vector* events = NULL, - Event* event = NULL, - cl_int* err = NULL) + const vector* events = nullptr, + Event* event = nullptr, + cl_int* err = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } - void * result = ::clEnqueueMapBuffer( + void * result = CL_(clEnqueueMapBuffer)( queue(), buffer(), blocking, flags, offset, size, - (events != NULL) ? (cl_uint) events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL, + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, (cl_event*) event, &error); detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR); - if (err != NULL) { + if (err != nullptr) { *err = error; } return result; @@ -9306,7 +10141,7 @@ inline cl_int enqueueMapSVM( cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); if (error != CL_SUCCESS) { - return detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR); + return detail::errHandler(error, __ENQUEUE_MAP_SVM_ERR); } return queue.enqueueMapSVM( @@ -9314,18 +10149,18 @@ inline cl_int enqueueMapSVM( } /** - * Enqueues to the default queue a command that will allow the host to + * Enqueues to the default queue a command that will allow the host to * update a region of a coarse-grained SVM buffer. * This variant takes a cl::pointer instance. */ template inline cl_int enqueueMapSVM( - cl::pointer ptr, + cl::pointer &ptr, cl_bool blocking, cl_map_flags flags, size_type size, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); @@ -9344,16 +10179,16 @@ inline cl_int enqueueMapSVM( */ template inline cl_int enqueueMapSVM( - cl::vector container, + cl::vector &container, cl_bool blocking, cl_map_flags flags, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); if (error != CL_SUCCESS) { - return detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR); + return detail::errHandler(error, __ENQUEUE_MAP_SVM_ERR); } return queue.enqueueMapSVM( @@ -9365,8 +10200,8 @@ inline cl_int enqueueMapSVM( inline cl_int enqueueUnmapMemObject( const Memory& memory, void* mapped_ptr, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); @@ -9377,14 +10212,14 @@ inline cl_int enqueueUnmapMemObject( cl_event tmp; cl_int err = detail::errHandler( - ::clEnqueueUnmapMemObject( + CL_(clEnqueueUnmapMemObject)( queue(), memory(), mapped_ptr, - (events != NULL) ? (cl_uint)events->size() : 0, - (events != NULL && events->size() > 0) ? (cl_event*)&events->front() : NULL, - (event != NULL) ? &tmp : NULL), + (events != nullptr) ? (cl_uint)events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*)&events->front() : nullptr, + (event != nullptr) ? &tmp : nullptr), __ENQUEUE_UNMAP_MEM_OBJECT_ERR); - if (event != NULL && err == CL_SUCCESS) + if (event != nullptr && err == CL_SUCCESS) *event = tmp; return err; @@ -9392,67 +10227,67 @@ inline cl_int enqueueUnmapMemObject( #if CL_HPP_TARGET_OPENCL_VERSION >= 200 /** - * Enqueues to the default queue a command that will release a coarse-grained + * Enqueues to the default queue a command that will release a coarse-grained * SVM buffer back to the OpenCL runtime. * This variant takes a raw SVM pointer. */ template inline cl_int enqueueUnmapSVM( T* ptr, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); if (error != CL_SUCCESS) { - return detail::errHandler(error, __ENQUEUE_UNMAP_MEM_OBJECT_ERR); + return detail::errHandler(error, __ENQUEUE_UNMAP_SVM_ERR); } - return detail::errHandler(queue.enqueueUnmapSVM(ptr, events, event), - __ENQUEUE_UNMAP_MEM_OBJECT_ERR); + return detail::errHandler(queue.enqueueUnmapSVM(ptr, events, event), + __ENQUEUE_UNMAP_SVM_ERR); } /** - * Enqueues to the default queue a command that will release a coarse-grained + * Enqueues to the default queue a command that will release a coarse-grained * SVM buffer back to the OpenCL runtime. * This variant takes a cl::pointer instance. */ template inline cl_int enqueueUnmapSVM( cl::pointer &ptr, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); if (error != CL_SUCCESS) { - return detail::errHandler(error, __ENQUEUE_UNMAP_MEM_OBJECT_ERR); + return detail::errHandler(error, __ENQUEUE_UNMAP_SVM_ERR); } return detail::errHandler(queue.enqueueUnmapSVM(ptr, events, event), - __ENQUEUE_UNMAP_MEM_OBJECT_ERR); + __ENQUEUE_UNMAP_SVM_ERR); } /** - * Enqueues to the default queue a command that will release a coarse-grained + * Enqueues to the default queue a command that will release a coarse-grained * SVM buffer back to the OpenCL runtime. * This variant takes a cl::vector instance. */ template inline cl_int enqueueUnmapSVM( cl::vector &container, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); if (error != CL_SUCCESS) { - return detail::errHandler(error, __ENQUEUE_UNMAP_MEM_OBJECT_ERR); + return detail::errHandler(error, __ENQUEUE_UNMAP_SVM_ERR); } return detail::errHandler(queue.enqueueUnmapSVM(container, events, event), - __ENQUEUE_UNMAP_MEM_OBJECT_ERR); + __ENQUEUE_UNMAP_SVM_ERR); } #endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200 @@ -9463,8 +10298,8 @@ inline cl_int enqueueCopyBuffer( size_type src_offset, size_type dst_offset, size_type size, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); @@ -9518,17 +10353,17 @@ inline cl_int copy( const CommandQueue &queue, IteratorType startIterator, Itera { typedef typename std::iterator_traits::value_type DataType; cl_int error; - + size_type length = endIterator-startIterator; size_type byteLength = length*sizeof(DataType); - DataType *pointer = + DataType *pointer = static_cast(queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_WRITE, 0, byteLength, 0, 0, &error)); // if exceptions enabled, enqueueMapBuffer will throw if( error != CL_SUCCESS ) { return error; } -#if defined(_MSC_VER) +#if defined(_MSC_VER) && _MSC_VER < 1920 std::copy( startIterator, endIterator, @@ -9536,11 +10371,11 @@ inline cl_int copy( const CommandQueue &queue, IteratorType startIterator, Itera pointer, length)); #else std::copy(startIterator, endIterator, pointer); -#endif +#endif // defined(_MSC_VER) && _MSC_VER < 1920 Event endEvent; error = queue.enqueueUnmapMemObject(buffer, pointer, 0, &endEvent); // if exceptions enabled, enqueueUnmapMemObject will throw - if( error != CL_SUCCESS ) { + if( error != CL_SUCCESS ) { return error; } endEvent.wait(); @@ -9557,11 +10392,11 @@ inline cl_int copy( const CommandQueue &queue, const cl::Buffer &buffer, Iterato { typedef typename std::iterator_traits::value_type DataType; cl_int error; - + size_type length = endIterator-startIterator; size_type byteLength = length*sizeof(DataType); - DataType *pointer = + DataType *pointer = static_cast(queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_READ, 0, byteLength, 0, 0, &error)); // if exceptions enabled, enqueueMapBuffer will throw if( error != CL_SUCCESS ) { @@ -9571,7 +10406,7 @@ inline cl_int copy( const CommandQueue &queue, const cl::Buffer &buffer, Iterato Event endEvent; error = queue.enqueueUnmapMemObject(buffer, pointer, 0, &endEvent); // if exceptions enabled, enqueueUnmapMemObject will throw - if( error != CL_SUCCESS ) { + if( error != CL_SUCCESS ) { return error; } endEvent.wait(); @@ -9612,8 +10447,8 @@ inline cl_int enqueueReadBufferRect( size_type host_row_pitch, size_type host_slice_pitch, void *ptr, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); @@ -9623,15 +10458,44 @@ inline cl_int enqueueReadBufferRect( } return queue.enqueueReadBufferRect( - buffer, - blocking, - buffer_offset, + buffer, + blocking, + buffer_offset, host_offset, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, + ptr, + events, + event); +} + +inline cl_int enqueueReadBufferRect( + const Buffer& buffer, + cl_bool blocking, + const array& buffer_offset, + const array& host_offset, + const array& region, + size_type buffer_row_pitch, + size_type buffer_slice_pitch, + size_type host_row_pitch, + size_type host_slice_pitch, + void* ptr, + const vector* events = nullptr, + Event* event = nullptr) +{ + return enqueueReadBufferRect( + buffer, + blocking, + { buffer_offset[0], buffer_offset[1], 0 }, + { host_offset[0], host_offset[1], 0 }, + { region[0], region[1], 1 }, + buffer_row_pitch, + buffer_slice_pitch, + host_row_pitch, + host_slice_pitch, ptr, events, event); @@ -9648,8 +10512,8 @@ inline cl_int enqueueWriteBufferRect( size_type host_row_pitch, size_type host_slice_pitch, const void *ptr, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); @@ -9659,15 +10523,44 @@ inline cl_int enqueueWriteBufferRect( } return queue.enqueueWriteBufferRect( - buffer, - blocking, - buffer_offset, + buffer, + blocking, + buffer_offset, host_offset, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, + ptr, + events, + event); +} + +inline cl_int enqueueWriteBufferRect( + const Buffer& buffer, + cl_bool blocking, + const array& buffer_offset, + const array& host_offset, + const array& region, + size_type buffer_row_pitch, + size_type buffer_slice_pitch, + size_type host_row_pitch, + size_type host_slice_pitch, + const void* ptr, + const vector* events = nullptr, + Event* event = nullptr) +{ + return enqueueWriteBufferRect( + buffer, + blocking, + { buffer_offset[0], buffer_offset[1], 0 }, + { host_offset[0], host_offset[1], 0 }, + { region[0], region[1], 1 }, + buffer_row_pitch, + buffer_slice_pitch, + host_row_pitch, + host_slice_pitch, ptr, events, event); @@ -9683,8 +10576,8 @@ inline cl_int enqueueCopyBufferRect( size_type src_slice_pitch, size_type dst_row_pitch, size_type dst_slice_pitch, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); @@ -9703,6 +10596,33 @@ inline cl_int enqueueCopyBufferRect( src_slice_pitch, dst_row_pitch, dst_slice_pitch, + events, + event); +} + +inline cl_int enqueueCopyBufferRect( + const Buffer& src, + const Buffer& dst, + const array& src_origin, + const array& dst_origin, + const array& region, + size_type src_row_pitch, + size_type src_slice_pitch, + size_type dst_row_pitch, + size_type dst_slice_pitch, + const vector* events = nullptr, + Event* event = nullptr) +{ + return enqueueCopyBufferRect( + src, + dst, + { src_origin[0], src_origin[1], 0 }, + { dst_origin[0], dst_origin[1], 0 }, + { region[0], region[1], 1 }, + src_row_pitch, + src_slice_pitch, + dst_row_pitch, + dst_slice_pitch, events, event); } @@ -9716,8 +10636,8 @@ inline cl_int enqueueReadImage( size_type row_pitch, size_type slice_pitch, void* ptr, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); @@ -9734,6 +10654,29 @@ inline cl_int enqueueReadImage( row_pitch, slice_pitch, ptr, + events, + event); +} + +inline cl_int enqueueReadImage( + const Image& image, + cl_bool blocking, + const array& origin, + const array& region, + size_type row_pitch, + size_type slice_pitch, + void* ptr, + const vector* events = nullptr, + Event* event = nullptr) +{ + return enqueueReadImage( + image, + blocking, + { origin[0], origin[1], 0 }, + { region[0], region[1], 1 }, + row_pitch, + slice_pitch, + ptr, events, event); } @@ -9746,8 +10689,8 @@ inline cl_int enqueueWriteImage( size_type row_pitch, size_type slice_pitch, const void* ptr, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); @@ -9764,18 +10707,41 @@ inline cl_int enqueueWriteImage( row_pitch, slice_pitch, ptr, - events, + events, event); } +inline cl_int enqueueWriteImage( + const Image& image, + cl_bool blocking, + const array& origin, + const array& region, + size_type row_pitch, + size_type slice_pitch, + const void* ptr, + const vector* events = nullptr, + Event* event = nullptr) +{ + return enqueueWriteImage( + image, + blocking, + { origin[0], origin[1], 0 }, + { region[0], region[1], 1 }, + row_pitch, + slice_pitch, + ptr, + events, + event); +} + inline cl_int enqueueCopyImage( const Image& src, const Image& dst, const array& src_origin, const array& dst_origin, const array& region, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); @@ -9794,14 +10760,33 @@ inline cl_int enqueueCopyImage( event); } +inline cl_int enqueueCopyImage( + const Image& src, + const Image& dst, + const array& src_origin, + const array& dst_origin, + const array& region, + const vector* events = nullptr, + Event* event = nullptr) +{ + return enqueueCopyImage( + src, + dst, + { src_origin[0], src_origin[1], 0 }, + { dst_origin[0], dst_origin[1], 0 }, + { region[0], region[1], 1 }, + events, + event); +} + inline cl_int enqueueCopyImageToBuffer( const Image& src, const Buffer& dst, const array& src_origin, const array& region, size_type dst_offset, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); @@ -9820,14 +10805,33 @@ inline cl_int enqueueCopyImageToBuffer( event); } +inline cl_int enqueueCopyImageToBuffer( + const Image& src, + const Buffer& dst, + const array& src_origin, + const array& region, + size_type dst_offset, + const vector* events = nullptr, + Event* event = nullptr) +{ + return enqueueCopyImageToBuffer( + src, + dst, + { src_origin[0], src_origin[1], 0 }, + { region[0], region[1], 1 }, + dst_offset, + events, + event); +} + inline cl_int enqueueCopyBufferToImage( const Buffer& src, const Image& dst, size_type src_offset, const array& dst_origin, const array& region, - const vector* events = NULL, - Event* event = NULL) + const vector* events = nullptr, + Event* event = nullptr) { cl_int error; CommandQueue queue = CommandQueue::getDefault(&error); @@ -9846,6 +10850,31 @@ inline cl_int enqueueCopyBufferToImage( event); } +inline cl_int enqueueCopyBufferToImage( + const Buffer& src, + const Image& dst, + size_type src_offset, + const array& dst_origin, + const array& region, + const vector* events = nullptr, + Event* event = nullptr) +{ + cl_int error; + CommandQueue queue = CommandQueue::getDefault(&error); + + if (error != CL_SUCCESS) { + return error; + } + + return enqueueCopyBufferToImage( + src, + dst, + src_offset, + { dst_origin[0], dst_origin[1], 0 }, + { region[0], region[1], 1 }, + events, + event); +} inline cl_int flush(void) { @@ -9866,7 +10895,7 @@ inline cl_int finish(void) if (error != CL_SUCCESS) { return error; - } + } return queue.finish(); @@ -9885,63 +10914,63 @@ class EnqueueArgs friend class KernelFunctor; public: - EnqueueArgs(NDRange global) : + EnqueueArgs(NDRange global) : queue_(CommandQueue::getDefault()), - offset_(NullRange), + offset_(NullRange), global_(global), local_(NullRange) { } - EnqueueArgs(NDRange global, NDRange local) : + EnqueueArgs(NDRange global, NDRange local) : queue_(CommandQueue::getDefault()), - offset_(NullRange), + offset_(NullRange), global_(global), local_(local) { } - EnqueueArgs(NDRange offset, NDRange global, NDRange local) : + EnqueueArgs(NDRange offset, NDRange global, NDRange local) : queue_(CommandQueue::getDefault()), - offset_(offset), + offset_(offset), global_(global), local_(local) { } - EnqueueArgs(Event e, NDRange global) : + EnqueueArgs(Event e, NDRange global) : queue_(CommandQueue::getDefault()), - offset_(NullRange), + offset_(NullRange), global_(global), local_(NullRange) { events_.push_back(e); } - EnqueueArgs(Event e, NDRange global, NDRange local) : + EnqueueArgs(Event e, NDRange global, NDRange local) : queue_(CommandQueue::getDefault()), - offset_(NullRange), + offset_(NullRange), global_(global), local_(local) { events_.push_back(e); } - EnqueueArgs(Event e, NDRange offset, NDRange global, NDRange local) : + EnqueueArgs(Event e, NDRange offset, NDRange global, NDRange local) : queue_(CommandQueue::getDefault()), - offset_(offset), + offset_(offset), global_(global), local_(local) { events_.push_back(e); } - EnqueueArgs(const vector &events, NDRange global) : + EnqueueArgs(const vector &events, NDRange global) : queue_(CommandQueue::getDefault()), - offset_(NullRange), + offset_(NullRange), global_(global), local_(NullRange), events_(events) @@ -9949,9 +10978,9 @@ class EnqueueArgs } - EnqueueArgs(const vector &events, NDRange global, NDRange local) : + EnqueueArgs(const vector &events, NDRange global, NDRange local) : queue_(CommandQueue::getDefault()), - offset_(NullRange), + offset_(NullRange), global_(global), local_(local), events_(events) @@ -9959,9 +10988,9 @@ class EnqueueArgs } - EnqueueArgs(const vector &events, NDRange offset, NDRange global, NDRange local) : + EnqueueArgs(const vector &events, NDRange offset, NDRange global, NDRange local) : queue_(CommandQueue::getDefault()), - offset_(offset), + offset_(offset), global_(global), local_(local), events_(events) @@ -9969,63 +10998,63 @@ class EnqueueArgs } - EnqueueArgs(CommandQueue &queue, NDRange global) : + EnqueueArgs(CommandQueue &queue, NDRange global) : queue_(queue), - offset_(NullRange), + offset_(NullRange), global_(global), local_(NullRange) { } - EnqueueArgs(CommandQueue &queue, NDRange global, NDRange local) : + EnqueueArgs(CommandQueue &queue, NDRange global, NDRange local) : queue_(queue), - offset_(NullRange), + offset_(NullRange), global_(global), local_(local) { } - EnqueueArgs(CommandQueue &queue, NDRange offset, NDRange global, NDRange local) : + EnqueueArgs(CommandQueue &queue, NDRange offset, NDRange global, NDRange local) : queue_(queue), - offset_(offset), + offset_(offset), global_(global), local_(local) { } - EnqueueArgs(CommandQueue &queue, Event e, NDRange global) : + EnqueueArgs(CommandQueue &queue, Event e, NDRange global) : queue_(queue), - offset_(NullRange), + offset_(NullRange), global_(global), local_(NullRange) { events_.push_back(e); } - EnqueueArgs(CommandQueue &queue, Event e, NDRange global, NDRange local) : + EnqueueArgs(CommandQueue &queue, Event e, NDRange global, NDRange local) : queue_(queue), - offset_(NullRange), + offset_(NullRange), global_(global), local_(local) { events_.push_back(e); } - EnqueueArgs(CommandQueue &queue, Event e, NDRange offset, NDRange global, NDRange local) : + EnqueueArgs(CommandQueue &queue, Event e, NDRange offset, NDRange global, NDRange local) : queue_(queue), - offset_(offset), + offset_(offset), global_(global), local_(local) { events_.push_back(e); } - EnqueueArgs(CommandQueue &queue, const vector &events, NDRange global) : + EnqueueArgs(CommandQueue &queue, const vector &events, NDRange global) : queue_(queue), - offset_(NullRange), + offset_(NullRange), global_(global), local_(NullRange), events_(events) @@ -10033,9 +11062,9 @@ class EnqueueArgs } - EnqueueArgs(CommandQueue &queue, const vector &events, NDRange global, NDRange local) : + EnqueueArgs(CommandQueue &queue, const vector &events, NDRange global, NDRange local) : queue_(queue), - offset_(NullRange), + offset_(NullRange), global_(global), local_(local), events_(events) @@ -10043,9 +11072,9 @@ class EnqueueArgs } - EnqueueArgs(CommandQueue &queue, const vector &events, NDRange offset, NDRange global, NDRange local) : + EnqueueArgs(CommandQueue &queue, const vector &events, NDRange offset, NDRange global, NDRange local) : queue_(queue), - offset_(offset), + offset_(offset), global_(global), local_(local), events_(events) @@ -10060,7 +11089,7 @@ class EnqueueArgs /** * Type safe kernel functor. - * + * */ template class KernelFunctor @@ -10094,7 +11123,7 @@ class KernelFunctor KernelFunctor( const Program& program, const string name, - cl_int * err = NULL) : + cl_int * err = nullptr) : kernel_(program, name.c_str(), err) {} @@ -10112,7 +11141,7 @@ class KernelFunctor { Event event; setArgs<0>(std::forward(ts)...); - + args.queue_.enqueueNDRangeKernel( kernel_, args.offset_, @@ -10145,7 +11174,7 @@ class KernelFunctor args.local_, &args.events_, &event); - + return event; } @@ -10183,7 +11212,7 @@ namespace compatibility { make_kernel( const Program& program, const string name, - cl_int * err = NULL) : + cl_int * err = nullptr) : functor_(FunctorType(program, name, err)) {} @@ -10210,120 +11239,987 @@ namespace compatibility { }; } // namespace compatibility +#ifdef cl_khr_semaphore + +#ifdef cl_khr_external_semaphore +enum ExternalSemaphoreType : cl_external_semaphore_handle_type_khr +{ + None = 0, +#ifdef cl_khr_external_semaphore_opaque_fd + OpaqueFd = CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR, +#endif // cl_khr_external_semaphore_opaque_fd +#ifdef cl_khr_external_semaphore_sync_fd + SyncFd = CL_SEMAPHORE_HANDLE_SYNC_FD_KHR, +#endif // cl_khr_external_semaphore_sync_fd +#ifdef cl_khr_external_semaphore_win32 + OpaqueWin32 = CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR, + OpaqueWin32Kmt = CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR, +#endif // cl_khr_external_semaphore_win32 +}; +#endif // cl_khr_external_semaphore + +class Semaphore : public detail::Wrapper +{ +public: + Semaphore() : detail::Wrapper() {} + Semaphore( + const Context &context, + const vector& sema_props, + cl_int *err = nullptr) + { + /* initialization of addresses to extension functions (it is done only once) */ + std::call_once(ext_init_, initExtensions, context); + + cl_int error = CL_INVALID_OPERATION; + + if (pfn_clCreateSemaphoreWithPropertiesKHR) + { + object_ = pfn_clCreateSemaphoreWithPropertiesKHR( + context(), + sema_props.data(), + &error); + } + + detail::errHandler(error, __CREATE_SEMAPHORE_KHR_WITH_PROPERTIES_ERR); + if (err != nullptr) { + *err = error; + } + } + Semaphore( + const vector& sema_props, + cl_int* err = nullptr):Semaphore(Context::getDefault(err), sema_props, err) {} + + explicit Semaphore(const cl_semaphore_khr& semaphore, bool retainObject = false) : + detail::Wrapper(semaphore, retainObject) {} + Semaphore& operator = (const cl_semaphore_khr& rhs) { + detail::Wrapper::operator=(rhs); + return *this; + } + template + cl_int getInfo(cl_semaphore_info_khr name, T* param) const + { + if (pfn_clGetSemaphoreInfoKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __GET_SEMAPHORE_KHR_INFO_ERR); + } + + return detail::errHandler( + detail::getInfo(pfn_clGetSemaphoreInfoKHR, object_, name, param), + __GET_SEMAPHORE_KHR_INFO_ERR); + } + template typename + detail::param_traits::param_type + getInfo(cl_int* err = nullptr) const + { + typename detail::param_traits< + detail::cl_semaphore_info_khr, name>::param_type param; + cl_int result = getInfo(name, ¶m); + if (err != nullptr) { + *err = result; + } + return param; + } + +#ifdef cl_khr_external_semaphore + template + cl_int getHandleForTypeKHR( + const Device& device, cl_external_semaphore_handle_type_khr name, T* param) const + { + if (pfn_clGetSemaphoreHandleForTypeKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __GET_SEMAPHORE_HANDLE_FOR_TYPE_KHR_ERR); + } + + return detail::errHandler( + detail::getInfo( + pfn_clGetSemaphoreHandleForTypeKHR, object_, device(), name, param), + __GET_SEMAPHORE_HANDLE_FOR_TYPE_KHR_ERR); + } + + template typename + detail::param_traits::param_type + getHandleForTypeKHR(const Device& device, cl_int* err = nullptr) const + { + typename detail::param_traits< + detail::cl_external_semaphore_handle_type_khr, type>::param_type param; + cl_int result = getHandleForTypeKHR(device, type, ¶m); + if (err != nullptr) { + *err = result; + } + return param; + } +#endif // cl_khr_external_semaphore + + cl_int retain() + { + if (pfn_clRetainSemaphoreKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __RETAIN_SEMAPHORE_KHR_ERR); + } + return pfn_clRetainSemaphoreKHR(object_); + } + + cl_int release() + { + if (pfn_clReleaseSemaphoreKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __RELEASE_SEMAPHORE_KHR_ERR); + } + return pfn_clReleaseSemaphoreKHR(object_); + } + +private: + static std::once_flag ext_init_; + + static void initExtensions(const Context& context) + { +#if CL_HPP_TARGET_OPENCL_VERSION >= 120 + Device device = context.getInfo().at(0); + cl_platform_id platform = device.getInfo()(); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCreateSemaphoreWithPropertiesKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clReleaseSemaphoreKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clRetainSemaphoreKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clEnqueueWaitSemaphoresKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clEnqueueSignalSemaphoresKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clGetSemaphoreInfoKHR); +#ifdef cl_khr_external_semaphore + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clGetSemaphoreHandleForTypeKHR); +#endif // cl_khr_external_semaphore + +#else + CL_HPP_INIT_CL_EXT_FCN_PTR_(clCreateSemaphoreWithPropertiesKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clReleaseSemaphoreKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clRetainSemaphoreKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clEnqueueWaitSemaphoresKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clEnqueueSignalSemaphoresKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clGetSemaphoreInfoKHR); +#ifdef cl_khr_external_semaphore + CL_HPP_INIT_CL_EXT_FCN_PTR_(clGetSemaphoreHandleForTypeKHR); +#endif // cl_khr_external_semaphore + +#endif + if ((pfn_clCreateSemaphoreWithPropertiesKHR == nullptr) && + (pfn_clReleaseSemaphoreKHR == nullptr) && + (pfn_clRetainSemaphoreKHR == nullptr) && + (pfn_clEnqueueWaitSemaphoresKHR == nullptr) && + (pfn_clEnqueueSignalSemaphoresKHR == nullptr) && +#ifdef cl_khr_external_semaphore + (pfn_clGetSemaphoreHandleForTypeKHR == nullptr) && +#endif // cl_khr_external_semaphore + (pfn_clGetSemaphoreInfoKHR == nullptr)) + { + detail::errHandler(CL_INVALID_VALUE, __CREATE_SEMAPHORE_KHR_WITH_PROPERTIES_ERR); + } + } + +}; + +CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag Semaphore::ext_init_; + +inline cl_int CommandQueue::enqueueWaitSemaphores( + const vector &sema_objects, + const vector &sema_payloads, + const vector* events_wait_list, + Event *event) const +{ + cl_event tmp; + cl_int err = CL_INVALID_OPERATION; + + if (pfn_clEnqueueWaitSemaphoresKHR != nullptr) { + err = pfn_clEnqueueWaitSemaphoresKHR( + object_, + (cl_uint)sema_objects.size(), + (const cl_semaphore_khr *) &sema_objects.front(), + (sema_payloads.size() > 0) ? &sema_payloads.front() : nullptr, + (events_wait_list != nullptr) ? (cl_uint) events_wait_list->size() : 0, + (events_wait_list != nullptr && events_wait_list->size() > 0) ? (const cl_event*) &events_wait_list->front() : nullptr, + (event != nullptr) ? &tmp : nullptr); + } + + detail::errHandler(err, __ENQUEUE_WAIT_SEMAPHORE_KHR_ERR); + + if (event != nullptr && err == CL_SUCCESS) + *event = tmp; + + return err; +} + +inline cl_int CommandQueue::enqueueSignalSemaphores( + const vector &sema_objects, + const vector& sema_payloads, + const vector* events_wait_list, + Event* event) +{ + cl_event tmp; + cl_int err = CL_INVALID_OPERATION; + + if (pfn_clEnqueueSignalSemaphoresKHR != nullptr) { + err = pfn_clEnqueueSignalSemaphoresKHR( + object_, + (cl_uint)sema_objects.size(), + (const cl_semaphore_khr*) &sema_objects.front(), + (sema_payloads.size() > 0) ? &sema_payloads.front() : nullptr, + (events_wait_list != nullptr) ? (cl_uint) events_wait_list->size() : 0, + (events_wait_list != nullptr && events_wait_list->size() > 0) ? (const cl_event*) &events_wait_list->front() : nullptr, + (event != nullptr) ? &tmp : nullptr); + } + + detail::errHandler(err, __ENQUEUE_SIGNAL_SEMAPHORE_KHR_ERR); + + if (event != nullptr && err == CL_SUCCESS) + *event = tmp; + + return err; +} + +#endif // cl_khr_semaphore + +#if defined(cl_khr_command_buffer) +/*! \class CommandBufferKhr + * \brief CommandBufferKhr interface for cl_command_buffer_khr. + */ +class CommandBufferKhr : public detail::Wrapper +{ +public: + //! \brief Default constructor - initializes to nullptr. + CommandBufferKhr() : detail::Wrapper() { } + + explicit CommandBufferKhr(const vector &queues, + cl_command_buffer_properties_khr properties = 0, + cl_int* errcode_ret = nullptr) + { + cl_command_buffer_properties_khr command_buffer_properties[] = { + CL_COMMAND_BUFFER_FLAGS_KHR, properties, 0 + }; + + /* initialization of addresses to extension functions (it is done only once) */ + std::call_once(ext_init_, [&] { initExtensions(queues[0].getInfo()); }); + cl_int error = CL_INVALID_OPERATION; + + static_assert(sizeof(cl::CommandQueue) == sizeof(cl_command_queue), + "Size of cl::CommandQueue must be equal to size of cl_command_queue"); + + if (pfn_clCreateCommandBufferKHR) + { + object_ = pfn_clCreateCommandBufferKHR((cl_uint) queues.size(), + (const cl_command_queue *) &queues.front(), + command_buffer_properties, + &error); + } + + detail::errHandler(error, __CREATE_COMMAND_BUFFER_KHR_ERR); + if (errcode_ret != nullptr) { + *errcode_ret = error; + } + } + + explicit CommandBufferKhr(const cl_command_buffer_khr& commandBufferKhr, bool retainObject = false) : + detail::Wrapper(commandBufferKhr, retainObject) { } + + CommandBufferKhr& operator=(const cl_command_buffer_khr& rhs) + { + detail::Wrapper::operator=(rhs); + return *this; + } + + template + cl_int getInfo(cl_command_buffer_info_khr name, T* param) const + { + if (pfn_clGetCommandBufferInfoKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __GET_COMMAND_BUFFER_INFO_KHR_ERR); + } + return detail::errHandler( + detail::getInfo(pfn_clGetCommandBufferInfoKHR, object_, name, param), + __GET_COMMAND_BUFFER_INFO_KHR_ERR); + } + + template typename + detail::param_traits::param_type + getInfo(cl_int* err = nullptr) const + { + typename detail::param_traits< + detail::cl_command_buffer_info_khr, name>::param_type param; + cl_int result = getInfo(name, ¶m); + if (err != nullptr) { + *err = result; + } + return param; + } + + cl_int finalizeCommandBuffer() const + { + if (pfn_clFinalizeCommandBufferKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, __FINALIZE_COMMAND_BUFFER_KHR_ERR); + } + return detail::errHandler(pfn_clFinalizeCommandBufferKHR(object_), __FINALIZE_COMMAND_BUFFER_KHR_ERR); + } + + cl_int enqueueCommandBuffer(vector &queues, + const vector* events = nullptr, + Event* event = nullptr) + { + if (pfn_clEnqueueCommandBufferKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __ENQUEUE_COMMAND_BUFFER_KHR_ERR); + } + + static_assert(sizeof(cl::CommandQueue) == sizeof(cl_command_queue), + "Size of cl::CommandQueue must be equal to size of cl_command_queue"); + + return detail::errHandler(pfn_clEnqueueCommandBufferKHR((cl_uint) queues.size(), + (cl_command_queue *) &queues.front(), + object_, + (events != nullptr) ? (cl_uint) events->size() : 0, + (events != nullptr && events->size() > 0) ? (const cl_event*) &events->front() : nullptr, + (cl_event*) event), + __ENQUEUE_COMMAND_BUFFER_KHR_ERR); + } + + cl_int commandBarrierWithWaitList(const vector* sync_points_vec = nullptr, + cl_sync_point_khr* sync_point = nullptr, + MutableCommandKhr* mutable_handle = nullptr, + const CommandQueue* command_queue = nullptr) + { + if (pfn_clCommandBarrierWithWaitListKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __COMMAND_BARRIER_WITH_WAIT_LIST_KHR_ERR); + } + + cl_sync_point_khr tmp_sync_point; + cl_int error = detail::errHandler( + pfn_clCommandBarrierWithWaitListKHR(object_, + (command_queue != nullptr) ? (*command_queue)() : nullptr, +#if CL_KHR_COMMAND_BUFFER_EXTENSION_VERSION > CL_MAKE_VERSION(0, 9, 4) + nullptr, // Properties +#endif + (sync_points_vec != nullptr) ? (cl_uint) sync_points_vec->size() : 0, + (sync_points_vec != nullptr && sync_points_vec->size() > 0) ? &sync_points_vec->front() : nullptr, + (sync_point != nullptr) ? &tmp_sync_point : nullptr, + (cl_mutable_command_khr*) mutable_handle), + __COMMAND_BARRIER_WITH_WAIT_LIST_KHR_ERR); + + if (sync_point != nullptr && error == CL_SUCCESS) + *sync_point = tmp_sync_point; + + return error; + } + + cl_int commandCopyBuffer(const Buffer& src, + const Buffer& dst, + size_type src_offset, + size_type dst_offset, + size_type size, + const vector* sync_points_vec = nullptr, + cl_sync_point_khr* sync_point = nullptr, + MutableCommandKhr* mutable_handle = nullptr, + const CommandQueue* command_queue = nullptr) + { + if (pfn_clCommandCopyBufferKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __COMMAND_COPY_BUFFER_KHR_ERR); + } + + cl_sync_point_khr tmp_sync_point; + cl_int error = detail::errHandler( + pfn_clCommandCopyBufferKHR(object_, + (command_queue != nullptr) ? (*command_queue)() : nullptr, +#if CL_KHR_COMMAND_BUFFER_EXTENSION_VERSION > CL_MAKE_VERSION(0, 9, 4) + nullptr, // Properties +#endif + src(), + dst(), + src_offset, + dst_offset, + size, + (sync_points_vec != nullptr) ? (cl_uint) sync_points_vec->size() : 0, + (sync_points_vec != nullptr && sync_points_vec->size() > 0) ? &sync_points_vec->front() : nullptr, + (sync_point != nullptr) ? &tmp_sync_point : nullptr, + (cl_mutable_command_khr*) mutable_handle), + __COMMAND_COPY_BUFFER_KHR_ERR); + + if (sync_point != nullptr && error == CL_SUCCESS) + *sync_point = tmp_sync_point; + + return error; + } + + cl_int commandCopyBufferRect(const Buffer& src, + const Buffer& dst, + const array& src_origin, + const array& dst_origin, + const array& region, + size_type src_row_pitch, + size_type src_slice_pitch, + size_type dst_row_pitch, + size_type dst_slice_pitch, + const vector* sync_points_vec = nullptr, + cl_sync_point_khr* sync_point = nullptr, + MutableCommandKhr* mutable_handle = nullptr, + const CommandQueue* command_queue = nullptr) + { + if (pfn_clCommandCopyBufferRectKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __COMMAND_COPY_BUFFER_RECT_KHR_ERR); + } + + cl_sync_point_khr tmp_sync_point; + cl_int error = detail::errHandler( + pfn_clCommandCopyBufferRectKHR(object_, + (command_queue != nullptr) ? (*command_queue)() : nullptr, +#if CL_KHR_COMMAND_BUFFER_EXTENSION_VERSION > CL_MAKE_VERSION(0, 9, 4) + nullptr, // Properties +#endif + src(), + dst(), + src_origin.data(), + dst_origin.data(), + region.data(), + src_row_pitch, + src_slice_pitch, + dst_row_pitch, + dst_slice_pitch, + (sync_points_vec != nullptr) ? (cl_uint) sync_points_vec->size() : 0, + (sync_points_vec != nullptr && sync_points_vec->size() > 0) ? &sync_points_vec->front() : nullptr, + (sync_point != nullptr) ? &tmp_sync_point : nullptr, + (cl_mutable_command_khr*) mutable_handle), + __COMMAND_COPY_BUFFER_RECT_KHR_ERR); + + if (sync_point != nullptr && error == CL_SUCCESS) + *sync_point = tmp_sync_point; + + return error; + } + + cl_int commandCopyBufferToImage(const Buffer& src, + const Image& dst, + size_type src_offset, + const array& dst_origin, + const array& region, + const vector* sync_points_vec = nullptr, + cl_sync_point_khr* sync_point = nullptr, + MutableCommandKhr* mutable_handle = nullptr, + const CommandQueue* command_queue = nullptr) + { + if (pfn_clCommandCopyBufferToImageKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __COMMAND_COPY_BUFFER_TO_IMAGE_KHR_ERR); + } + + cl_sync_point_khr tmp_sync_point; + cl_int error = detail::errHandler( + pfn_clCommandCopyBufferToImageKHR(object_, + (command_queue != nullptr) ? (*command_queue)() : nullptr, +#if CL_KHR_COMMAND_BUFFER_EXTENSION_VERSION > CL_MAKE_VERSION(0, 9, 4) + nullptr, // Properties +#endif + src(), + dst(), + src_offset, + dst_origin.data(), + region.data(), + (sync_points_vec != nullptr) ? (cl_uint) sync_points_vec->size() : 0, + (sync_points_vec != nullptr && sync_points_vec->size() > 0) ? &sync_points_vec->front() : nullptr, + (sync_point != nullptr) ? &tmp_sync_point : nullptr, + (cl_mutable_command_khr*) mutable_handle), + __COMMAND_COPY_BUFFER_TO_IMAGE_KHR_ERR); + + if (sync_point != nullptr && error == CL_SUCCESS) + *sync_point = tmp_sync_point; + + return error; + } + + cl_int commandCopyImage(const Image& src, + const Image& dst, + const array& src_origin, + const array& dst_origin, + const array& region, + const vector* sync_points_vec = nullptr, + cl_sync_point_khr* sync_point = nullptr, + MutableCommandKhr* mutable_handle = nullptr, + const CommandQueue* command_queue = nullptr) + { + if (pfn_clCommandCopyImageKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __COMMAND_COPY_IMAGE_KHR_ERR); + } + + cl_sync_point_khr tmp_sync_point; + cl_int error = detail::errHandler( + pfn_clCommandCopyImageKHR(object_, + (command_queue != nullptr) ? (*command_queue)() : nullptr, +#if CL_KHR_COMMAND_BUFFER_EXTENSION_VERSION > CL_MAKE_VERSION(0, 9, 4) + nullptr, // Properties +#endif + src(), + dst(), + src_origin.data(), + dst_origin.data(), + region.data(), + (sync_points_vec != nullptr) ? (cl_uint) sync_points_vec->size() : 0, + (sync_points_vec != nullptr && sync_points_vec->size() > 0) ? &sync_points_vec->front() : nullptr, + (sync_point != nullptr) ? &tmp_sync_point : nullptr, + (cl_mutable_command_khr*) mutable_handle), + __COMMAND_COPY_IMAGE_KHR_ERR); + + if (sync_point != nullptr && error == CL_SUCCESS) + *sync_point = tmp_sync_point; + + return error; + } + + cl_int commandCopyImageToBuffer(const Image& src, + const Buffer& dst, + const array& src_origin, + const array& region, + size_type dst_offset, + const vector* sync_points_vec = nullptr, + cl_sync_point_khr* sync_point = nullptr, + MutableCommandKhr* mutable_handle = nullptr, + const CommandQueue* command_queue = nullptr) + { + if (pfn_clCommandCopyImageToBufferKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __COMMAND_COPY_IMAGE_TO_BUFFER_KHR_ERR); + } + + cl_sync_point_khr tmp_sync_point; + cl_int error = detail::errHandler( + pfn_clCommandCopyImageToBufferKHR(object_, + (command_queue != nullptr) ? (*command_queue)() : nullptr, +#if CL_KHR_COMMAND_BUFFER_EXTENSION_VERSION > CL_MAKE_VERSION(0, 9, 4) + nullptr, // Properties +#endif + src(), + dst(), + src_origin.data(), + region.data(), + dst_offset, + (sync_points_vec != nullptr) ? (cl_uint) sync_points_vec->size() : 0, + (sync_points_vec != nullptr && sync_points_vec->size() > 0) ? &sync_points_vec->front() : nullptr, + (sync_point != nullptr) ? &tmp_sync_point : nullptr, + (cl_mutable_command_khr*) mutable_handle), + __COMMAND_COPY_IMAGE_TO_BUFFER_KHR_ERR); + + if (sync_point != nullptr && error == CL_SUCCESS) + *sync_point = tmp_sync_point; + + return error; + } + + template + cl_int commandFillBuffer(const Buffer& buffer, + PatternType pattern, + size_type offset, + size_type size, + const vector* sync_points_vec = nullptr, + cl_sync_point_khr* sync_point = nullptr, + MutableCommandKhr* mutable_handle = nullptr, + const CommandQueue* command_queue = nullptr) + { + if (pfn_clCommandFillBufferKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __COMMAND_FILL_BUFFER_KHR_ERR); + } + + cl_sync_point_khr tmp_sync_point; + cl_int error = detail::errHandler( + pfn_clCommandFillBufferKHR(object_, + (command_queue != nullptr) ? (*command_queue)() : nullptr, +#if CL_KHR_COMMAND_BUFFER_EXTENSION_VERSION > CL_MAKE_VERSION(0, 9, 4) + nullptr, // Properties +#endif + buffer(), + static_cast(&pattern), + sizeof(PatternType), + offset, + size, + (sync_points_vec != nullptr) ? (cl_uint) sync_points_vec->size() : 0, + (sync_points_vec != nullptr && sync_points_vec->size() > 0) ? &sync_points_vec->front() : nullptr, + (sync_point != nullptr) ? &tmp_sync_point : nullptr, + (cl_mutable_command_khr*) mutable_handle), + __COMMAND_FILL_BUFFER_KHR_ERR); + + if (sync_point != nullptr && error == CL_SUCCESS) + *sync_point = tmp_sync_point; + + return error; + } + + cl_int commandFillImage(const Image& image, + cl_float4 fillColor, + const array& origin, + const array& region, + const vector* sync_points_vec = nullptr, + cl_sync_point_khr* sync_point = nullptr, + MutableCommandKhr* mutable_handle = nullptr, + const CommandQueue* command_queue = nullptr) + { + if (pfn_clCommandFillImageKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __COMMAND_FILL_IMAGE_KHR_ERR); + } + + cl_sync_point_khr tmp_sync_point; + cl_int error = detail::errHandler( + pfn_clCommandFillImageKHR(object_, + (command_queue != nullptr) ? (*command_queue)() : nullptr, +#if CL_KHR_COMMAND_BUFFER_EXTENSION_VERSION > CL_MAKE_VERSION(0, 9, 4) + nullptr, // Properties +#endif + image(), + static_cast(&fillColor), + origin.data(), + region.data(), + (sync_points_vec != nullptr) ? (cl_uint) sync_points_vec->size() : 0, + (sync_points_vec != nullptr && sync_points_vec->size() > 0) ? &sync_points_vec->front() : nullptr, + (sync_point != nullptr) ? &tmp_sync_point : nullptr, + (cl_mutable_command_khr*) mutable_handle), + __COMMAND_FILL_IMAGE_KHR_ERR); + + if (sync_point != nullptr && error == CL_SUCCESS) + *sync_point = tmp_sync_point; + + return error; + } + + cl_int commandNDRangeKernel( +#if CL_KHR_COMMAND_BUFFER_EXTENSION_VERSION > CL_MAKE_VERSION(0, 9, 4) + const cl::vector &properties, +#else + const cl::vector &properties, +#endif + const Kernel& kernel, + const NDRange& offset, + const NDRange& global, + const NDRange& local = NullRange, + const vector* sync_points_vec = nullptr, + cl_sync_point_khr* sync_point = nullptr, + MutableCommandKhr* mutable_handle = nullptr, + const CommandQueue* command_queue = nullptr) + { + if (pfn_clCommandNDRangeKernelKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __COMMAND_NDRANGE_KERNEL_KHR_ERR); + } + + cl_sync_point_khr tmp_sync_point; + cl_int error = detail::errHandler( + pfn_clCommandNDRangeKernelKHR(object_, + (command_queue != nullptr) ? (*command_queue)() : nullptr, + &properties[0], + kernel(), + (cl_uint) global.dimensions(), + offset.dimensions() != 0 ? (const size_type*) offset : nullptr, + (const size_type*) global, + local.dimensions() != 0 ? (const size_type*) local : nullptr, + (sync_points_vec != nullptr) ? (cl_uint) sync_points_vec->size() : 0, + (sync_points_vec != nullptr && sync_points_vec->size() > 0) ? &sync_points_vec->front() : nullptr, + (sync_point != nullptr) ? &tmp_sync_point : nullptr, + (cl_mutable_command_khr*) mutable_handle), + __COMMAND_NDRANGE_KERNEL_KHR_ERR); + + if (sync_point != nullptr && error == CL_SUCCESS) + *sync_point = tmp_sync_point; + + return error; + } + +#if defined(cl_khr_command_buffer_mutable_dispatch) +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION < \ + CL_MAKE_VERSION(0, 9, 2) + cl_int updateMutableCommands(const cl_mutable_base_config_khr* mutable_config) + { + if (pfn_clUpdateMutableCommandsKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __UPDATE_MUTABLE_COMMANDS_KHR_ERR); + } + return detail::errHandler(pfn_clUpdateMutableCommandsKHR(object_, mutable_config), + __UPDATE_MUTABLE_COMMANDS_KHR_ERR); + } +#else + template + cl_int updateMutableCommands(std::array &config_types, + std::array &configs) { + if (pfn_clUpdateMutableCommandsKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __UPDATE_MUTABLE_COMMANDS_KHR_ERR); + } + return detail::errHandler( + pfn_clUpdateMutableCommandsKHR(object_, static_cast(configs.size()), + config_types.data(), configs.data()), + __UPDATE_MUTABLE_COMMANDS_KHR_ERR); + } +#endif /* CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION */ +#endif /* cl_khr_command_buffer_mutable_dispatch */ + +private: + static std::once_flag ext_init_; + + static void initExtensions(const cl::Device& device) + { +#if CL_HPP_TARGET_OPENCL_VERSION >= 120 + cl_platform_id platform = device.getInfo()(); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCreateCommandBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clFinalizeCommandBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clRetainCommandBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clReleaseCommandBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clGetCommandBufferInfoKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clEnqueueCommandBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCommandBarrierWithWaitListKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCommandCopyBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCommandCopyBufferRectKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCommandCopyBufferToImageKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCommandCopyImageKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCommandCopyImageToBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCommandFillBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCommandFillImageKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clCommandNDRangeKernelKHR); +#if defined(cl_khr_command_buffer_mutable_dispatch) + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clUpdateMutableCommandsKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_(platform, clGetMutableCommandInfoKHR); +#endif /* cl_khr_command_buffer_mutable_dispatch */ +#elif CL_HPP_TARGET_OPENCL_VERSION >= 110 + CL_HPP_INIT_CL_EXT_FCN_PTR_(clCreateCommandBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clFinalizeCommandBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clRetainCommandBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clReleaseCommandBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clGetCommandBufferInfoKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clEnqueueCommandBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clCommandBarrierWithWaitListKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clCommandCopyBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clCommandCopyBufferRectKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clCommandCopyBufferToImageKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clCommandCopyImageKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clCommandCopyImageToBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clCommandFillBufferKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clCommandFillImageKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clCommandNDRangeKernelKHR); +#if defined(cl_khr_command_buffer_mutable_dispatch) + CL_HPP_INIT_CL_EXT_FCN_PTR_(clUpdateMutableCommandsKHR); + CL_HPP_INIT_CL_EXT_FCN_PTR_(clGetMutableCommandInfoKHR); +#endif /* cl_khr_command_buffer_mutable_dispatch */ +#endif + if ((pfn_clCreateCommandBufferKHR == nullptr) && + (pfn_clFinalizeCommandBufferKHR == nullptr) && + (pfn_clRetainCommandBufferKHR == nullptr) && + (pfn_clReleaseCommandBufferKHR == nullptr) && + (pfn_clGetCommandBufferInfoKHR == nullptr) && + (pfn_clEnqueueCommandBufferKHR == nullptr) && + (pfn_clCommandBarrierWithWaitListKHR == nullptr) && + (pfn_clCommandCopyBufferKHR == nullptr) && + (pfn_clCommandCopyBufferRectKHR == nullptr) && + (pfn_clCommandCopyBufferToImageKHR == nullptr) && + (pfn_clCommandCopyImageKHR == nullptr) && + (pfn_clCommandCopyImageToBufferKHR == nullptr) && + (pfn_clCommandFillBufferKHR == nullptr) && + (pfn_clCommandFillImageKHR == nullptr) && + (pfn_clCommandNDRangeKernelKHR == nullptr) +#if defined(cl_khr_command_buffer_mutable_dispatch) + && (pfn_clUpdateMutableCommandsKHR == nullptr) + && (pfn_clGetMutableCommandInfoKHR == nullptr) +#endif /* cl_khr_command_buffer_mutable_dispatch */ + ) + { + detail::errHandler(CL_INVALID_VALUE, __CREATE_COMMAND_BUFFER_KHR_ERR); + } + } +}; // CommandBufferKhr + +CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag CommandBufferKhr::ext_init_; + +#if defined(cl_khr_command_buffer_mutable_dispatch) +/*! \class MutableCommandKhr + * \brief MutableCommandKhr interface for cl_mutable_command_khr. + */ +class MutableCommandKhr : public detail::Wrapper +{ +public: + //! \brief Default constructor - initializes to nullptr. + MutableCommandKhr() : detail::Wrapper() { } + + explicit MutableCommandKhr(const cl_mutable_command_khr& mutableCommandKhr, bool retainObject = false) : + detail::Wrapper(mutableCommandKhr, retainObject) { } + + MutableCommandKhr& operator=(const cl_mutable_command_khr& rhs) + { + detail::Wrapper::operator=(rhs); + return *this; + } + + template + cl_int getInfo(cl_mutable_command_info_khr name, T* param) const + { + if (pfn_clGetMutableCommandInfoKHR == nullptr) { + return detail::errHandler(CL_INVALID_OPERATION, + __GET_MUTABLE_COMMAND_INFO_KHR_ERR); + } + return detail::errHandler( + detail::getInfo(pfn_clGetMutableCommandInfoKHR, object_, name, param), + __GET_MUTABLE_COMMAND_INFO_KHR_ERR); + } + + template typename + detail::param_traits::param_type + getInfo(cl_int* err = nullptr) const + { + typename detail::param_traits< + detail::cl_mutable_command_info_khr, name>::param_type param; + cl_int result = getInfo(name, ¶m); + if (err != nullptr) { + *err = result; + } + return param; + } +}; // MutableCommandKhr +#endif /* cl_khr_command_buffer_mutable_dispatch */ + +#endif // cl_khr_command_buffer //---------------------------------------------------------------------------------------------------------------------- #undef CL_HPP_ERR_STR_ #if !defined(CL_HPP_USER_OVERRIDE_ERROR_STRINGS) -#undef __GET_DEVICE_INFO_ERR -#undef __GET_PLATFORM_INFO_ERR -#undef __GET_DEVICE_IDS_ERR -#undef __GET_PLATFORM_IDS_ERR -#undef __GET_CONTEXT_INFO_ERR -#undef __GET_EVENT_INFO_ERR -#undef __GET_EVENT_PROFILE_INFO_ERR -#undef __GET_MEM_OBJECT_INFO_ERR -#undef __GET_IMAGE_INFO_ERR -#undef __GET_SAMPLER_INFO_ERR -#undef __GET_KERNEL_INFO_ERR -#undef __GET_KERNEL_ARG_INFO_ERR -#undef __GET_KERNEL_SUB_GROUP_INFO_ERR -#undef __GET_KERNEL_WORK_GROUP_INFO_ERR -#undef __GET_PROGRAM_INFO_ERR -#undef __GET_PROGRAM_BUILD_INFO_ERR -#undef __GET_COMMAND_QUEUE_INFO_ERR -#undef __CREATE_CONTEXT_ERR +#undef __GET_DEVICE_INFO_ERR +#undef __GET_PLATFORM_INFO_ERR +#undef __GET_DEVICE_IDS_ERR +#undef __GET_PLATFORM_IDS_ERR +#undef __GET_CONTEXT_INFO_ERR +#undef __GET_EVENT_INFO_ERR +#undef __GET_EVENT_PROFILE_INFO_ERR +#undef __GET_MEM_OBJECT_INFO_ERR +#undef __GET_IMAGE_INFO_ERR +#undef __GET_SAMPLER_INFO_ERR +#undef __GET_KERNEL_INFO_ERR +#undef __GET_KERNEL_ARG_INFO_ERR +#undef __GET_KERNEL_SUB_GROUP_INFO_ERR +#undef __GET_KERNEL_WORK_GROUP_INFO_ERR +#undef __GET_PROGRAM_INFO_ERR +#undef __GET_PROGRAM_BUILD_INFO_ERR +#undef __GET_COMMAND_QUEUE_INFO_ERR +#undef __CREATE_CONTEXT_ERR #undef __CREATE_CONTEXT_FROM_TYPE_ERR -#undef __GET_SUPPORTED_IMAGE_FORMATS_ERR -#undef __CREATE_BUFFER_ERR -#undef __COPY_ERR -#undef __CREATE_SUBBUFFER_ERR -#undef __CREATE_GL_BUFFER_ERR -#undef __CREATE_GL_RENDER_BUFFER_ERR -#undef __GET_GL_OBJECT_INFO_ERR -#undef __CREATE_IMAGE_ERR -#undef __CREATE_GL_TEXTURE_ERR -#undef __IMAGE_DIMENSION_ERR -#undef __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR -#undef __CREATE_USER_EVENT_ERR -#undef __SET_USER_EVENT_STATUS_ERR -#undef __SET_EVENT_CALLBACK_ERR -#undef __WAIT_FOR_EVENTS_ERR -#undef __CREATE_KERNEL_ERR -#undef __SET_KERNEL_ARGS_ERR -#undef __CREATE_PROGRAM_WITH_SOURCE_ERR -#undef __CREATE_PROGRAM_WITH_IL_ERR -#undef __CREATE_PROGRAM_WITH_BINARY_ERR -#undef __CREATE_PROGRAM_WITH_IL_ERR -#undef __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR -#undef __BUILD_PROGRAM_ERR -#undef __COMPILE_PROGRAM_ERR -#undef __LINK_PROGRAM_ERR -#undef __CREATE_KERNELS_IN_PROGRAM_ERR -#undef __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR -#undef __CREATE_SAMPLER_WITH_PROPERTIES_ERR -#undef __SET_COMMAND_QUEUE_PROPERTY_ERR -#undef __ENQUEUE_READ_BUFFER_ERR -#undef __ENQUEUE_READ_BUFFER_RECT_ERR -#undef __ENQUEUE_WRITE_BUFFER_ERR -#undef __ENQUEUE_WRITE_BUFFER_RECT_ERR -#undef __ENQEUE_COPY_BUFFER_ERR -#undef __ENQEUE_COPY_BUFFER_RECT_ERR -#undef __ENQUEUE_FILL_BUFFER_ERR -#undef __ENQUEUE_READ_IMAGE_ERR -#undef __ENQUEUE_WRITE_IMAGE_ERR -#undef __ENQUEUE_COPY_IMAGE_ERR -#undef __ENQUEUE_FILL_IMAGE_ERR -#undef __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR -#undef __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR +#undef __CREATE_COMMAND_BUFFER_KHR_ERR +#undef __GET_COMMAND_BUFFER_INFO_KHR_ERR +#undef __FINALIZE_COMMAND_BUFFER_KHR_ERR +#undef __ENQUEUE_COMMAND_BUFFER_KHR_ERR +#undef __COMMAND_BARRIER_WITH_WAIT_LIST_KHR_ERR +#undef __COMMAND_COPY_BUFFER_KHR_ERR +#undef __COMMAND_COPY_BUFFER_RECT_KHR_ERR +#undef __COMMAND_COPY_BUFFER_TO_IMAGE_KHR_ERR +#undef __COMMAND_COPY_IMAGE_KHR_ERR +#undef __COMMAND_COPY_IMAGE_TO_BUFFER_KHR_ERR +#undef __COMMAND_FILL_BUFFER_KHR_ERR +#undef __COMMAND_FILL_IMAGE_KHR_ERR +#undef __COMMAND_NDRANGE_KERNEL_KHR_ERR +#undef __UPDATE_MUTABLE_COMMANDS_KHR_ERR +#undef __GET_MUTABLE_COMMAND_INFO_KHR_ERR +#undef __RETAIN_COMMAND_BUFFER_KHR_ERR +#undef __RELEASE_COMMAND_BUFFER_KHR_ERR +#undef __GET_SUPPORTED_IMAGE_FORMATS_ERR +#undef __SET_CONTEXT_DESCTRUCTOR_CALLBACK_ERR +#undef __CREATE_BUFFER_ERR +#undef __COPY_ERR +#undef __CREATE_SUBBUFFER_ERR +#undef __CREATE_GL_BUFFER_ERR +#undef __CREATE_GL_RENDER_BUFFER_ERR +#undef __GET_GL_OBJECT_INFO_ERR +#undef __CREATE_IMAGE_ERR +#undef __CREATE_GL_TEXTURE_ERR +#undef __IMAGE_DIMENSION_ERR +#undef __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR +#undef __CREATE_USER_EVENT_ERR +#undef __SET_USER_EVENT_STATUS_ERR +#undef __SET_EVENT_CALLBACK_ERR +#undef __WAIT_FOR_EVENTS_ERR +#undef __CREATE_KERNEL_ERR +#undef __SET_KERNEL_ARGS_ERR +#undef __CREATE_PROGRAM_WITH_SOURCE_ERR +#undef __CREATE_PROGRAM_WITH_BINARY_ERR +#undef __CREATE_PROGRAM_WITH_IL_ERR +#undef __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR +#undef __BUILD_PROGRAM_ERR +#undef __COMPILE_PROGRAM_ERR +#undef __LINK_PROGRAM_ERR +#undef __CREATE_KERNELS_IN_PROGRAM_ERR +#undef __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR +#undef __CREATE_SAMPLER_WITH_PROPERTIES_ERR +#undef __SET_COMMAND_QUEUE_PROPERTY_ERR +#undef __ENQUEUE_READ_BUFFER_ERR +#undef __ENQUEUE_READ_BUFFER_RECT_ERR +#undef __ENQUEUE_WRITE_BUFFER_ERR +#undef __ENQUEUE_WRITE_BUFFER_RECT_ERR +#undef __ENQEUE_COPY_BUFFER_ERR +#undef __ENQEUE_COPY_BUFFER_RECT_ERR +#undef __ENQUEUE_FILL_BUFFER_ERR +#undef __ENQUEUE_READ_IMAGE_ERR +#undef __ENQUEUE_WRITE_IMAGE_ERR +#undef __ENQUEUE_COPY_IMAGE_ERR +#undef __ENQUEUE_FILL_IMAGE_ERR +#undef __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR +#undef __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR #undef __ENQUEUE_MAP_BUFFER_ERR #undef __ENQUEUE_MAP_IMAGE_ERR -#undef __ENQUEUE_UNMAP_MEM_OBJECT_ERR -#undef __ENQUEUE_NDRANGE_KERNEL_ERR -#undef __ENQUEUE_NATIVE_KERNEL -#undef __ENQUEUE_MIGRATE_MEM_OBJECTS_ERR +#undef __ENQUEUE_MAP_SVM_ERR +#undef __ENQUEUE_FILL_SVM_ERR +#undef __ENQUEUE_COPY_SVM_ERR +#undef __ENQUEUE_UNMAP_SVM_ERR +#undef __ENQUEUE_MAP_IMAGE_ERR +#undef __ENQUEUE_UNMAP_MEM_OBJECT_ERR +#undef __ENQUEUE_NDRANGE_KERNEL_ERR +#undef __ENQUEUE_NATIVE_KERNEL +#undef __ENQUEUE_MIGRATE_MEM_OBJECTS_ERR #undef __ENQUEUE_MIGRATE_SVM_ERR -#undef __ENQUEUE_ACQUIRE_GL_ERR -#undef __ENQUEUE_RELEASE_GL_ERR -#undef __CREATE_PIPE_ERR -#undef __GET_PIPE_INFO_ERR -#undef __RETAIN_ERR -#undef __RELEASE_ERR -#undef __FLUSH_ERR -#undef __FINISH_ERR -#undef __VECTOR_CAPACITY_ERR +#undef __ENQUEUE_ACQUIRE_GL_ERR +#undef __ENQUEUE_RELEASE_GL_ERR +#undef __CREATE_PIPE_ERR +#undef __GET_PIPE_INFO_ERR +#undef __RETAIN_ERR +#undef __RELEASE_ERR +#undef __FLUSH_ERR +#undef __FINISH_ERR +#undef __VECTOR_CAPACITY_ERR #undef __CREATE_SUB_DEVICES_ERR -#undef __CREATE_SUB_DEVICES_ERR -#undef __ENQUEUE_MARKER_ERR -#undef __ENQUEUE_WAIT_FOR_EVENTS_ERR -#undef __ENQUEUE_BARRIER_ERR -#undef __UNLOAD_COMPILER_ERR -#undef __CREATE_GL_TEXTURE_2D_ERR -#undef __CREATE_GL_TEXTURE_3D_ERR -#undef __CREATE_IMAGE2D_ERR -#undef __CREATE_IMAGE3D_ERR -#undef __CREATE_COMMAND_QUEUE_ERR -#undef __ENQUEUE_TASK_ERR -#undef __CREATE_SAMPLER_ERR -#undef __ENQUEUE_MARKER_WAIT_LIST_ERR -#undef __ENQUEUE_BARRIER_WAIT_LIST_ERR -#undef __CLONE_KERNEL_ERR +#undef __ENQUEUE_ACQUIRE_EXTERNAL_MEMORY_ERR +#undef __ENQUEUE_RELEASE_EXTERNAL_MEMORY_ERR +#undef __ENQUEUE_MARKER_ERR +#undef __ENQUEUE_WAIT_FOR_EVENTS_ERR +#undef __ENQUEUE_BARRIER_ERR +#undef __UNLOAD_COMPILER_ERR +#undef __CREATE_GL_TEXTURE_2D_ERR +#undef __CREATE_GL_TEXTURE_3D_ERR +#undef __CREATE_IMAGE2D_ERR +#undef __CREATE_IMAGE3D_ERR +#undef __CREATE_COMMAND_QUEUE_ERR +#undef __ENQUEUE_TASK_ERR +#undef __CREATE_SAMPLER_ERR +#undef __ENQUEUE_MARKER_WAIT_LIST_ERR +#undef __ENQUEUE_BARRIER_WAIT_LIST_ERR +#undef __CLONE_KERNEL_ERR #undef __GET_HOST_TIMER_ERR #undef __GET_DEVICE_AND_HOST_TIMER_ERR +#undef __GET_SEMAPHORE_KHR_INFO_ERR +#undef __CREATE_SEMAPHORE_KHR_WITH_PROPERTIES_ERR +#undef __GET_IMAGE_REQUIREMENT_INFO_EXT_ERR +#undef __ENQUEUE_WAIT_SEMAPHORE_KHR_ERR +#undef __ENQUEUE_SIGNAL_SEMAPHORE_KHR_ERR +#undef __RETAIN_SEMAPHORE_KHR_ERR +#undef __RELEASE_SEMAPHORE_KHR_ERR +#undef __GET_SEMAPHORE_HANDLE_FOR_TYPE_KHR_ERR #endif //CL_HPP_USER_OVERRIDE_ERROR_STRINGS // Extensions +#undef CL_HPP_CREATE_CL_EXT_FCN_PTR_ALIAS_ #undef CL_HPP_INIT_CL_EXT_FCN_PTR_ #undef CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_ -#if defined(CL_HPP_USE_CL_DEVICE_FISSION) -#undef CL_HPP_PARAM_NAME_DEVICE_FISSION_ -#endif // CL_HPP_USE_CL_DEVICE_FISSION - -#undef CL_HPP_NOEXCEPT_ #undef CL_HPP_DEFINE_STATIC_MEMBER_ +#undef CL_ + } // namespace cl #endif // CL_HPP_ diff --git a/make/libraries b/make/libraries index 68c65b75a38..6db16798fc6 100644 --- a/make/libraries +++ b/make/libraries @@ -10,7 +10,7 @@ endef MATH ?= BOOST ?= $(MATH)lib/boost_1.87.0 EIGEN ?= $(MATH)lib/eigen_3.4.0 -OPENCL ?= $(MATH)lib/opencl_3.0.0 +OPENCL ?= $(MATH)lib/opencl_v2025.07.22 TBB ?= $(MATH)lib/tbb_2020.3 SUNDIALS ?= $(MATH)lib/sundials_6.1.1 BENCHMARK ?= $(MATH)lib/benchmark_1.5.1 diff --git a/stan/math/opencl/kernel_generator/elt_function_cl.hpp b/stan/math/opencl/kernel_generator/elt_function_cl.hpp index 08382c11f9d..96bbabbaf65 100644 --- a/stan/math/opencl/kernel_generator/elt_function_cl.hpp +++ b/stan/math/opencl/kernel_generator/elt_function_cl.hpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -314,6 +315,12 @@ ADD_UNARY_FUNCTION_WITH_INCLUDES(Phi, opencl_kernels::phi_device_function) ADD_UNARY_FUNCTION_WITH_INCLUDES(Phi_approx, opencl_kernels::inv_logit_device_function, opencl_kernels::phi_approx_device_function) +ADD_UNARY_FUNCTION_WITH_INCLUDES( + std_normal_lcdf_scaled_impl, + opencl_kernels::std_normal_lcdf_device_function) +ADD_UNARY_FUNCTION_WITH_INCLUDES( + std_normal_lcdf_dscaled_impl, + opencl_kernels::std_normal_lcdf_device_function) ADD_UNARY_FUNCTION_WITH_INCLUDES(inv_Phi, opencl_kernels::log1m_device_function, opencl_kernels::phi_device_function, opencl_kernels::inv_phi_device_function) @@ -352,10 +359,53 @@ ADD_BINARY_FUNCTION_WITH_INCLUDES( stan::math::opencl_kernels::lgamma_stirling_diff_device_function, stan::math::opencl_kernels::lbeta_device_function, stan::math::opencl_kernels::binomial_coefficient_log_device_function) -ADD_BINARY_FUNCTION_WITH_INCLUDES( - lbeta, stan::math::opencl_kernels::lgamma_stirling_device_function, +template +class lbeta_ : public elt_function_cl, double, T1, T2> { + using base = elt_function_cl, double, T1, T2>; + using base::arguments_; + + public: + using base::cols; + using base::rows; + static const std::vector includes; + explicit lbeta_(T1&& a, T2&& b) + : base("stan_lbeta", std::forward(a), std::forward(b)) { + if (a.rows() != base::dynamic && b.rows() != base::dynamic) { + check_size_match("lbeta", "Rows of ", "a", a.rows(), "rows of ", "b", + b.rows()); + } + if (a.cols() != base::dynamic && b.cols() != base::dynamic) { + check_size_match("lbeta", "Columns of ", "a", a.cols(), "columns of ", + "b", b.cols()); + } + } + inline auto deep_copy() const { + auto&& arg1_copy = this->template get_arg<0>().deep_copy(); + auto&& arg2_copy = this->template get_arg<1>().deep_copy(); + return lbeta_, + std::remove_reference_t>{ + std::move(arg1_copy), std::move(arg2_copy)}; + } + inline std::pair extreme_diagonals() const { + return {-rows() + 1, cols() - 1}; + } +}; + +template * = nullptr, + require_any_not_stan_scalar_t* = nullptr> +inline lbeta_, as_operation_cl_t> lbeta(T1&& a, + T2&& b) { + return lbeta_, as_operation_cl_t>( + as_operation_cl(std::forward(a)), + as_operation_cl(std::forward(b))); +} + +template +const std::vector lbeta_::includes{ + stan::math::opencl_kernels::lgamma_stirling_device_function, stan::math::opencl_kernels::lgamma_stirling_diff_device_function, - stan::math::opencl_kernels::lbeta_device_function) + stan::math::opencl_kernels::lbeta_device_function}; ADD_BINARY_FUNCTION_WITH_INCLUDES( log_inv_logit_diff, opencl_kernels::log1p_exp_device_function, opencl_kernels::log1m_exp_device_function, diff --git a/stan/math/opencl/kernels/device_functions/binomial_coefficient_log.hpp b/stan/math/opencl/kernels/device_functions/binomial_coefficient_log.hpp index ac15cb19e17..a5988f22cee 100644 --- a/stan/math/opencl/kernels/device_functions/binomial_coefficient_log.hpp +++ b/stan/math/opencl/kernels/device_functions/binomial_coefficient_log.hpp @@ -95,7 +95,7 @@ static constexpr const char* binomial_coefficient_log_device_function } else if (n_plus_1 < LGAMMA_STIRLING_DIFF_USEFUL) { return lgamma(n_plus_1) - lgamma(k + 1) - lgamma(n_plus_1_mk); } else { - return -lbeta(n_plus_1_mk, k + 1) - log1p(n); + return -stan_lbeta(n_plus_1_mk, k + 1) - log1p(n); } } // \cond diff --git a/stan/math/opencl/kernels/device_functions/lbeta.hpp b/stan/math/opencl/kernels/device_functions/lbeta.hpp index 3fe6fe89056..27e721575ff 100644 --- a/stan/math/opencl/kernels/device_functions/lbeta.hpp +++ b/stan/math/opencl/kernels/device_functions/lbeta.hpp @@ -59,9 +59,9 @@ static constexpr const char* lbeta_device_function * @param b Second value * @return Log of the beta function applied to the two values. */ - double lbeta(double a, double b) { + double stan_lbeta(double a, double b) { if (isnan(a) || isnan(b)) { - return a; + return NAN; } double x; // x is the smaller of the two diff --git a/stan/math/opencl/kernels/device_functions/std_normal_lcdf.hpp b/stan/math/opencl/kernels/device_functions/std_normal_lcdf.hpp new file mode 100644 index 00000000000..49e308d7853 --- /dev/null +++ b/stan/math/opencl/kernels/device_functions/std_normal_lcdf.hpp @@ -0,0 +1,160 @@ +#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_STD_NORMAL_LCDF_HPP +#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_STD_NORMAL_LCDF_HPP +#ifdef STAN_OPENCL + +#include +#include + +namespace stan { +namespace math { +namespace opencl_kernels { +// \cond +static constexpr const char* std_normal_lcdf_device_function + = "\n" + "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_STD_NORMAL_LCDF\n" + "#define " + "STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_STD_NORMAL_LCDF\n" STRINGIFY( + /** \ingroup opencl_kernels + * Return the log standard normal cumulative distribution function + * evaluated from the scaled input `x / sqrt(2)`. + * + * @param scaled_y input scaled by `1 / sqrt(2)` + * @return log(Phi(x)) + */ + inline double std_normal_lcdf_scaled_impl(double scaled_y) { + double lcdf_n; + if (scaled_y > 0.0) { + // CDF(x) = 1/2 + 1/2 erf(x) = 1 - 1/2 erfc(x) + lcdf_n = log1p(-0.5 * erfc(scaled_y)); + if (isnan(lcdf_n)) { + lcdf_n = 0; + } + } else if (scaled_y > -20.0) { + // CDF(x) = 1/2 - 1/2 erf(-x) = 1/2 erfc(-x) + lcdf_n = log(erfc(-scaled_y)) - M_LN2; + } else if (10.0 * log(fabs(scaled_y)) < log(DBL_MAX)) { + // Need direct approximation once erfc(-x) underflows. + const double x2 = scaled_y * scaled_y; + const double x4 = pow(scaled_y, 4); + const double x6 = pow(scaled_y, 6); + const double x8 = pow(scaled_y, 8); + const double x10 = pow(scaled_y, 10); + const double temp_p = 0.000658749161529837803157 + + 0.0160837851487422766278 / x2 + + 0.125781726111229246204 / x4 + + 0.360344899949804439429 / x6 + + 0.305326634961232344035 / x8 + + 0.0163153871373020978498 / x10; + const double temp_q + = -0.00233520497626869185443 - 0.0605183413124413191178 / x2 + - 0.527905102951428412248 / x4 - 1.87295284992346047209 / x6 + - 2.56852019228982242072 / x8 - 1.0 / x10; + lcdf_n = log(0.5 * M_2_SQRTPI + (temp_p / temp_q) / x2) - M_LN2 + - log(-scaled_y) - x2; + } else { + lcdf_n = -INFINITY; + } + return lcdf_n; + } + + /** \ingroup opencl_kernels + * Return the derivative of log standard normal cumulative + * distribution function with respect to the scaled input + * `x / sqrt(2)`. + * + * @param scaled_y input scaled by `1 / sqrt(2)` + * @return d / d(scaled_y) log(Phi(x)) + */ + inline double std_normal_lcdf_dscaled_impl(double scaled_y) { + double dnlcdf = 0.0; + double t = 0.0; + double t2 = 0.0; + double t4 = 0.0; + const double x2 = scaled_y * scaled_y; + + if (scaled_y > 2.9) { + t = 1.0 / (1.0 + 0.3275911 * scaled_y); + t2 = t * t; + t4 = pow(t, 4); + dnlcdf = 0.5 * M_2_SQRTPI + / (exp(x2) - 0.254829592 + 0.284496736 * t + - 1.421413741 * t2 + 1.453152027 * t2 * t + - 1.061405429 * t4); + } else if (scaled_y > 2.5) { + t = scaled_y - 2.7; + t2 = t * t; + t4 = pow(t, 4); + dnlcdf = 0.0003849882382 - 0.002079084702 * t + + 0.005229340880 * t2 - 0.008029540137 * t2 * t + + 0.008232190507 * t4 - 0.005692364250 * t4 * t + + 0.002399496363 * pow(t, 6); + } else if (scaled_y > 2.1) { + t = scaled_y - 2.3; + t2 = t * t; + t4 = pow(t, 4); + dnlcdf = 0.002846135439 - 0.01310032351 * t + 0.02732189391 * t2 + - 0.03326906904 * t2 * t + 0.02482478940 * t4 + - 0.009883071924 * t4 * t - 0.0002771362254 * pow(t, 6); + } else if (scaled_y > 1.5) { + t = scaled_y - 1.85; + t2 = t * t; + t4 = pow(t, 4); + dnlcdf = 0.01849212058 - 0.06876280470 * t + 0.1099906382 * t2 + - 0.09274533184 * t2 * t + 0.03543327418 * t4 + + 0.005644855518 * t4 * t - 0.01111434424 * pow(t, 6); + } else if (scaled_y > 0.8) { + t = scaled_y - 1.15; + t2 = t * t; + t4 = pow(t, 4); + dnlcdf = 0.1585747034 - 0.3898677543 * t + 0.3515963775 * t2 + - 0.09748053605 * t2 * t - 0.04347986191 * t4 + + 0.02182506378 * t4 * t + 0.01074751427 * pow(t, 6); + } else if (scaled_y > 0.1) { + t = scaled_y - 0.45; + t2 = t * t; + t4 = pow(t, 4); + dnlcdf = 0.6245634904 - 0.9521866949 * t + 0.3986215682 * t2 + + 0.04700850676 * t2 * t - 0.03478651979 * t4 + - 0.01772675404 * t4 * t + 0.0006577254811 * pow(t, 6); + } else if (10.0 * log(fabs(scaled_y)) < log(DBL_MAX)) { + t = 1.0 / (1.0 - 0.3275911 * scaled_y); + t2 = t * t; + t4 = pow(t, 4); + dnlcdf + = M_2_SQRTPI + / (0.254829592 * t - 0.284496736 * t2 + 1.421413741 * t2 * t + - 1.453152027 * t4 + 1.061405429 * t4 * t); + if (scaled_y < -29.0) { + dnlcdf += 0.0015065154280332 * x2 + - 0.3993154819705530 * scaled_y - 4.2919418242931700; + } else if (scaled_y < -17.0) { + dnlcdf += 0.0001263257217272 * x2 * scaled_y + + 0.0123586859488623 * x2 + - 0.0860505264736028 * scaled_y - 1.252783383752970; + } else if (scaled_y < -7.0) { + dnlcdf += 0.000471585349920831 * x2 * scaled_y + + 0.0296839305424034 * x2 + + 0.207402143352332 * scaled_y + 0.425316974683324; + } else if (scaled_y < -3.9) { + dnlcdf += -0.0006972280656443 * x2 * scaled_y + + 0.0068218494628567 * x2 + + 0.0585761964460277 * scaled_y + 0.1034397670201370; + } else if (scaled_y < -2.1) { + dnlcdf += -0.0018742199480885 * x2 * scaled_y + - 0.0097119598291202 * x2 + - 0.0170137970924080 * scaled_y - 0.0100428567412041; + } + } else { + dnlcdf = INFINITY; + } + + return dnlcdf; + }) "\n#endif\n"; // NOLINT +// \endcond + +} // namespace opencl_kernels +} // namespace math +} // namespace stan + +#endif +#endif diff --git a/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp b/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp index b1e34e4de3a..14f67b9e5f3 100644 --- a/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp +++ b/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include namespace stan { @@ -80,30 +81,73 @@ exp_mod_normal_lcdf(const T_y_cl& y, const T_loc_cl& mu, auto scaled_diff = elt_multiply(diff * INV_SQRT_TWO, sigma_inv); auto v = elt_multiply(lambda_val, sigma_val); auto scaled_diff_diff = scaled_diff - v * INV_SQRT_TWO; - auto erf_calc = 0.5 * (1.0 + erf(scaled_diff_diff)); - auto exp_term = exp(0.5 * square(v) - elt_multiply(lambda_val, diff)); - auto cdf_n = 0.5 + 0.5 * erf(scaled_diff) - elt_multiply(exp_term, erf_calc); - auto cdf_log_expr = colwise_sum(log(cdf_n)); + auto cdf_term_1 = 0.5 + 0.5 * erf(scaled_diff); + auto cdf_term_2_phi = 0.5 * (1.0 + erf(scaled_diff_diff)); + auto log_exp_term = 0.5 * square(v) - elt_multiply(lambda_val, diff); + auto exp_term = exp(log_exp_term); + auto cdf_term_2 = elt_multiply(exp_term, cdf_term_2_phi); + auto cdf_n = cdf_term_1 - cdf_term_2; + auto use_stable = cdf_n <= 0.0 || !isfinite(cdf_n); auto exp_term_2 = exp(-square(scaled_diff_diff)); - auto deriv_1 = elt_multiply(elt_multiply(lambda_val, exp_term), erf_calc); + auto deriv_1 + = elt_multiply(elt_multiply(lambda_val, exp_term), cdf_term_2_phi); auto deriv_2 = INV_SQRT_TWO_PI * elt_multiply(elt_multiply(exp_term, exp_term_2), sigma_inv); auto deriv_3 = INV_SQRT_TWO_PI * elt_multiply(exp(-square(scaled_diff)), sigma_inv); - auto y_deriv = elt_divide(deriv_1 - deriv_2 + deriv_3, cdf_n); - auto mu_deriv = -y_deriv; - auto sigma_deriv = -elt_divide( + auto direct_cdf_log = log(cdf_n); + auto direct_y_deriv = elt_divide(deriv_1 - deriv_2 + deriv_3, cdf_n); + auto direct_mu_deriv = -direct_y_deriv; + auto direct_sigma_deriv = -elt_divide( elt_multiply(deriv_1 - deriv_2, v) + elt_multiply(deriv_3 - deriv_2, scaled_diff) * SQRT_TWO, cdf_n); - auto lambda_deriv = elt_divide( - elt_multiply( - exp_term, - INV_SQRT_TWO_PI * elt_multiply(sigma_val, exp_term_2) - - elt_multiply(elt_multiply(v, sigma_val) - diff, erf_calc)), + auto direct_lambda_deriv = elt_divide( + elt_multiply(exp_term, + INV_SQRT_TWO_PI * elt_multiply(sigma_val, exp_term_2) + - elt_multiply(elt_multiply(v, sigma_val) - diff, + cdf_term_2_phi)), cdf_n); + auto log_cdf_term_1 = std_normal_lcdf_scaled_impl(scaled_diff); + auto dlog_cdf_term_1 = std_normal_lcdf_dscaled_impl(scaled_diff); + auto log_cdf_term_2_phi = std_normal_lcdf_scaled_impl(scaled_diff_diff); + auto dlog_cdf_term_2_phi = std_normal_lcdf_dscaled_impl(scaled_diff_diff); + auto log_cdf_term_2 = log_exp_term + log_cdf_term_2_phi; + auto log_cdf_n = log_diff_exp(log_cdf_term_1, log_cdf_term_2); + auto cdf_term_1_weight = exp(log_cdf_term_1 - log_cdf_n); + auto cdf_term_2_weight = exp(log_cdf_term_2 - log_cdf_n); + auto scaled_diff_deriv + = elt_multiply(dlog_cdf_term_1, sigma_inv * INV_SQRT_TWO); + auto scaled_diff_diff_deriv + = elt_multiply(dlog_cdf_term_2_phi, sigma_inv * INV_SQRT_TWO); + auto stable_y_deriv + = elt_multiply(cdf_term_1_weight, scaled_diff_deriv) + - elt_multiply(cdf_term_2_weight, -lambda_val + scaled_diff_diff_deriv); + auto stable_mu_deriv = -stable_y_deriv; + auto stable_sigma_deriv + = elt_multiply(cdf_term_1_weight, + -elt_multiply(dlog_cdf_term_1, + elt_multiply(scaled_diff, sigma_inv))) + - elt_multiply( + cdf_term_2_weight, + elt_multiply(lambda_val, v) + - elt_multiply( + dlog_cdf_term_2_phi, + elt_multiply(scaled_diff + v * INV_SQRT_TWO, sigma_inv))); + auto stable_lambda_deriv = -elt_multiply( + cdf_term_2_weight, + elt_multiply(v, sigma_val) - diff + - elt_multiply(dlog_cdf_term_2_phi, sigma_val * INV_SQRT_TWO)); + auto cdf_log_expr + = colwise_sum(select(use_stable, log_cdf_n, direct_cdf_log)); + auto y_deriv = select(use_stable, stable_y_deriv, direct_y_deriv); + auto mu_deriv = select(use_stable, stable_mu_deriv, direct_mu_deriv); + auto sigma_deriv = select(use_stable, stable_sigma_deriv, direct_sigma_deriv); + auto lambda_deriv + = select(use_stable, stable_lambda_deriv, direct_lambda_deriv); + matrix_cl any_y_neg_inf_cl; matrix_cl any_y_pos_inf_cl; matrix_cl cdf_log_cl; diff --git a/stan/math/opencl/prim/gumbel_cdf.hpp b/stan/math/opencl/prim/gumbel_cdf.hpp index ebea01725f1..bd055acc488 100644 --- a/stan/math/opencl/prim/gumbel_cdf.hpp +++ b/stan/math/opencl/prim/gumbel_cdf.hpp @@ -67,8 +67,7 @@ inline return_type_t gumbel_cdf( auto exp_m_scaled_diff = exp(-scaled_diff); auto cdf_n = exp(-exp_m_scaled_diff); auto cdf_expr = colwise_prod(cdf_n); - auto rep_deriv = elt_divide(exp(-scaled_diff - exp_m_scaled_diff), - elt_multiply(beta_val, cdf_n)); + auto rep_deriv = elt_divide(exp_m_scaled_diff, beta_val); matrix_cl cdf_cl; matrix_cl y_deriv_cl; diff --git a/stan/math/opencl/prim/std_normal_lcdf.hpp b/stan/math/opencl/prim/std_normal_lcdf.hpp index 2521478c768..4a7db54fcd9 100644 --- a/stan/math/opencl/prim/std_normal_lcdf.hpp +++ b/stan/math/opencl/prim/std_normal_lcdf.hpp @@ -8,167 +8,11 @@ #include #include #include +#include #include namespace stan { namespace math { -namespace internal { -const char opencl_std_normal_lcdf_impl[] = STRINGIFY( - double std_normal_lcdf_lcdf_n; if (std_normal_lcdf_scaled_y > 0.0) { - // CDF(x) = 1/2 + 1/2erf(x) = 1 - 1/2erfc(x) - std_normal_lcdf_lcdf_n = log1p(-0.5 * erfc(std_normal_lcdf_scaled_y)); - if (isnan(std_normal_lcdf_lcdf_n)) { - std_normal_lcdf_lcdf_n = 0; - } - } else if (std_normal_lcdf_scaled_y > -20.0) { - // CDF(x) = 1/2 - 1/2erf(-x) = 1/2erfc(-x) - std_normal_lcdf_lcdf_n = log(erfc(-std_normal_lcdf_scaled_y)) - M_LN2; - } else if (10.0 * log(fabs(std_normal_lcdf_scaled_y)) < log(DBL_MAX)) { - // entering territory where erfc(-x)~0 - // need to use direct numerical approximation of lcdf instead - // the following based on W. J. Cody, Math. Comp. 23(107):631-638 (1969) - // CDF(x) = 1/2erfc(-x) - const double x4 = pow(std_normal_lcdf_scaled_y, 4); - const double x6 = pow(std_normal_lcdf_scaled_y, 6); - const double x8 = pow(std_normal_lcdf_scaled_y, 8); - const double x10 = pow(std_normal_lcdf_scaled_y, 10); - const double temp_p - = 0.000658749161529837803157 - + 0.0160837851487422766278 / std_normal_lcdf_x2 - + 0.125781726111229246204 / x4 + 0.360344899949804439429 / x6 - + 0.305326634961232344035 / x8 + 0.0163153871373020978498 / x10; - const double temp_q = -0.00233520497626869185443 - - 0.0605183413124413191178 / std_normal_lcdf_x2 - - 0.527905102951428412248 / x4 - - 1.87295284992346047209 / x6 - - 2.56852019228982242072 / x8 - 1.0 / x10; - std_normal_lcdf_lcdf_n - += log(0.5 * M_2_SQRTPI + (temp_p / temp_q) / std_normal_lcdf_x2) - - M_LN2 - log(-std_normal_lcdf_scaled_y) - std_normal_lcdf_x2; - } else { - // std_normal_lcdf_scaled_y^10 term will overflow - std_normal_lcdf_lcdf_n = -INFINITY; - }); -// NOLINTBEGIN -const char opencl_std_normal_lcdf_dnlcdf[] = STRINGIFY( - // compute partial derivatives - // based on analytic form given by: - // dln(CDF)/dx = exp(-x^2)/(sqrt(pi)*(1/2+erf(x)/2) - double std_normal_lcdf_dnlcdf = 0.0; double t = 0.0; double t2 = 0.0; - double t4 = 0.0; - - // calculate using piecewise function - // (due to instability / inaccuracy in the various approximations) - if (std_normal_lcdf_deriv_scaled_y > 2.9) { - // approximation derived from Abramowitz and Stegun (1964) 7.1.26 - t = 1.0 / (1.0 + 0.3275911 * std_normal_lcdf_deriv_scaled_y); - t2 = t * t; - t4 = pow(t, 4); - std_normal_lcdf_dnlcdf - = 0.5 * M_2_SQRTPI - / (exp(std_normal_lcdf_deriv_x2) - 0.254829592 + 0.284496736 * t - - 1.421413741 * t2 + 1.453152027 * t2 * t - 1.061405429 * t4); - } else if (std_normal_lcdf_deriv_scaled_y > 2.5) { - // in the trouble area where all of the standard numerical - // approximations are unstable - bridge the gap using Taylor - // expansions of the analytic function - // use Taylor expansion centred around x=2.7 - t = std_normal_lcdf_deriv_scaled_y - 2.7; - t2 = t * t; - t4 = pow(t, 4); - std_normal_lcdf_dnlcdf = 0.0003849882382 - 0.002079084702 * t - + 0.005229340880 * t2 - 0.008029540137 * t2 * t - + 0.008232190507 * t4 - 0.005692364250 * t4 * t - + 0.002399496363 * pow(t, 6); - } else if (std_normal_lcdf_deriv_scaled_y > 2.1) { - // use Taylor expansion centred around x=2.3 - t = std_normal_lcdf_deriv_scaled_y - 2.3; - t2 = t * t; - t4 = pow(t, 4); - std_normal_lcdf_dnlcdf = 0.002846135439 - 0.01310032351 * t - + 0.02732189391 * t2 - 0.03326906904 * t2 * t - + 0.02482478940 * t4 - 0.009883071924 * t4 * t - - 0.0002771362254 * pow(t, 6); - } else if (std_normal_lcdf_deriv_scaled_y > 1.5) { - // use Taylor expansion centred around x=1.85 - t = std_normal_lcdf_deriv_scaled_y - 1.85; - t2 = t * t; - t4 = pow(t, 4); - std_normal_lcdf_dnlcdf = 0.01849212058 - 0.06876280470 * t - + 0.1099906382 * t2 - 0.09274533184 * t2 * t - + 0.03543327418 * t4 + 0.005644855518 * t4 * t - - 0.01111434424 * pow(t, 6); - } else if (std_normal_lcdf_deriv_scaled_y > 0.8) { - // use Taylor expansion centred around x=1.15 - t = std_normal_lcdf_deriv_scaled_y - 1.15; - t2 = t * t; - t4 = pow(t, 4); - std_normal_lcdf_dnlcdf = 0.1585747034 - 0.3898677543 * t - + 0.3515963775 * t2 - 0.09748053605 * t2 * t - - 0.04347986191 * t4 + 0.02182506378 * t4 * t - + 0.01074751427 * pow(t, 6); - } else if (std_normal_lcdf_deriv_scaled_y > 0.1) { - // use Taylor expansion centred around x=0.45 - t = std_normal_lcdf_deriv_scaled_y - 0.45; - t2 = t * t; - t4 = pow(t, 4); - std_normal_lcdf_dnlcdf = 0.6245634904 - 0.9521866949 * t - + 0.3986215682 * t2 + 0.04700850676 * t2 * t - - 0.03478651979 * t4 - 0.01772675404 * t4 * t - + 0.0006577254811 * pow(t, 6); - } else if (10.0 * log(fabs(std_normal_lcdf_deriv_scaled_y)) - < log(DBL_MAX)) { - // approximation derived from Abramowitz and Stegun (1964) 7.1.26 - // use fact that erf(x)=-erf(-x) - // Abramowitz and Stegun define this for -inf std_normal_lcdf(const T_y_cl& y) { auto y_not_nan_expr = !isnan(y_val); auto scaled_y = y_val * INV_SQRT_TWO; - auto x2 = square(scaled_y); - auto lcdf_expr = colwise_sum( - opencl_code( - std::make_tuple("std_normal_lcdf_scaled_y", "std_normal_lcdf_x2"), - scaled_y, x2) - .template output("std_normal_lcdf_lcdf_n")); - auto dnlcdf = opencl_code( - std::make_tuple("std_normal_lcdf_deriv_scaled_y", - "std_normal_lcdf_deriv_x2"), - scaled_y, x2) - .template output("std_normal_lcdf_dnlcdf"); + auto lcdf_expr = colwise_sum(std_normal_lcdf_scaled_impl(scaled_y)); + auto dnlcdf = std_normal_lcdf_dscaled_impl(scaled_y); auto y_deriv = dnlcdf * INV_SQRT_TWO; matrix_cl lcdf_cl; diff --git a/test/unit/math/opencl/device_functions/lbeta_test.cpp b/test/unit/math/opencl/device_functions/lbeta_test.cpp index d07ed9e11c7..5ebf424882d 100644 --- a/test/unit/math/opencl/device_functions/lbeta_test.cpp +++ b/test/unit/math/opencl/device_functions/lbeta_test.cpp @@ -11,7 +11,7 @@ static const std::string test_lbeta_kernel_code = STRINGIFY(__kernel void test( __global double *C, __global double *B, __global double *A) { const int i = get_global_id(0); - C[i] = lbeta(A[i], B[i]); + C[i] = stan_lbeta(A[i], B[i]); }); const stan::math::opencl_kernels::kernel_cl< @@ -42,7 +42,7 @@ TEST(MathMatrixCL, lbeta_edge_cases) { a << NAN, INFINITY, 1.0E50; Eigen::VectorXd b(3); - a << 1, 1, 1; + b << 1, 1, 1; stan::math::matrix_cl a_cl(a); stan::math::matrix_cl b_cl(b); diff --git a/test/unit/math/opencl/rev/exp_mod_normal_lcdf_test.cpp b/test/unit/math/opencl/rev/exp_mod_normal_lcdf_test.cpp index 8aa201f3a4f..cb7631c0dba 100644 --- a/test/unit/math/opencl/rev/exp_mod_normal_lcdf_test.cpp +++ b/test/unit/math/opencl/rev/exp_mod_normal_lcdf_test.cpp @@ -146,7 +146,7 @@ TEST(ProbDistributionsDoubleExpModNormalLcdf, } TEST(ProbDistributionsDoubleExpModNormalLcdf, opencl_broadcast_y) { - int N = 3; + constexpr int N = 3; double y_scal = 12.3; Eigen::VectorXd mu(N); @@ -164,7 +164,7 @@ TEST(ProbDistributionsDoubleExpModNormalLcdf, opencl_broadcast_y) { } TEST(ProbDistributionsDoubleExpModNormalLcdf, opencl_matches_cpu_big) { - int N = 153; + constexpr int N = 153; Eigen::Matrix y = Eigen::Array::Random(N, 1).abs(); @@ -175,13 +175,29 @@ TEST(ProbDistributionsDoubleExpModNormalLcdf, opencl_matches_cpu_big) { + 0.1; Eigen::Matrix lambda = Eigen::Array::Random(N, 1).abs(); - stan::math::test::compare_cpu_opencl_prim_rev(exp_mod_normal_lcdf_functor, y, mu, sigma, lambda); +} + +TEST(ProbDistributionsDoubleExpModNormalLcdf, + opencl_matches_cpu_big_transpose) { + constexpr int N = 153; + + Eigen::Matrix y + = Eigen::Array::Random(N, 1).abs(); + Eigen::Matrix mu + = Eigen::Array::Random(N, 1).abs(); + Eigen::Matrix sigma + = Eigen::Array::Random(N, 1).abs().array() + + 0.1; + Eigen::Matrix lambda + = Eigen::Array::Random(N, 1).abs(); stan::math::test::compare_cpu_opencl_prim_rev( - exp_mod_normal_lcdf_functor, y.transpose().eval(), mu.transpose().eval(), - sigma.transpose().eval(), lambda.transpose().eval()); + exp_mod_normal_lcdf_functor, stan::test::relative_tolerance(1.5e-8), + y.transpose().eval(), mu.transpose().eval(), sigma.transpose().eval(), + lambda.transpose().eval()); } + } // namespace exp_mod_normal_lcdf_test #endif diff --git a/test/unit/math/opencl/rev/exp_mod_normal_lpdf_test.cpp b/test/unit/math/opencl/rev/exp_mod_normal_lpdf_test.cpp index e8c0e406fa4..f418e4b68ff 100644 --- a/test/unit/math/opencl/rev/exp_mod_normal_lpdf_test.cpp +++ b/test/unit/math/opencl/rev/exp_mod_normal_lpdf_test.cpp @@ -235,11 +235,55 @@ TEST(ProbDistributionsExpModNormal, opencl_matches_cpu_big) { stan::math::test::compare_cpu_opencl_prim_rev(exp_mod_normal_lpdf_functor, y, mu, sigma, lambda); +} + +TEST(ProbDistributionsExpModNormal, opencl_matches_cpu_big_propto) { + int N = 153; + + Eigen::Matrix y + = Eigen::Array::Random(N, 1).abs(); + Eigen::Matrix mu + = Eigen::Array::Random(N, 1).abs(); + Eigen::Matrix sigma + = Eigen::Array::Random(N, 1).abs().array() + + 0.1; + Eigen::Matrix lambda + = Eigen::Array::Random(N, 1).abs(); + stan::math::test::compare_cpu_opencl_prim_rev( exp_mod_normal_lpdf_functor_propto, y, mu, sigma, lambda); +} + +TEST(ProbDistributionsExpModNormal, opencl_matches_cpu_big_transpose) { + int N = 153; + + Eigen::Matrix y + = Eigen::Array::Random(N, 1).abs(); + Eigen::Matrix mu + = Eigen::Array::Random(N, 1).abs(); + Eigen::Matrix sigma + = Eigen::Array::Random(N, 1).abs().array() + + 0.1; + Eigen::Matrix lambda + = Eigen::Array::Random(N, 1).abs(); stan::math::test::compare_cpu_opencl_prim_rev( exp_mod_normal_lpdf_functor, y.transpose().eval(), mu.transpose().eval(), sigma.transpose().eval(), lambda.transpose().eval()); +} + +TEST(ProbDistributionsExpModNormal, opencl_matches_cpu_big_propto_transpose) { + int N = 153; + + Eigen::Matrix y + = Eigen::Array::Random(N, 1).abs(); + Eigen::Matrix mu + = Eigen::Array::Random(N, 1).abs(); + Eigen::Matrix sigma + = Eigen::Array::Random(N, 1).abs().array() + + 0.1; + Eigen::Matrix lambda + = Eigen::Array::Random(N, 1).abs(); + stan::math::test::compare_cpu_opencl_prim_rev( exp_mod_normal_lpdf_functor_propto, y.transpose().eval(), mu.transpose().eval(), sigma.transpose().eval(), diff --git a/test/unit/math/opencl/util.hpp b/test/unit/math/opencl/util.hpp index de712ee6279..b453edeec61 100644 --- a/test/unit/math/opencl/util.hpp +++ b/test/unit/math/opencl/util.hpp @@ -48,46 +48,60 @@ auto var_argument(const T& x) { } template * = nullptr> -inline void expect_eq(T a, T b, const char* msg) { - stan::test::expect_near_rel(msg, a, b); +inline void expect_eq(T a, T b, const char* msg, + stan::test::relative_tolerance tol + = stan::test::relative_tolerance()) { + stan::test::expect_near_rel(msg, a, b, tol); } -inline void expect_eq(math::var a, math::var b, const char* msg) { - stan::test::expect_near_rel(msg, a.val(), b.val()); +inline void expect_eq(math::var a, math::var b, const char* msg, + stan::test::relative_tolerance tol + = stan::test::relative_tolerance()) { + stan::test::expect_near_rel(msg, a.val(), b.val(), tol); } template * = nullptr, require_all_not_st_var* = nullptr> -inline void expect_eq(const T1& a, const T2& b, const char* msg) { +inline void expect_eq(const T1& a, const T2& b, const char* msg, + stan::test::relative_tolerance tol + = stan::test::relative_tolerance()) { EXPECT_EQ(a.rows(), b.rows()) << msg; EXPECT_EQ(a.cols(), b.cols()) << msg; const auto& a_ref = math::to_ref(a); const auto& b_ref = math::to_ref(b); for (int i = 0; i < a.rows(); i++) { for (int j = 0; j < a.cols(); j++) { - expect_eq(a_ref(i, j), b_ref(i, j), msg); + expect_eq(a_ref(i, j), b_ref(i, j), msg, tol); } } } template * = nullptr> -inline void expect_eq(const T1& a, const T2& b, const char* msg) { - expect_eq(a.val(), b.val(), msg); +inline void expect_eq(const T1& a, const T2& b, const char* msg, + stan::test::relative_tolerance tol + = stan::test::relative_tolerance()) { + expect_eq(a.val(), b.val(), msg, tol); } template inline void expect_eq(const std::vector& a, const std::vector& b, - const char* msg) { + const char* msg, + stan::test::relative_tolerance tol + = stan::test::relative_tolerance()) { EXPECT_EQ(a.size(), b.size()); for (int i = 0; i < a.size(); i++) { - expect_eq(a[i], b[i], msg); + expect_eq(a[i], b[i], msg, tol); } } template * = nullptr> -inline void expect_eq(const T1& a, const T2& b, const char* msg) { - expect_eq(from_matrix_cl>(a), b, msg); +inline void expect_eq(const T1& a, const T2& b, const char* msg, + stan::test::relative_tolerance tol + = stan::test::relative_tolerance()) { + expect_eq(from_matrix_cl>(a), b, msg, tol); } template * = nullptr> -inline void expect_eq(const T1& a, const T2& b, const char* msg) { - expect_eq(a, from_matrix_cl>(b), msg); +inline void expect_eq(const T1& a, const T2& b, const char* msg, + stan::test::relative_tolerance tol + = stan::test::relative_tolerance()) { + expect_eq(a, from_matrix_cl>(b), msg, tol); } template @@ -106,7 +120,8 @@ auto recursive_sum(const std::vector& a) { template * = nullptr> inline void expect_adj_near(const T& a, const T& b, const char* msg) {} inline void expect_adj_near(var a, var b, const char* msg) { - stan::test::expect_near_rel(msg, a.adj(), b.adj()); + stan::test::expect_near_rel(msg, a.adj(), b.adj(), + stan::test::relative_tolerance(1e-5)); } template * = nullptr, require_vt_same* = nullptr> @@ -115,7 +130,8 @@ inline void expect_adj_near(const T1& a, const T2& b, const char* msg) { EXPECT_EQ(a.cols(), b.cols()) << msg; const auto& a_ref = math::to_ref(a); const auto& b_ref = math::to_ref(b); - stan::test::expect_near_rel(msg, a_ref.adj(), b_ref.adj()); + stan::test::expect_near_rel(msg, a_ref.adj(), b_ref.adj(), + stan::test::relative_tolerance(1e-5)); } template inline void expect_adj_near(const std::vector& a, const std::vector& b, @@ -157,10 +173,11 @@ inline void prim_rev_argument_combinations(const Functor& f, const Arg0& arg0, template inline void compare_cpu_opencl_prim_rev_impl(const Functor& functor, + stan::test::relative_tolerance tol, std::index_sequence, const Args&... args) { prim_rev_argument_combinations( - [&functor](const auto& args_for_cpu, const auto& args_for_opencl) { + [&functor, tol](const auto& args_for_cpu, const auto& args_for_opencl) { std::string signature = type_name().data(); try { auto res_cpu = eval(functor(std::get(args_for_cpu)...)); @@ -169,7 +186,8 @@ inline void compare_cpu_opencl_prim_rev_impl(const Functor& functor, expect_eq(res_opencl, res_cpu, ("CPU and OpenCL return values do not match for signature " + signature + "!") - .c_str()); + .c_str(), + tol); var(recursive_sum(res_cpu) + recursive_sum(res_opencl)).grad(); static_cast(std::initializer_list{ @@ -194,11 +212,12 @@ template inline void compare_cpu_opencl_prim_rev_impl(const FunctorCPU& functorCPU, const FunctorCL& functorCL, + stan::test::relative_tolerance tol, std::index_sequence, const Args&... args) { prim_rev_argument_combinations( - [&functorCPU, &functorCL](const auto& args_for_cpu, - const auto& args_for_opencl) { + [&functorCPU, &functorCL, tol](const auto& args_for_cpu, + const auto& args_for_opencl) { auto res_cpu = eval(functorCPU(std::get(args_for_cpu)...)); auto res_opencl = eval( functorCL(opencl_argument(std::get(args_for_opencl))...)); @@ -206,7 +225,8 @@ inline void compare_cpu_opencl_prim_rev_impl(const FunctorCPU& functorCPU, expect_eq(res_opencl, res_cpu, ("CPU and OpenCL return values do not match for signature " + signature + "!") - .c_str()); + .c_str(), + tol); var(recursive_sum(res_cpu) + recursive_sum(res_opencl)).grad(); static_cast(std::initializer_list{ @@ -332,7 +352,17 @@ template inline void compare_cpu_opencl_prim_rev(const Functor& functor, const Args&... args) { internal::compare_cpu_opencl_prim_rev_impl( - functor, std::make_index_sequence{}, args...); + functor, stan::test::relative_tolerance(), + std::make_index_sequence{}, args...); + recover_memory(); +} + +template +inline void compare_cpu_opencl_prim_rev(const Functor& functor, + stan::test::relative_tolerance tol, + const Args&... args) { + internal::compare_cpu_opencl_prim_rev_impl( + functor, tol, std::make_index_sequence{}, args...); recover_memory(); } @@ -358,7 +388,17 @@ inline void compare_cpu_opencl_prim_rev_separate(const FunctorCPU& functorCPU, const FunctorCL& fucntorCL, const Args&... args) { internal::compare_cpu_opencl_prim_rev_impl( - functorCPU, fucntorCL, std::make_index_sequence{}, + functorCPU, fucntorCL, stan::test::relative_tolerance(), + std::make_index_sequence{}, args...); + recover_memory(); +} + +template +inline void compare_cpu_opencl_prim_rev_separate( + const FunctorCPU& functorCPU, const FunctorCL& fucntorCL, + stan::test::relative_tolerance tol, const Args&... args) { + internal::compare_cpu_opencl_prim_rev_impl( + functorCPU, fucntorCL, tol, std::make_index_sequence{}, args...); recover_memory(); }