From 5088255e9b099b4a2b788566e9e394a9ed7628e7 Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Wed, 23 Oct 2024 14:03:10 -0700 Subject: [PATCH 1/4] update project version and submodules - October 2024 --- CMakeLists.txt | 2 +- external/OpenCL-CLHPP | 2 +- external/OpenCL-Headers | 2 +- external/OpenCL-ICD-Loader | 2 +- lib/src/Extensions/scripts/call_all.c.mako | 3 +- lib/src/Extensions/scripts/openclext.cpp.mako | 18 +- lib/src/Extensions/src/openclext.cpp | 272 +++++++++++++++++- lib/src/Extensions/tests/call_all.c | 37 ++- 8 files changed, 316 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 686243d1..9cbab822 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_CXX_STANDARD 14) project(OpenCL-SDK - VERSION 2024.05.08 + VERSION 2024.10.24 LANGUAGES C CXX ) diff --git a/external/OpenCL-CLHPP b/external/OpenCL-CLHPP index 24288d88..c7b4aded 160000 --- a/external/OpenCL-CLHPP +++ b/external/OpenCL-CLHPP @@ -1 +1 @@ -Subproject commit 24288d88ffe8fc7d99e0b4f540e866aa27fa9628 +Subproject commit c7b4aded1cab9560b226041dd962f63375a9a384 diff --git a/external/OpenCL-Headers b/external/OpenCL-Headers index 3a74ccc2..4ea6df13 160000 --- a/external/OpenCL-Headers +++ b/external/OpenCL-Headers @@ -1 +1 @@ -Subproject commit 3a74ccc235195728ab29c7d7f152fec0574b4b1d +Subproject commit 4ea6df132107e3b4b9407f903204b5522fdffcd6 diff --git a/external/OpenCL-ICD-Loader b/external/OpenCL-ICD-Loader index c5957f40..5907ac11 160000 --- a/external/OpenCL-ICD-Loader +++ b/external/OpenCL-ICD-Loader @@ -1 +1 @@ -Subproject commit c5957f40828509bbcced36431596cec256ee3c12 +Subproject commit 5907ac1114079de4383cecddf1c8640e3f52f92b diff --git a/lib/src/Extensions/scripts/call_all.c.mako b/lib/src/Extensions/scripts/call_all.c.mako index 3f6776b4..24ab5390 100644 --- a/lib/src/Extensions/scripts/call_all.c.mako +++ b/lib/src/Extensions/scripts/call_all.c.mako @@ -74,6 +74,7 @@ defaultValueForType = { # Integral Types 'cl_int' : '0', 'cl_uint' : '0', + 'int' : '0', 'size_t' : '0', 'UINT' : '0', } @@ -118,7 +119,7 @@ def getCallArgs(params): return callstr %>/******************************************************************************* -// Copyright (c) 2021-2023 Ben Ashbaugh +// Copyright (c) 2021-2024 Ben Ashbaugh // // SPDX-License-Identifier: MIT or Apache-2.0 */ diff --git a/lib/src/Extensions/scripts/openclext.cpp.mako b/lib/src/Extensions/scripts/openclext.cpp.mako index 0cf5af02..924fab9e 100644 --- a/lib/src/Extensions/scripts/openclext.cpp.mako +++ b/lib/src/Extensions/scripts/openclext.cpp.mako @@ -116,7 +116,7 @@ def getCParameterStrings(params): return strings %>/******************************************************************************* -// Copyright (c) 2021-2023 Ben Ashbaugh +// Copyright (c) 2021-2024 Ben Ashbaugh // // SPDX-License-Identifier: MIT or Apache-2.0 */ @@ -271,6 +271,20 @@ static inline cl_platform_id _get_platform(cl_mem memobj) return _get_platform(context); } +static inline cl_platform_id _get_platform(cl_event event) +{ + if (event == nullptr) return nullptr; + + cl_context context = nullptr; + clGetEventInfo( + event, + CL_EVENT_CONTEXT, + sizeof(context), + &context, + nullptr); + return _get_platform(context); +} + /*************************************************************** * Function Pointer Typedefs ***************************************************************/ @@ -739,6 +753,8 @@ ${api.RetType} CL_API_CALL ${api.Name}( struct openclext_dispatch_table* dispatch_ptr = _get_dispatch(${api.Params[0].Name} > 0 && ${api.Params[1].Name} ? ${api.Params[1].Name}[0] : nullptr); % elif api.Name == "clEnqueueCommandBufferKHR": struct openclext_dispatch_table* dispatch_ptr = _get_dispatch(${api.Params[2].Name}); +% elif api.Name == "clCancelCommandsIMG": + struct openclext_dispatch_table* dispatch_ptr = _get_dispatch(${api.Params[1].Name} > 0 && ${api.Params[0].Name} ? ${api.Params[0].Name}[0] : nullptr); % else: struct openclext_dispatch_table* dispatch_ptr = _get_dispatch(${api.Params[0].Name}); % endif diff --git a/lib/src/Extensions/src/openclext.cpp b/lib/src/Extensions/src/openclext.cpp index c4f3afd5..b8628eaf 100644 --- a/lib/src/Extensions/src/openclext.cpp +++ b/lib/src/Extensions/src/openclext.cpp @@ -1,5 +1,5 @@ /******************************************************************************* -// Copyright (c) 2021-2023 Ben Ashbaugh +// Copyright (c) 2021-2024 Ben Ashbaugh // // SPDX-License-Identifier: MIT or Apache-2.0 */ @@ -154,6 +154,20 @@ static inline cl_platform_id _get_platform(cl_mem memobj) return _get_platform(context); } +static inline cl_platform_id _get_platform(cl_event event) +{ + if (event == nullptr) return nullptr; + + cl_context context = nullptr; + clGetEventInfo( + event, + CL_EVENT_CONTEXT, + sizeof(context), + &context, + nullptr); + return _get_platform(context); +} + /*************************************************************** * Function Pointer Typedefs ***************************************************************/ @@ -186,6 +200,7 @@ typedef cl_int (CL_API_CALL* clEnqueueCommandBufferKHR_clextfn)( typedef cl_int (CL_API_CALL* clCommandBarrierWithWaitListKHR_clextfn)( 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, @@ -194,6 +209,7 @@ typedef cl_int (CL_API_CALL* clCommandBarrierWithWaitListKHR_clextfn)( typedef cl_int (CL_API_CALL* clCommandCopyBufferKHR_clextfn)( 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, @@ -207,6 +223,7 @@ typedef cl_int (CL_API_CALL* clCommandCopyBufferKHR_clextfn)( typedef cl_int (CL_API_CALL* clCommandCopyBufferRectKHR_clextfn)( 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, @@ -224,6 +241,7 @@ typedef cl_int (CL_API_CALL* clCommandCopyBufferRectKHR_clextfn)( typedef cl_int (CL_API_CALL* clCommandCopyBufferToImageKHR_clextfn)( 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, @@ -237,6 +255,7 @@ typedef cl_int (CL_API_CALL* clCommandCopyBufferToImageKHR_clextfn)( typedef cl_int (CL_API_CALL* clCommandCopyImageKHR_clextfn)( 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, @@ -250,6 +269,7 @@ typedef cl_int (CL_API_CALL* clCommandCopyImageKHR_clextfn)( typedef cl_int (CL_API_CALL* clCommandCopyImageToBufferKHR_clextfn)( 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, @@ -263,6 +283,7 @@ typedef cl_int (CL_API_CALL* clCommandCopyImageToBufferKHR_clextfn)( typedef cl_int (CL_API_CALL* clCommandFillBufferKHR_clextfn)( 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, @@ -276,6 +297,7 @@ typedef cl_int (CL_API_CALL* clCommandFillBufferKHR_clextfn)( typedef cl_int (CL_API_CALL* clCommandFillImageKHR_clextfn)( 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, @@ -288,7 +310,7 @@ typedef cl_int (CL_API_CALL* clCommandFillImageKHR_clextfn)( typedef cl_int (CL_API_CALL* clCommandNDRangeKernelKHR_clextfn)( cl_command_buffer_khr command_buffer, cl_command_queue command_queue, - const cl_ndrange_kernel_command_properties_khr* properties, + const cl_command_properties_khr* properties, cl_kernel kernel, cl_uint work_dim, const size_t* global_work_offset, @@ -306,15 +328,58 @@ typedef cl_int (CL_API_CALL* clGetCommandBufferInfoKHR_clextfn)( void* param_value, size_t* param_value_size_ret); +typedef cl_int (CL_API_CALL* clCommandSVMMemcpyKHR_clextfn)( + 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 cl_int (CL_API_CALL* clCommandSVMMemFillKHR_clextfn)( + 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); + #else #pragma message("Define for cl_khr_command_buffer was not found! Please update your headers.") #endif // defined(cl_khr_command_buffer) +#if defined(cl_khr_command_buffer_multi_device) + +typedef cl_command_buffer_khr (CL_API_CALL* clRemapCommandBufferKHR_clextfn)( + 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); + +#else +#pragma message("Define for cl_khr_command_buffer_multi_device was not found! Please update your headers.") +#endif // defined(cl_khr_command_buffer_multi_device) + #if defined(cl_khr_command_buffer_mutable_dispatch) typedef cl_int (CL_API_CALL* clUpdateMutableCommandsKHR_clextfn)( cl_command_buffer_khr command_buffer, - const cl_mutable_base_config_khr* mutable_config); + cl_uint num_configs, + const cl_command_buffer_update_type_khr* config_types, + const void** configs); typedef cl_int (CL_API_CALL* clGetMutableCommandInfoKHR_clextfn)( cl_mutable_command_khr command, @@ -569,6 +634,17 @@ typedef cl_int (CL_API_CALL* clGetSemaphoreHandleForTypeKHR_clextfn)( #pragma message("Define for cl_khr_external_semaphore was not found! Please update your headers.") #endif // defined(cl_khr_external_semaphore) +#if defined(cl_khr_external_semaphore_sync_fd) + +typedef cl_int (CL_API_CALL* clReImportSemaphoreSyncFdKHR_clextfn)( + cl_semaphore_khr sema_object, + cl_semaphore_reimport_properties_khr* reimport_props, + int fd); + +#else +#pragma message("Define for cl_khr_external_semaphore_sync_fd was not found! Please update your headers.") +#endif // defined(cl_khr_external_semaphore_sync_fd) + #if defined(CLEXT_INCLUDE_GL) #if defined(cl_khr_gl_event) @@ -814,6 +890,16 @@ typedef cl_int (CL_API_CALL* clSetKernelExecInfoARM_clextfn)( #pragma message("Define for cl_arm_shared_virtual_memory was not found! Please update your headers.") #endif // defined(cl_arm_shared_virtual_memory) +#if defined(cl_img_cancel_command) + +typedef cl_int (CL_API_CALL* clCancelCommandsIMG_clextfn)( + const cl_event* event_list, + size_t num_events_in_list); + +#else +#pragma message("Define for cl_img_cancel_command was not found! Please update your headers.") +#endif // defined(cl_img_cancel_command) + #if defined(cl_img_generate_mipmap) typedef cl_int (CL_API_CALL* clEnqueueGenerateMipmapIMG_clextfn)( @@ -1248,8 +1334,14 @@ struct openclext_dispatch_table { clCommandFillImageKHR_clextfn clCommandFillImageKHR; clCommandNDRangeKernelKHR_clextfn clCommandNDRangeKernelKHR; clGetCommandBufferInfoKHR_clextfn clGetCommandBufferInfoKHR; + clCommandSVMMemcpyKHR_clextfn clCommandSVMMemcpyKHR; + clCommandSVMMemFillKHR_clextfn clCommandSVMMemFillKHR; #endif // defined(cl_khr_command_buffer) +#if defined(cl_khr_command_buffer_multi_device) + clRemapCommandBufferKHR_clextfn clRemapCommandBufferKHR; +#endif // defined(cl_khr_command_buffer_multi_device) + #if defined(cl_khr_command_buffer_mutable_dispatch) clUpdateMutableCommandsKHR_clextfn clUpdateMutableCommandsKHR; clGetMutableCommandInfoKHR_clextfn clGetMutableCommandInfoKHR; @@ -1313,6 +1405,10 @@ struct openclext_dispatch_table { clGetSemaphoreHandleForTypeKHR_clextfn clGetSemaphoreHandleForTypeKHR; #endif // defined(cl_khr_external_semaphore) +#if defined(cl_khr_external_semaphore_sync_fd) + clReImportSemaphoreSyncFdKHR_clextfn clReImportSemaphoreSyncFdKHR; +#endif // defined(cl_khr_external_semaphore_sync_fd) + #if defined(CLEXT_INCLUDE_GL) #if defined(cl_khr_gl_event) clCreateEventFromGLsyncKHR_clextfn clCreateEventFromGLsyncKHR; @@ -1374,6 +1470,10 @@ struct openclext_dispatch_table { clSetKernelExecInfoARM_clextfn clSetKernelExecInfoARM; #endif // defined(cl_arm_shared_virtual_memory) +#if defined(cl_img_cancel_command) + clCancelCommandsIMG_clextfn clCancelCommandsIMG; +#endif // defined(cl_img_cancel_command) + #if defined(cl_img_generate_mipmap) clEnqueueGenerateMipmapIMG_clextfn clEnqueueGenerateMipmapIMG; #endif // defined(cl_img_generate_mipmap) @@ -1510,8 +1610,14 @@ static void _init(cl_platform_id platform, openclext_dispatch_table* dispatch_pt CLEXT_GET_EXTENSION(clCommandFillImageKHR); CLEXT_GET_EXTENSION(clCommandNDRangeKernelKHR); CLEXT_GET_EXTENSION(clGetCommandBufferInfoKHR); + CLEXT_GET_EXTENSION(clCommandSVMMemcpyKHR); + CLEXT_GET_EXTENSION(clCommandSVMMemFillKHR); #endif // defined(cl_khr_command_buffer) +#if defined(cl_khr_command_buffer_multi_device) + CLEXT_GET_EXTENSION(clRemapCommandBufferKHR); +#endif // defined(cl_khr_command_buffer_multi_device) + #if defined(cl_khr_command_buffer_mutable_dispatch) CLEXT_GET_EXTENSION(clUpdateMutableCommandsKHR); CLEXT_GET_EXTENSION(clGetMutableCommandInfoKHR); @@ -1575,6 +1681,10 @@ static void _init(cl_platform_id platform, openclext_dispatch_table* dispatch_pt CLEXT_GET_EXTENSION(clGetSemaphoreHandleForTypeKHR); #endif // defined(cl_khr_external_semaphore) +#if defined(cl_khr_external_semaphore_sync_fd) + CLEXT_GET_EXTENSION(clReImportSemaphoreSyncFdKHR); +#endif // defined(cl_khr_external_semaphore_sync_fd) + #if defined(CLEXT_INCLUDE_GL) #if defined(cl_khr_gl_event) CLEXT_GET_EXTENSION(clCreateEventFromGLsyncKHR); @@ -1636,6 +1746,10 @@ static void _init(cl_platform_id platform, openclext_dispatch_table* dispatch_pt CLEXT_GET_EXTENSION(clSetKernelExecInfoARM); #endif // defined(cl_arm_shared_virtual_memory) +#if defined(cl_img_cancel_command) + CLEXT_GET_EXTENSION(clCancelCommandsIMG); +#endif // defined(cl_img_cancel_command) + #if defined(cl_img_generate_mipmap) CLEXT_GET_EXTENSION(clEnqueueGenerateMipmapIMG); #endif // defined(cl_img_generate_mipmap) @@ -2069,6 +2183,7 @@ cl_int CL_API_CALL clEnqueueCommandBufferKHR( 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, @@ -2081,6 +2196,7 @@ cl_int CL_API_CALL clCommandBarrierWithWaitListKHR( return dispatch_ptr->clCommandBarrierWithWaitListKHR( command_buffer, command_queue, + properties, num_sync_points_in_wait_list, sync_point_wait_list, sync_point, @@ -2090,6 +2206,7 @@ cl_int CL_API_CALL clCommandBarrierWithWaitListKHR( 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, @@ -2107,6 +2224,7 @@ cl_int CL_API_CALL clCommandCopyBufferKHR( return dispatch_ptr->clCommandCopyBufferKHR( command_buffer, command_queue, + properties, src_buffer, dst_buffer, src_offset, @@ -2121,6 +2239,7 @@ cl_int CL_API_CALL clCommandCopyBufferKHR( 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, @@ -2142,6 +2261,7 @@ cl_int CL_API_CALL clCommandCopyBufferRectKHR( return dispatch_ptr->clCommandCopyBufferRectKHR( command_buffer, command_queue, + properties, src_buffer, dst_buffer, src_origin, @@ -2160,6 +2280,7 @@ cl_int CL_API_CALL clCommandCopyBufferRectKHR( 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, @@ -2177,6 +2298,7 @@ cl_int CL_API_CALL clCommandCopyBufferToImageKHR( return dispatch_ptr->clCommandCopyBufferToImageKHR( command_buffer, command_queue, + properties, src_buffer, dst_image, src_offset, @@ -2191,6 +2313,7 @@ cl_int CL_API_CALL clCommandCopyBufferToImageKHR( 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, @@ -2208,6 +2331,7 @@ cl_int CL_API_CALL clCommandCopyImageKHR( return dispatch_ptr->clCommandCopyImageKHR( command_buffer, command_queue, + properties, src_image, dst_image, src_origin, @@ -2222,6 +2346,7 @@ cl_int CL_API_CALL clCommandCopyImageKHR( 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, @@ -2239,6 +2364,7 @@ cl_int CL_API_CALL clCommandCopyImageToBufferKHR( return dispatch_ptr->clCommandCopyImageToBufferKHR( command_buffer, command_queue, + properties, src_image, dst_buffer, src_origin, @@ -2253,6 +2379,7 @@ cl_int CL_API_CALL clCommandCopyImageToBufferKHR( 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, @@ -2270,6 +2397,7 @@ cl_int CL_API_CALL clCommandFillBufferKHR( return dispatch_ptr->clCommandFillBufferKHR( command_buffer, command_queue, + properties, buffer, pattern, pattern_size, @@ -2284,6 +2412,7 @@ cl_int CL_API_CALL clCommandFillBufferKHR( 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, @@ -2300,6 +2429,7 @@ cl_int CL_API_CALL clCommandFillImageKHR( return dispatch_ptr->clCommandFillImageKHR( command_buffer, command_queue, + properties, image, fill_color, origin, @@ -2313,7 +2443,7 @@ cl_int CL_API_CALL clCommandFillImageKHR( cl_int CL_API_CALL clCommandNDRangeKernelKHR( cl_command_buffer_khr command_buffer, cl_command_queue command_queue, - const cl_ndrange_kernel_command_properties_khr* properties, + const cl_command_properties_khr* properties, cl_kernel kernel, cl_uint work_dim, const size_t* global_work_offset, @@ -2362,13 +2492,105 @@ cl_int CL_API_CALL clGetCommandBufferInfoKHR( param_value_size_ret); } +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) +{ + struct openclext_dispatch_table* dispatch_ptr = _get_dispatch(command_buffer); + if (dispatch_ptr == nullptr || dispatch_ptr->clCommandSVMMemcpyKHR == nullptr) { + return CL_INVALID_OPERATION; + } + return dispatch_ptr->clCommandSVMMemcpyKHR( + command_buffer, + command_queue, + properties, + dst_ptr, + src_ptr, + size, + num_sync_points_in_wait_list, + sync_point_wait_list, + sync_point, + mutable_handle); +} + +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) +{ + struct openclext_dispatch_table* dispatch_ptr = _get_dispatch(command_buffer); + if (dispatch_ptr == nullptr || dispatch_ptr->clCommandSVMMemFillKHR == nullptr) { + return CL_INVALID_OPERATION; + } + return dispatch_ptr->clCommandSVMMemFillKHR( + command_buffer, + command_queue, + properties, + svm_ptr, + pattern, + pattern_size, + size, + num_sync_points_in_wait_list, + sync_point_wait_list, + sync_point, + mutable_handle); +} + #endif // defined(cl_khr_command_buffer) +#if defined(cl_khr_command_buffer_multi_device) + +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) +{ + struct openclext_dispatch_table* dispatch_ptr = _get_dispatch(command_buffer); + if (dispatch_ptr == nullptr || dispatch_ptr->clRemapCommandBufferKHR == nullptr) { + if (errcode_ret) *errcode_ret = CL_INVALID_OPERATION; + return nullptr; + } + return dispatch_ptr->clRemapCommandBufferKHR( + command_buffer, + automatic, + num_queues, + queues, + num_handles, + handles, + handles_ret, + errcode_ret); +} + +#endif // defined(cl_khr_command_buffer_multi_device) + #if defined(cl_khr_command_buffer_mutable_dispatch) cl_int CL_API_CALL clUpdateMutableCommandsKHR( cl_command_buffer_khr command_buffer, - const cl_mutable_base_config_khr* mutable_config) + cl_uint num_configs, + const cl_command_buffer_update_type_khr* config_types, + const void** configs) { struct openclext_dispatch_table* dispatch_ptr = _get_dispatch(command_buffer); if (dispatch_ptr == nullptr || dispatch_ptr->clUpdateMutableCommandsKHR == nullptr) { @@ -2376,7 +2598,9 @@ cl_int CL_API_CALL clUpdateMutableCommandsKHR( } return dispatch_ptr->clUpdateMutableCommandsKHR( command_buffer, - mutable_config); + num_configs, + config_types, + configs); } cl_int CL_API_CALL clGetMutableCommandInfoKHR( @@ -2945,6 +3169,25 @@ cl_int CL_API_CALL clGetSemaphoreHandleForTypeKHR( #endif // defined(cl_khr_external_semaphore) +#if defined(cl_khr_external_semaphore_sync_fd) + +cl_int CL_API_CALL clReImportSemaphoreSyncFdKHR( + cl_semaphore_khr sema_object, + cl_semaphore_reimport_properties_khr* reimport_props, + int fd) +{ + struct openclext_dispatch_table* dispatch_ptr = _get_dispatch(sema_object); + if (dispatch_ptr == nullptr || dispatch_ptr->clReImportSemaphoreSyncFdKHR == nullptr) { + return CL_INVALID_OPERATION; + } + return dispatch_ptr->clReImportSemaphoreSyncFdKHR( + sema_object, + reimport_props, + fd); +} + +#endif // defined(cl_khr_external_semaphore_sync_fd) + #if defined(CLEXT_INCLUDE_GL) #if defined(cl_khr_gl_event) @@ -3480,6 +3723,23 @@ cl_int CL_API_CALL clSetKernelExecInfoARM( #endif // defined(cl_arm_shared_virtual_memory) +#if defined(cl_img_cancel_command) + +cl_int CL_API_CALL clCancelCommandsIMG( + const cl_event* event_list, + size_t num_events_in_list) +{ + struct openclext_dispatch_table* dispatch_ptr = _get_dispatch(num_events_in_list > 0 && event_list ? event_list[0] : nullptr); + if (dispatch_ptr == nullptr || dispatch_ptr->clCancelCommandsIMG == nullptr) { + return CL_INVALID_OPERATION; + } + return dispatch_ptr->clCancelCommandsIMG( + event_list, + num_events_in_list); +} + +#endif // defined(cl_img_cancel_command) + #if defined(cl_img_generate_mipmap) cl_int CL_API_CALL clEnqueueGenerateMipmapIMG( diff --git a/lib/src/Extensions/tests/call_all.c b/lib/src/Extensions/tests/call_all.c index 434d4963..670f0958 100644 --- a/lib/src/Extensions/tests/call_all.c +++ b/lib/src/Extensions/tests/call_all.c @@ -1,5 +1,5 @@ /******************************************************************************* -// Copyright (c) 2021-2023 Ben Ashbaugh +// Copyright (c) 2021-2024 Ben Ashbaugh // // SPDX-License-Identifier: MIT or Apache-2.0 */ @@ -54,20 +54,29 @@ void call_all(void) clRetainCommandBufferKHR(NULL); clReleaseCommandBufferKHR(NULL); clEnqueueCommandBufferKHR(0, NULL, NULL, 0, NULL, NULL); - clCommandBarrierWithWaitListKHR(NULL, NULL, 0, NULL, NULL, NULL); - clCommandCopyBufferKHR(NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL); - clCommandCopyBufferRectKHR(NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL); - clCommandCopyBufferToImageKHR(NULL, NULL, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, NULL); - clCommandCopyImageKHR(NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL); - clCommandCopyImageToBufferKHR(NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL); - clCommandFillBufferKHR(NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL); - clCommandFillImageKHR(NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL); + clCommandBarrierWithWaitListKHR(NULL, NULL, NULL, 0, NULL, NULL, NULL); + clCommandCopyBufferKHR(NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL); + clCommandCopyBufferRectKHR(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL); + clCommandCopyBufferToImageKHR(NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, NULL); + clCommandCopyImageKHR(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL); + clCommandCopyImageToBufferKHR(NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL); + clCommandFillBufferKHR(NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL); + clCommandFillImageKHR(NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL); clCommandNDRangeKernelKHR(NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, NULL, NULL, NULL); clGetCommandBufferInfoKHR(NULL, CL_COMMAND_BUFFER_REFERENCE_COUNT_KHR, 0, NULL, NULL); #endif // cl_khr_command_buffer +#ifdef cl_khr_command_buffer + clCommandSVMMemcpyKHR(NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL); + clCommandSVMMemFillKHR(NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL); +#endif // cl_khr_command_buffer + +#ifdef cl_khr_command_buffer_multi_device + clRemapCommandBufferKHR(NULL, CL_FALSE, 0, NULL, 0, NULL, NULL, NULL); +#endif // cl_khr_command_buffer_multi_device + #ifdef cl_khr_command_buffer_mutable_dispatch - clUpdateMutableCommandsKHR(NULL, NULL); + clUpdateMutableCommandsKHR(NULL, 0, NULL, NULL); clGetMutableCommandInfoKHR(NULL, CL_MUTABLE_COMMAND_COMMAND_BUFFER_KHR, 0, NULL, NULL); #endif // cl_khr_command_buffer_mutable_dispatch @@ -119,6 +128,10 @@ void call_all(void) clGetSemaphoreHandleForTypeKHR(NULL, NULL, 0, 0, NULL, NULL); #endif // cl_khr_external_semaphore +#ifdef cl_khr_external_semaphore_sync_fd + clReImportSemaphoreSyncFdKHR(NULL, NULL, 0); +#endif // cl_khr_external_semaphore_sync_fd + #ifdef cl_khr_gl_event clCreateEventFromGLsyncKHR(NULL, NULL, NULL); #endif // cl_khr_gl_event @@ -178,6 +191,10 @@ void call_all(void) clSetKernelExecInfoARM(NULL, CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM, 0, NULL); #endif // cl_arm_shared_virtual_memory +#ifdef cl_img_cancel_command + clCancelCommandsIMG(NULL, 0); +#endif // cl_img_cancel_command + #ifdef cl_img_generate_mipmap clEnqueueGenerateMipmapIMG(NULL, NULL, NULL, CL_MIPMAP_FILTER_ANY_IMG, NULL, NULL, 0, NULL, NULL); #endif // cl_img_generate_mipmap From a0864edf91f1debefe6b4e1281ee356583e5f98d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Ferenc=20Nagy-Egri?= Date: Wed, 23 Oct 2024 17:30:16 +0200 Subject: [PATCH 2/4] Temporarily disable PPA builds --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 023e3778..d9ba0259 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -154,6 +154,7 @@ jobs: package/OpenCL-SDK-${{github.ref_name}}-Source.* ppa: + if: false runs-on: ubuntu-latest defaults: run: From 1d9500ecf8854f24febac2bb7d7349be5df0315c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Ferenc=20Nagy-Egri?= Date: Wed, 23 Oct 2024 18:22:10 +0200 Subject: [PATCH 3/4] Update softprops/action-gh-release to v2 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d9ba0259..6a6d51d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -147,7 +147,7 @@ jobs: if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK source failed." } - name: Release Source - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: draft: true files: | From 51a6568a401315f78fd8208624bec317141ea755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Ferenc=20Nagy-Egri?= Date: Thu, 24 Oct 2024 09:58:22 +0200 Subject: [PATCH 4/4] Minor release script fixes --- .github/workflows/release.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6a6d51d6..2a1eac8d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,7 @@ name: Create Release jobs: windows-binary: + name: Binary Release (Windows) runs-on: windows-2022 defaults: run: @@ -65,7 +66,7 @@ jobs: if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-SDK in $Config failed." } } - - name: Package Binary + - name: Package run: | & cpack ` --config "${env:GITHUB_WORKSPACE}\build\CPackConfig.cmake" ` @@ -75,10 +76,11 @@ jobs: -B "${env:GITHUB_WORKSPACE}\package" if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK failed." } - - name: Upload Package - uses: softprops/action-gh-release@v1 + - name: Upload + uses: softprops/action-gh-release@v2 with: draft: true + token: ${{ secrets.ACTIONS_CREATE_RELEASE_TOKEN }} files: | package/OpenCL-SDK-${{github.ref_name}}-Win-${{matrix.BIN}}.zip @@ -124,17 +126,18 @@ jobs: )) ` { throw 'CMake project version mismatches Git tag name (without leading "v")'} - - name: Package DEB + - name: Package (DEB) if: ${{ contains(matrix.OS, 'ubuntu') }} run: | cpack ` --config "${env:GITHUB_WORKSPACE}/build/CPackSourceConfig.cmake" ` -G DEB ` -C Release ` - "${env:GITHUB_WORKSPACE}/package-deb" + -D CPACK_PACKAGE_FILE_NAME='OpenCL-SDK-${{github.ref_name}}-Source' ` + -B "${env:GITHUB_WORKSPACE}/package-deb" if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK deb failed." } - - name: Package Source + - name: Package (Archive) run: | $Generator = if('${{matrix.OS}}' -match 'windows') {'ZIP'} else {'TGZ'} & cpack ` @@ -146,12 +149,14 @@ jobs: -B "${env:GITHUB_WORKSPACE}/package" if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK source failed." } - - name: Release Source + - name: Upload uses: softprops/action-gh-release@v2 with: draft: true + token: ${{ secrets.ACTIONS_CREATE_RELEASE_TOKEN }} files: | package/OpenCL-SDK-${{github.ref_name}}-Source.* + package-deb/OpenCL-SDK-${{github.ref_name}}-Source.* ppa: if: false