@@ -159,6 +159,20 @@ static inline cl_platform_id _get_platform(cl_mem memobj)
159159 return _get_platform (context);
160160}
161161
162+ static inline cl_platform_id _get_platform (cl_event event)
163+ {
164+ if (event == nullptr ) return nullptr ;
165+
166+ cl_context context = nullptr ;
167+ clGetEventInfo (
168+ event,
169+ CL_EVENT_CONTEXT,
170+ sizeof (context),
171+ &context,
172+ nullptr );
173+ return _get_platform (context);
174+ }
175+
162176/* **************************************************************
163177* Function Pointer Typedefs
164178***************************************************************/
@@ -311,6 +325,29 @@ typedef cl_int (CL_API_CALL* clGetCommandBufferInfoKHR_clextfn)(
311325 void * param_value,
312326 size_t * param_value_size_ret);
313327
328+ typedef cl_int (CL_API_CALL* clCommandSVMMemcpyKHR_clextfn)(
329+ cl_command_buffer_khr command_buffer,
330+ cl_command_queue command_queue,
331+ void * dst_ptr,
332+ const void * src_ptr,
333+ size_t size,
334+ cl_uint num_sync_points_in_wait_list,
335+ const cl_sync_point_khr* sync_point_wait_list,
336+ cl_sync_point_khr* sync_point,
337+ cl_mutable_command_khr* mutable_handle);
338+
339+ typedef cl_int (CL_API_CALL* clCommandSVMMemFillKHR_clextfn)(
340+ cl_command_buffer_khr command_buffer,
341+ cl_command_queue command_queue,
342+ void * svm_ptr,
343+ const void * pattern,
344+ size_t pattern_size,
345+ size_t size,
346+ cl_uint num_sync_points_in_wait_list,
347+ const cl_sync_point_khr* sync_point_wait_list,
348+ cl_sync_point_khr* sync_point,
349+ cl_mutable_command_khr* mutable_handle);
350+
314351#else
315352#pragma message("Define for cl_khr_command_buffer was not found! Please update your headers.")
316353#endif // defined(cl_khr_command_buffer)
@@ -590,6 +627,17 @@ typedef cl_int (CL_API_CALL* clGetSemaphoreHandleForTypeKHR_clextfn)(
590627#pragma message("Define for cl_khr_external_semaphore was not found! Please update your headers.")
591628#endif // defined(cl_khr_external_semaphore)
592629
630+ #if defined(cl_khr_external_semaphore_sync_fd)
631+
632+ typedef cl_int (CL_API_CALL* clReImportSemaphoreSyncFdKHR_clextfn)(
633+ cl_semaphore_khr sema_object,
634+ cl_semaphore_reimport_properties_khr* reimport_props,
635+ int fd);
636+
637+ #else
638+ #pragma message("Define for cl_khr_external_semaphore_sync_fd was not found! Please update your headers.")
639+ #endif // defined(cl_khr_external_semaphore_sync_fd)
640+
593641#if defined(CLEXT_INCLUDE_GL)
594642#if defined(cl_khr_gl_event)
595643
@@ -835,6 +883,16 @@ typedef cl_int (CL_API_CALL* clSetKernelExecInfoARM_clextfn)(
835883#pragma message("Define for cl_arm_shared_virtual_memory was not found! Please update your headers.")
836884#endif // defined(cl_arm_shared_virtual_memory)
837885
886+ #if defined(cl_img_cancel_command)
887+
888+ typedef cl_int (CL_API_CALL* clCancelCommandsIMG_clextfn)(
889+ const cl_event* event_list,
890+ size_t num_events_in_list);
891+
892+ #else
893+ #pragma message("Define for cl_img_cancel_command was not found! Please update your headers.")
894+ #endif // defined(cl_img_cancel_command)
895+
838896#if defined(cl_img_generate_mipmap)
839897
840898typedef cl_int (CL_API_CALL* clEnqueueGenerateMipmapIMG_clextfn)(
@@ -1269,6 +1327,8 @@ struct openclext_dispatch_table {
12691327 clCommandFillImageKHR_clextfn clCommandFillImageKHR;
12701328 clCommandNDRangeKernelKHR_clextfn clCommandNDRangeKernelKHR;
12711329 clGetCommandBufferInfoKHR_clextfn clGetCommandBufferInfoKHR;
1330+ clCommandSVMMemcpyKHR_clextfn clCommandSVMMemcpyKHR;
1331+ clCommandSVMMemFillKHR_clextfn clCommandSVMMemFillKHR;
12721332#endif // defined(cl_khr_command_buffer)
12731333
12741334#if defined(cl_khr_command_buffer_multi_device)
@@ -1338,6 +1398,10 @@ struct openclext_dispatch_table {
13381398 clGetSemaphoreHandleForTypeKHR_clextfn clGetSemaphoreHandleForTypeKHR;
13391399#endif // defined(cl_khr_external_semaphore)
13401400
1401+ #if defined(cl_khr_external_semaphore_sync_fd)
1402+ clReImportSemaphoreSyncFdKHR_clextfn clReImportSemaphoreSyncFdKHR;
1403+ #endif // defined(cl_khr_external_semaphore_sync_fd)
1404+
13411405#if defined(CLEXT_INCLUDE_GL)
13421406#if defined(cl_khr_gl_event)
13431407 clCreateEventFromGLsyncKHR_clextfn clCreateEventFromGLsyncKHR;
@@ -1399,6 +1463,10 @@ struct openclext_dispatch_table {
13991463 clSetKernelExecInfoARM_clextfn clSetKernelExecInfoARM;
14001464#endif // defined(cl_arm_shared_virtual_memory)
14011465
1466+ #if defined(cl_img_cancel_command)
1467+ clCancelCommandsIMG_clextfn clCancelCommandsIMG;
1468+ #endif // defined(cl_img_cancel_command)
1469+
14021470#if defined(cl_img_generate_mipmap)
14031471 clEnqueueGenerateMipmapIMG_clextfn clEnqueueGenerateMipmapIMG;
14041472#endif // defined(cl_img_generate_mipmap)
@@ -1535,6 +1603,8 @@ static void _init(cl_platform_id platform, openclext_dispatch_table* dispatch_pt
15351603 CLEXT_GET_EXTENSION (clCommandFillImageKHR);
15361604 CLEXT_GET_EXTENSION (clCommandNDRangeKernelKHR);
15371605 CLEXT_GET_EXTENSION (clGetCommandBufferInfoKHR);
1606+ CLEXT_GET_EXTENSION (clCommandSVMMemcpyKHR);
1607+ CLEXT_GET_EXTENSION (clCommandSVMMemFillKHR);
15381608#endif // defined(cl_khr_command_buffer)
15391609
15401610#if defined(cl_khr_command_buffer_multi_device)
@@ -1604,6 +1674,10 @@ static void _init(cl_platform_id platform, openclext_dispatch_table* dispatch_pt
16041674 CLEXT_GET_EXTENSION (clGetSemaphoreHandleForTypeKHR);
16051675#endif // defined(cl_khr_external_semaphore)
16061676
1677+ #if defined(cl_khr_external_semaphore_sync_fd)
1678+ CLEXT_GET_EXTENSION (clReImportSemaphoreSyncFdKHR);
1679+ #endif // defined(cl_khr_external_semaphore_sync_fd)
1680+
16071681#if defined(CLEXT_INCLUDE_GL)
16081682#if defined(cl_khr_gl_event)
16091683 CLEXT_GET_EXTENSION (clCreateEventFromGLsyncKHR);
@@ -1665,6 +1739,10 @@ static void _init(cl_platform_id platform, openclext_dispatch_table* dispatch_pt
16651739 CLEXT_GET_EXTENSION (clSetKernelExecInfoARM);
16661740#endif // defined(cl_arm_shared_virtual_memory)
16671741
1742+ #if defined(cl_img_cancel_command)
1743+ CLEXT_GET_EXTENSION (clCancelCommandsIMG);
1744+ #endif // defined(cl_img_cancel_command)
1745+
16681746#if defined(cl_img_generate_mipmap)
16691747 CLEXT_GET_EXTENSION (clEnqueueGenerateMipmapIMG);
16701748#endif // defined(cl_img_generate_mipmap)
@@ -2391,6 +2469,62 @@ cl_int CL_API_CALL clGetCommandBufferInfoKHR(
23912469 param_value_size_ret);
23922470}
23932471
2472+ cl_int CL_API_CALL clCommandSVMMemcpyKHR (
2473+ cl_command_buffer_khr command_buffer,
2474+ cl_command_queue command_queue,
2475+ void * dst_ptr,
2476+ const void * src_ptr,
2477+ size_t size,
2478+ cl_uint num_sync_points_in_wait_list,
2479+ const cl_sync_point_khr* sync_point_wait_list,
2480+ cl_sync_point_khr* sync_point,
2481+ cl_mutable_command_khr* mutable_handle)
2482+ {
2483+ struct openclext_dispatch_table * dispatch_ptr = _get_dispatch (command_buffer);
2484+ if (dispatch_ptr == nullptr || dispatch_ptr->clCommandSVMMemcpyKHR == nullptr ) {
2485+ return CL_INVALID_OPERATION;
2486+ }
2487+ return dispatch_ptr->clCommandSVMMemcpyKHR (
2488+ command_buffer,
2489+ command_queue,
2490+ dst_ptr,
2491+ src_ptr,
2492+ size,
2493+ num_sync_points_in_wait_list,
2494+ sync_point_wait_list,
2495+ sync_point,
2496+ mutable_handle);
2497+ }
2498+
2499+ cl_int CL_API_CALL clCommandSVMMemFillKHR (
2500+ cl_command_buffer_khr command_buffer,
2501+ cl_command_queue command_queue,
2502+ void * svm_ptr,
2503+ const void * pattern,
2504+ size_t pattern_size,
2505+ size_t size,
2506+ cl_uint num_sync_points_in_wait_list,
2507+ const cl_sync_point_khr* sync_point_wait_list,
2508+ cl_sync_point_khr* sync_point,
2509+ cl_mutable_command_khr* mutable_handle)
2510+ {
2511+ struct openclext_dispatch_table * dispatch_ptr = _get_dispatch (command_buffer);
2512+ if (dispatch_ptr == nullptr || dispatch_ptr->clCommandSVMMemFillKHR == nullptr ) {
2513+ return CL_INVALID_OPERATION;
2514+ }
2515+ return dispatch_ptr->clCommandSVMMemFillKHR (
2516+ command_buffer,
2517+ command_queue,
2518+ svm_ptr,
2519+ pattern,
2520+ pattern_size,
2521+ size,
2522+ num_sync_points_in_wait_list,
2523+ sync_point_wait_list,
2524+ sync_point,
2525+ mutable_handle);
2526+ }
2527+
23942528#endif // defined(cl_khr_command_buffer)
23952529
23962530#if defined(cl_khr_command_buffer_multi_device)
@@ -3004,6 +3138,25 @@ cl_int CL_API_CALL clGetSemaphoreHandleForTypeKHR(
30043138
30053139#endif // defined(cl_khr_external_semaphore)
30063140
3141+ #if defined(cl_khr_external_semaphore_sync_fd)
3142+
3143+ cl_int CL_API_CALL clReImportSemaphoreSyncFdKHR (
3144+ cl_semaphore_khr sema_object,
3145+ cl_semaphore_reimport_properties_khr* reimport_props,
3146+ int fd)
3147+ {
3148+ struct openclext_dispatch_table * dispatch_ptr = _get_dispatch (sema_object);
3149+ if (dispatch_ptr == nullptr || dispatch_ptr->clReImportSemaphoreSyncFdKHR == nullptr ) {
3150+ return CL_INVALID_OPERATION;
3151+ }
3152+ return dispatch_ptr->clReImportSemaphoreSyncFdKHR (
3153+ sema_object,
3154+ reimport_props,
3155+ fd);
3156+ }
3157+
3158+ #endif // defined(cl_khr_external_semaphore_sync_fd)
3159+
30073160#if defined(CLEXT_INCLUDE_GL)
30083161#if defined(cl_khr_gl_event)
30093162
@@ -3539,6 +3692,23 @@ cl_int CL_API_CALL clSetKernelExecInfoARM(
35393692
35403693#endif // defined(cl_arm_shared_virtual_memory)
35413694
3695+ #if defined(cl_img_cancel_command)
3696+
3697+ cl_int CL_API_CALL clCancelCommandsIMG (
3698+ const cl_event* event_list,
3699+ size_t num_events_in_list)
3700+ {
3701+ struct openclext_dispatch_table * dispatch_ptr = _get_dispatch (num_events_in_list > 0 && event_list ? event_list[0 ] : nullptr );
3702+ if (dispatch_ptr == nullptr || dispatch_ptr->clCancelCommandsIMG == nullptr ) {
3703+ return CL_INVALID_OPERATION;
3704+ }
3705+ return dispatch_ptr->clCancelCommandsIMG (
3706+ event_list,
3707+ num_events_in_list);
3708+ }
3709+
3710+ #endif // defined(cl_img_cancel_command)
3711+
35423712#if defined(cl_img_generate_mipmap)
35433713
35443714cl_int CL_API_CALL clEnqueueGenerateMipmapIMG (
0 commit comments