diff --git a/intercept/src/cli_ext.h b/intercept/src/cli_ext.h index 4e8e6996..9e7f81d1 100644 --- a/intercept/src/cli_ext.h +++ b/intercept/src/cli_ext.h @@ -1015,6 +1015,7 @@ typedef cl_properties cl_svm_alloc_properties_khr; typedef cl_bitfield cl_svm_alloc_access_flags_khr; typedef cl_properties cl_svm_free_properties_khr; typedef cl_bitfield cl_svm_free_flags_khr; +typedef cl_properties cl_svm_copy_properties_khr; typedef cl_uint cl_svm_pointer_info_khr; #define CL_SVM_ALLOC_ASSOCIATED_DEVICE_HANDLE_KHR 0x2078 @@ -1070,6 +1071,18 @@ cl_int CL_API_CALL clGetSVMSuggestedTypeIndexKHR( size_t size, cl_uint* suggested_svm_type_index); +extern CL_API_ENTRY +cl_int CL_API_CALL clEnqueueSVMMemcpyWithPropertiesKHR( + cl_command_queue command_queue, + cl_svm_copy_properties_khr* properties, + 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_ext_atomic_counters diff --git a/intercept/src/dispatch.cpp b/intercept/src/dispatch.cpp index d068b3d5..c0d443ac 100644 --- a/intercept/src/dispatch.cpp +++ b/intercept/src/dispatch.cpp @@ -9271,6 +9271,82 @@ CL_API_ENTRY cl_int CL_API_CALL clGetSVMSuggestedTypeIndexKHR( NULL_FUNCTION_POINTER_RETURN_ERROR(CL_INVALID_CONTEXT); } +/////////////////////////////////////////////////////////////////////////////// +// +// cl_khr_unified_svm +CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMMemcpyWithPropertiesKHR( + cl_command_queue command_queue, + cl_svm_copy_properties_khr* properties, + 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) +{ + CLIntercept* pIntercept = GetIntercept(); + + if( pIntercept ) + { + const auto& dispatchX = pIntercept->dispatchX(command_queue); + if( dispatchX.clEnqueueSVMMemcpyWithPropertiesKHR ) + { + cl_int retVal = CL_SUCCESS; + + INCREMENT_ENQUEUE_COUNTER(); + CHECK_AUBCAPTURE_START( command_queue ); + + if( pIntercept->config().NullEnqueue == false ) + { + const std::string eventWaitListString = getFormattedEventWaitList( + pIntercept, + num_events_in_wait_list, + event_wait_list); + + CALL_LOGGING_ENTER( "queue = %p, properties = %p, %s, dst_ptr = %p, src_ptr = %p, size = %zu%s", + command_queue, + properties, + blocking_copy ? "blocking" : "non-blocking", + dst_ptr, + src_ptr, + size, + eventWaitListString.c_str() ); + CHECK_EVENT_LIST( num_events_in_wait_list, event_wait_list, event ); + GET_TIMING_TAGS_BLOCKING( blocking_copy, size ); + DEVICE_PERFORMANCE_TIMING_START( event ); + HOST_PERFORMANCE_TIMING_START(); + + retVal = dispatchX.clEnqueueSVMMemcpyWithPropertiesKHR( + command_queue, + properties, + blocking_copy, + dst_ptr, + src_ptr, + size, + num_events_in_wait_list, + event_wait_list, + event ); + + HOST_PERFORMANCE_TIMING_END_WITH_TAG(); + DEVICE_PERFORMANCE_TIMING_END_WITH_TAG( command_queue, retVal, event ); + CHECK_ERROR( retVal ); + ADD_OBJECT_ALLOCATION_EVENT( retVal, event ); + CALL_LOGGING_EXIT_EVENT_WITH_TAG( retVal, event ); + DEVICE_PERFORMANCE_TIMING_CHECK_CONDITIONAL( blocking_copy ); + FLUSH_CHROME_TRACE_BUFFERING_CONDITIONAL( blocking_copy ); + } + + FINISH_OR_FLUSH_AFTER_ENQUEUE( command_queue ); + CHECK_AUBCAPTURE_STOP( command_queue ); + + return retVal; + } + } + + NULL_FUNCTION_POINTER_RETURN_ERROR(CL_INVALID_COMMAND_QUEUE); +} + /////////////////////////////////////////////////////////////////////////////// // // cl_ext_image_requirements_info diff --git a/intercept/src/dispatch.h b/intercept/src/dispatch.h index b18eda66..612776fd 100644 --- a/intercept/src/dispatch.h +++ b/intercept/src/dispatch.h @@ -521,6 +521,18 @@ struct CLdispatchX size_t size, cl_uint* suggested_svm_type_index); + // cl_khr_unified_svm + cl_int (CL_API_CALL *clEnqueueSVMMemcpyWithPropertiesKHR) ( + cl_command_queue command_queue, + cl_svm_copy_properties_khr* properties, + 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_ext_buffer_device_address cl_int (CL_API_CALL *clSetKernelArgDevicePointerEXT) ( cl_kernel kernel, diff --git a/intercept/src/intercept.cpp b/intercept/src/intercept.cpp index 07c63023..2b910434 100644 --- a/intercept/src/intercept.cpp +++ b/intercept/src/intercept.cpp @@ -13389,6 +13389,7 @@ void* CLIntercept::getExtensionFunctionAddress( CHECK_RETURN_EXTENSION_FUNCTION( clSVMFreeWithPropertiesKHR ); CHECK_RETURN_EXTENSION_FUNCTION( clGetSVMPointerInfoKHR ); CHECK_RETURN_EXTENSION_FUNCTION( clGetSVMSuggestedTypeIndexKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clEnqueueSVMMemcpyWithPropertiesKHR ); } // cl_ext_buffer_device_address