Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions intercept/src/cli_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
76 changes: 76 additions & 0 deletions intercept/src/dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions intercept/src/dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions intercept/src/intercept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading