From 1829c1e1f1042a999170001a3ab834de30cdd550 Mon Sep 17 00:00:00 2001 From: Ewan Crawford Date: Tue, 7 May 2024 18:02:38 +0100 Subject: [PATCH] Introduce extension Macros Implement idea from https://github.com/KhronosGroup/OpenCL-Headers/issues/248 to add an version macro to the extension headers so that users can guard application code using the macro to ensure the correct APIs are being used. Extensions can then increment the version when they change the APIs without breaking user code. See [CL_MAKE_VERSION](https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#CL_MAKE_VERSION) for how the macro version is defined. --- CL/cl.h | 6 +- CL/cl_ext.h | 366 ++++++++++++++++++++++++++++++++-- scripts/cl_ext.h.mako | 16 ++ tests/lang_c/CMakeLists.txt | 1 + tests/lang_cpp/CMakeLists.txt | 2 +- tests/test_ext_headers.c | 55 +++++ 6 files changed, 418 insertions(+), 28 deletions(-) create mode 100644 tests/test_ext_headers.c diff --git a/CL/cl.h b/CL/cl.h index afeeb4ee..5cd6aee7 100644 --- a/CL/cl.h +++ b/CL/cl.h @@ -113,8 +113,8 @@ typedef cl_bitfield cl_device_atomic_capabilities; typedef cl_bitfield cl_device_device_enqueue_capabilities; typedef cl_uint cl_khronos_vendor_id; typedef cl_properties cl_mem_properties; -typedef cl_uint cl_version; #endif +typedef cl_uint cl_version; typedef struct _cl_image_format { cl_channel_order image_channel_order; @@ -914,8 +914,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) @@ -939,8 +937,6 @@ typedef struct _cl_name_version { (((minor) & CL_VERSION_MINOR_MASK) << CL_VERSION_PATCH_BITS) | \ ((patch) & CL_VERSION_PATCH_MASK)) -#endif - /********************************************************************************************************/ /* CL_NO_PROTOTYPES implies CL_NO_CORE_PROTOTYPES: */ diff --git a/CL/cl_ext.h b/CL/cl_ext.h index 67d1f805..f3f119c5 100644 --- a/CL/cl_ext.h +++ b/CL/cl_ext.h @@ -51,6 +51,9 @@ extern "C" { #define CL_KHR_COMMAND_BUFFER_EXTENSION_NAME \ "cl_khr_command_buffer" + +#define CL_KHR_COMMAND_BUFFER_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 4) + 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; @@ -539,6 +542,9 @@ clCommandSVMMemFillKHR( #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, 1) + typedef cl_bitfield cl_platform_command_buffer_capabilities_khr; /* cl_platform_info */ @@ -596,6 +602,9 @@ clRemapCommandBufferKHR( #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, 1) + typedef cl_uint cl_command_buffer_structure_type_khr; typedef cl_bitfield cl_mutable_dispatch_fields_khr; typedef cl_uint cl_mutable_command_info_khr; @@ -719,6 +728,9 @@ clGetMutableCommandInfoKHR( #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 @@ -732,6 +744,9 @@ clGetMutableCommandInfoKHR( #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 @@ -743,6 +758,9 @@ clGetMutableCommandInfoKHR( "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, @@ -770,6 +788,9 @@ clSetMemObjectDestructorAPPLE( "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, @@ -832,6 +853,9 @@ clLogMessagesToStderrAPPLE( #define CL_KHR_ICD_EXTENSION_NAME \ "cl_khr_icd" + +#define CL_KHR_ICD_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + /* cl_platform_info */ #define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920 @@ -865,6 +889,9 @@ clIcdGetPlatformIDsKHR( #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 @@ -900,6 +927,9 @@ clCreateProgramWithILKHR( #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 @@ -911,6 +941,9 @@ clCreateProgramWithILKHR( #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 */ @@ -927,6 +960,9 @@ typedef cl_bitfield cl_context_memory_initialize_khr; #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 */ @@ -964,6 +1000,9 @@ clTerminateContextKHR( #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 @@ -977,6 +1016,9 @@ clTerminateContextKHR( #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; @@ -1008,6 +1050,9 @@ clCreateCommandQueueWithPropertiesKHR( #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 @@ -1024,6 +1069,9 @@ clCreateCommandQueueWithPropertiesKHR( #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 @@ -1054,6 +1102,9 @@ clCreateCommandQueueWithPropertiesKHR( #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 @@ -1065,6 +1116,9 @@ clCreateCommandQueueWithPropertiesKHR( #define CL_EXT_DEVICE_FISSION_EXTENSION_NAME \ "cl_ext_device_fission" + +#define CL_EXT_DEVICE_FISSION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + typedef cl_ulong cl_device_partition_property_ext; /* Error codes */ @@ -1151,6 +1205,9 @@ clCreateSubDevicesEXT( #define CL_EXT_MIGRATE_MEMOBJECT_EXTENSION_NAME \ "cl_ext_migrate_memobject" + +#define CL_EXT_MIGRATE_MEMOBJECT_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + typedef cl_bitfield cl_mem_migration_flags_ext; /* cl_mem_migration_flags_ext */ @@ -1194,6 +1251,9 @@ clEnqueueMigrateMemObjectEXT( #define CL_EXT_CXX_FOR_OPENCL_EXTENSION_NAME \ "cl_ext_cxx_for_opencl" + +#define CL_EXT_CXX_FOR_OPENCL_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + /* cl_device_info */ #define CL_DEVICE_CXX_FOR_OPENCL_NUMERIC_VERSION_EXT 0x4230 @@ -1204,6 +1264,9 @@ clEnqueueMigrateMemObjectEXT( #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; @@ -1264,6 +1327,9 @@ clGetDeviceImageInfoQCOM( #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 @@ -1274,6 +1340,9 @@ clGetDeviceImageInfoQCOM( #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; @@ -1291,6 +1360,9 @@ typedef struct _cl_mem_ion_host_ptr { #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; @@ -1307,6 +1379,9 @@ typedef struct _cl_mem_android_native_buffer_host_ptr { #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 @@ -1318,6 +1393,9 @@ typedef struct _cl_mem_android_native_buffer_host_ptr { #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) @@ -1329,6 +1407,9 @@ typedef struct _cl_mem_android_native_buffer_host_ptr { #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 @@ -1394,6 +1475,9 @@ clEnqueueReleaseGrallocObjectsIMG( #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 */ @@ -1442,6 +1526,9 @@ clEnqueueGenerateMipmapIMG( #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 @@ -1463,6 +1550,9 @@ clEnqueueGenerateMipmapIMG( #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; @@ -1510,6 +1600,9 @@ clGetKernelSubGroupInfoKHR( #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 @@ -1522,6 +1615,9 @@ clGetKernelSubGroupInfoKHR( #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; @@ -1540,6 +1636,9 @@ typedef cl_uint cl_queue_priority_khr; #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; @@ -1558,6 +1657,9 @@ typedef cl_uint cl_queue_throttle_khr; #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 @@ -1568,6 +1670,9 @@ typedef cl_uint cl_queue_throttle_khr; #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 @@ -1611,6 +1716,9 @@ typedef struct _cl_name_version_khr { #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 @@ -1629,6 +1737,9 @@ typedef struct _cl_name_version_khr { #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; @@ -1647,6 +1758,9 @@ typedef struct _cl_device_pci_bus_info_khr { "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, @@ -1679,6 +1793,9 @@ clGetKernelSuggestedLocalWorkSizeKHR( #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; @@ -1705,6 +1822,9 @@ typedef struct _cl_device_integer_dot_product_acceleration_properties_khr { #define CL_KHR_EXTERNAL_MEMORY_EXTENSION_NAME \ "cl_khr_external_memory" + +#define CL_KHR_EXTERNAL_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + typedef cl_uint cl_external_memory_handle_type_khr; /* cl_platform_info */ @@ -1776,21 +1896,11 @@ clEnqueueReleaseExternalMemObjectsKHR( #define CL_KHR_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME \ "cl_khr_external_memory_dma_buf" -/* cl_external_memory_handle_type_khr */ -#define CL_EXTERNAL_MEMORY_HANDLE_DMA_BUF_KHR 0x2067 -/*************************************************************** -* cl_khr_external_memory_dx -***************************************************************/ -#define cl_khr_external_memory_dx 1 -#define CL_KHR_EXTERNAL_MEMORY_DX_EXTENSION_NAME \ - "cl_khr_external_memory_dx" +#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_D3D11_TEXTURE_KHR 0x2063 -#define CL_EXTERNAL_MEMORY_HANDLE_D3D11_TEXTURE_KMT_KHR 0x2064 -#define CL_EXTERNAL_MEMORY_HANDLE_D3D12_HEAP_KHR 0x2065 -#define CL_EXTERNAL_MEMORY_HANDLE_D3D12_RESOURCE_KHR 0x2066 +#define CL_EXTERNAL_MEMORY_HANDLE_DMA_BUF_KHR 0x2067 /*************************************************************** * cl_khr_external_memory_opaque_fd @@ -1799,6 +1909,9 @@ clEnqueueReleaseExternalMemObjectsKHR( #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 @@ -1809,6 +1922,9 @@ clEnqueueReleaseExternalMemObjectsKHR( #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, 0, 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 @@ -1820,6 +1936,9 @@ clEnqueueReleaseExternalMemObjectsKHR( #define CL_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME \ "cl_khr_external_semaphore" + +#define CL_KHR_EXTERNAL_SEMAPHORE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0) + typedef struct _cl_semaphore_khr * cl_semaphore_khr; typedef cl_uint cl_external_semaphore_handle_type_khr; @@ -1864,16 +1983,6 @@ clGetSemaphoreHandleForTypeKHR( #endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */ -/*************************************************************** -* cl_khr_external_semaphore_dx_fence -***************************************************************/ -#define cl_khr_external_semaphore_dx_fence 1 -#define CL_KHR_EXTERNAL_SEMAPHORE_DX_FENCE_EXTENSION_NAME \ - "cl_khr_external_semaphore_dx_fence" - -/* cl_external_semaphore_handle_type_khr */ -#define CL_SEMAPHORE_HANDLE_D3D12_FENCE_KHR 0x2059 - /*************************************************************** * cl_khr_external_semaphore_opaque_fd ***************************************************************/ @@ -1881,6 +1990,9 @@ clGetSemaphoreHandleForTypeKHR( #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 @@ -1891,6 +2003,9 @@ clGetSemaphoreHandleForTypeKHR( #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 */ @@ -1923,6 +2038,9 @@ clReImportSemaphoreSyncFdKHR( #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, 0) + /* cl_external_semaphore_handle_type_khr */ #define CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR 0x2056 #define CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR 0x2057 @@ -1934,6 +2052,9 @@ clReImportSemaphoreSyncFdKHR( #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; @@ -2081,6 +2202,9 @@ clRetainSemaphoreKHR( #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 */ @@ -2127,6 +2251,9 @@ clImportMemoryARM( #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; @@ -2353,6 +2480,9 @@ clSetKernelExecInfoARM( #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 @@ -2365,6 +2495,9 @@ clSetKernelExecInfoARM( #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 @@ -2378,6 +2511,9 @@ clSetKernelExecInfoARM( #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; @@ -2417,6 +2553,9 @@ typedef cl_bitfield cl_device_scheduling_controls_capabilities_arm; #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; @@ -2447,6 +2586,9 @@ typedef cl_bitfield cl_device_controlled_termination_capabilities_arm; #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) /*************************************************************** @@ -2456,6 +2598,9 @@ typedef cl_bitfield cl_device_controlled_termination_capabilities_arm; #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) @@ -2466,6 +2611,9 @@ typedef cl_bitfield cl_device_controlled_termination_capabilities_arm; #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 */ @@ -2488,6 +2636,9 @@ typedef cl_bitfield cl_device_feature_capabilities_intel; #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 @@ -2498,6 +2649,9 @@ typedef cl_bitfield cl_device_feature_capabilities_intel; #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; @@ -2586,6 +2740,9 @@ clReleaseAcceleratorINTEL( #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; @@ -2622,6 +2779,9 @@ typedef struct _cl_motion_estimation_desc_intel { #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 @@ -2678,6 +2838,9 @@ typedef struct _cl_motion_estimation_desc_intel { #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 @@ -2689,6 +2852,9 @@ typedef struct _cl_motion_estimation_desc_intel { #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 @@ -2699,6 +2865,9 @@ typedef struct _cl_motion_estimation_desc_intel { #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 @@ -2712,6 +2881,9 @@ typedef struct _cl_motion_estimation_desc_intel { #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 @@ -2728,6 +2900,9 @@ typedef struct _cl_motion_estimation_desc_intel { #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_uint cl_diagnostics_verbose_level; /* cl_context_properties */ @@ -2744,6 +2919,9 @@ typedef cl_uint cl_diagnostics_verbose_level; #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 @@ -2762,6 +2940,9 @@ typedef cl_uint cl_diagnostics_verbose_level; #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 @@ -2919,6 +3100,9 @@ typedef cl_uint cl_diagnostics_verbose_level; #define CL_INTEL_UNIFIED_SHARED_MEMORY_EXTENSION_NAME \ "cl_intel_unified_shared_memory" + +#define CL_INTEL_UNIFIED_SHARED_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 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; @@ -3240,6 +3424,9 @@ clEnqueueMemsetINTEL( #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 @@ -3253,6 +3440,9 @@ clEnqueueMemsetINTEL( #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 */ @@ -3288,6 +3478,9 @@ clCreateBufferWithPropertiesINTEL( #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 @@ -3362,6 +3555,9 @@ clEnqueueWriteHostPipeINTEL( #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 @@ -3372,6 +3568,9 @@ clEnqueueWriteHostPipeINTEL( #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) @@ -3382,6 +3581,9 @@ clEnqueueWriteHostPipeINTEL( #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 @@ -3426,6 +3628,9 @@ typedef struct _cl_queue_family_properties_intel { #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) @@ -3436,6 +3641,9 @@ typedef struct _cl_queue_family_properties_intel { #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 ***************************************************************/ @@ -3445,6 +3653,9 @@ typedef struct _cl_queue_family_properties_intel { #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, 0, 0) + /* Types */ typedef cl_uint cl_image_requirements_info_ext; @@ -3501,6 +3712,9 @@ clGetImageRequirementsInfoEXT( #define CL_EXT_IMAGE_FROM_BUFFER_EXTENSION_NAME \ "cl_ext_image_from_buffer" + +#define CL_EXT_IMAGE_FROM_BUFFER_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + /* cl_image_requirements_info_ext */ #define CL_IMAGE_REQUIREMENTS_SLICE_PITCH_ALIGNMENT_EXT 0x1291 @@ -3513,6 +3727,9 @@ clGetImageRequirementsInfoEXT( #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 */ @@ -3550,6 +3767,9 @@ clGetICDLoaderInfoOCLICD( #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 @@ -3563,6 +3783,9 @@ clGetICDLoaderInfoOCLICD( #define CL_EXT_FLOAT_ATOMICS_EXTENSION_NAME \ "cl_ext_float_atomics" + +#define CL_EXT_FLOAT_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + typedef cl_bitfield cl_device_fp_atomic_capabilities_ext; /* cl_device_fp_atomic_capabilities_ext */ @@ -3585,6 +3808,9 @@ typedef cl_bitfield cl_device_fp_atomic_capabilities_ext; #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 @@ -3597,6 +3823,9 @@ typedef cl_bitfield cl_device_fp_atomic_capabilities_ext; "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, @@ -3621,6 +3850,9 @@ clSetContentSizeBufferPoCL( #define CL_EXT_IMAGE_RAW10_RAW12_EXTENSION_NAME \ "cl_ext_image_raw10_raw12" + +#define CL_EXT_IMAGE_RAW10_RAW12_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0) + /* cl_channel_type */ #define CL_UNSIGNED_INT_RAW10_EXT 0x10E3 #define CL_UNSIGNED_INT_RAW12_EXT 0x10E4 @@ -3632,6 +3864,9 @@ clSetContentSizeBufferPoCL( #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 ***************************************************************/ @@ -3639,6 +3874,9 @@ clSetContentSizeBufferPoCL( #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 ***************************************************************/ @@ -3646,6 +3884,9 @@ clSetContentSizeBufferPoCL( #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 ***************************************************************/ @@ -3653,6 +3894,9 @@ clSetContentSizeBufferPoCL( #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 ***************************************************************/ @@ -3660,6 +3904,9 @@ clSetContentSizeBufferPoCL( #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 ***************************************************************/ @@ -3667,6 +3914,9 @@ clSetContentSizeBufferPoCL( #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 ***************************************************************/ @@ -3674,6 +3924,9 @@ clSetContentSizeBufferPoCL( #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_global_int32_base_atomics ***************************************************************/ @@ -3681,6 +3934,9 @@ clSetContentSizeBufferPoCL( #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 ***************************************************************/ @@ -3688,6 +3944,9 @@ clSetContentSizeBufferPoCL( #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 ***************************************************************/ @@ -3695,6 +3954,9 @@ clSetContentSizeBufferPoCL( #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 ***************************************************************/ @@ -3702,6 +3964,9 @@ clSetContentSizeBufferPoCL( #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 ***************************************************************/ @@ -3709,6 +3974,9 @@ clSetContentSizeBufferPoCL( #define CL_KHR_KERNEL_CLOCK_EXTENSION_NAME \ "cl_khr_kernel_clock" + +#define CL_KHR_KERNEL_CLOCK_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 0) + /* cl_device_info */ #define CL_DEVICE_KERNEL_CLOCK_CAPABILITIES_KHR 0x1076 @@ -3726,6 +3994,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3733,6 +4004,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3740,6 +4014,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3747,6 +4024,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3754,6 +4034,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3761,6 +4044,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3768,6 +4054,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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_srgb_image_writes ***************************************************************/ @@ -3775,6 +4064,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3782,6 +4074,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3789,6 +4084,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3796,6 +4094,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3803,6 +4104,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3810,6 +4114,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3817,6 +4124,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3824,6 +4134,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3831,6 +4144,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 ***************************************************************/ @@ -3838,6 +4154,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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_img_cancel_command ***************************************************************/ @@ -3845,6 +4164,9 @@ typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; #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 diff --git a/scripts/cl_ext.h.mako b/scripts/cl_ext.h.mako index c1f89260..f42bb1b1 100644 --- a/scripts/cl_ext.h.mako +++ b/scripts/cl_ext.h.mako @@ -1,4 +1,7 @@ <% +# re.match used to parse extension semantic versions +from re import match + # Extensions to skip by default because they are in dedicated headers: skipExtensions = { 'cl_khr_d3d10_sharing', @@ -312,6 +315,19 @@ extern "C" { #define ${name.upper()}_EXTENSION_NAME ${"\\"} "${name}" +<% + # Use re.match to parse semantic major.minor.patch version + sem_ver = match('[0-9]+\.[0-9]+\.?[0-9]+', extension.get('revision')) + if not sem_ver: + raise TypeError(name + + ' XML revision field is not semantically versioned as "major.minor.patch"') + version = sem_ver[0].split('.') + major = version[0] + minor = version[1] + patch = version[2] +%> +#define ${name.upper()}_EXTENSION_VERSION CL_MAKE_VERSION(${major}, ${minor}, ${patch}) + %for block in extension.findall('require'): % if shouldEmit(block): % if block.get('condition'): diff --git a/tests/lang_c/CMakeLists.txt b/tests/lang_c/CMakeLists.txt index 0678ddef..df8cd5c6 100644 --- a/tests/lang_c/CMakeLists.txt +++ b/tests/lang_c/CMakeLists.txt @@ -16,3 +16,4 @@ add_header_test(cl_platform_h test_cl_platform.h.c) add_header_test(cl_opencl_h test_opencl.h.c) add_header_test(cl_version_h test_cl_version.h.c) add_header_test(headers test_headers.c) +add_header_test(ext_headers test_ext_headers.c) diff --git a/tests/lang_cpp/CMakeLists.txt b/tests/lang_cpp/CMakeLists.txt index 0678ddef..f4ef2341 100644 --- a/tests/lang_cpp/CMakeLists.txt +++ b/tests/lang_cpp/CMakeLists.txt @@ -15,4 +15,4 @@ add_header_test(cl_layer_h test_cl_layer.h.c) add_header_test(cl_platform_h test_cl_platform.h.c) add_header_test(cl_opencl_h test_opencl.h.c) add_header_test(cl_version_h test_cl_version.h.c) -add_header_test(headers test_headers.c) +add_header_test(ext_headers test_ext_headers.c) diff --git a/tests/test_ext_headers.c b/tests/test_ext_headers.c new file mode 100644 index 00000000..36d75088 --- /dev/null +++ b/tests/test_ext_headers.c @@ -0,0 +1,55 @@ +// +// Copyright (c) 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. +// 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. +// + +#include "CL/cl_ext.h" +#include +#include + +int extVersionMacro() { + // Test a non-provisional extension with non-placeholder semantic version. + printf( + "Checking version macro for the cl_khr_integer_dot_product extension\n"); + + cl_version ExtVersion = CL_KHR_INTEGER_DOT_PRODUCT_EXTENSION_VERSION; + cl_version ExtMajorVersion = CL_VERSION_MAJOR(ExtVersion); + cl_version ExtMinorVersion = CL_VERSION_MINOR(ExtVersion); + cl_version ExtPatchVersion = CL_VERSION_PATCH(ExtVersion); + + printf("cl_khr_integer_dot_product version value %" PRIu32 + " which is semantic version %" PRIu32 ".%" PRIu32 ".%" PRIu32 "\n", + ExtVersion, ExtMajorVersion, ExtMinorVersion, ExtPatchVersion); + + // Test vendor extension which uses default semantic version. + printf( + "Checking version macro for the cl_APPLE_SetMemObjectDestructor\n"); + + ExtVersion = CL_APPLE_SETMEMOBJECTDESTRUCTOR_EXTENSION_VERSION; + ExtMajorVersion = CL_VERSION_MAJOR(ExtVersion); + ExtMinorVersion = CL_VERSION_MINOR(ExtVersion); + ExtPatchVersion = CL_VERSION_PATCH(ExtVersion); + + printf("cl_APPLE_SetMemObjectDestructor version value %" PRIu32 + " which is semantic version %" PRIu32 ".%" PRIu32 ".%" PRIu32 "\n", + ExtVersion, ExtMajorVersion, ExtMinorVersion, ExtPatchVersion); + + return 0; +} + +int main(void) { + int Result = extVersionMacro(); + + return Result; +}