From 6b5373b8bafe055c09658fbcd35ba507ee8ef64f Mon Sep 17 00:00:00 2001 From: Krzysztof Swiecicki Date: Wed, 3 Dec 2025 12:00:17 +0000 Subject: [PATCH] [UR] Cleanup the record & replay spec --- unified-runtime/include/ur_api.h | 110 ++++++------- unified-runtime/include/ur_api_funcs.def | 2 +- unified-runtime/include/ur_ddi.h | 14 +- unified-runtime/include/ur_print.h | 20 +-- unified-runtime/include/ur_print.hpp | 115 ++++++------- unified-runtime/scripts/core/EXP-GRAPH.rst | 8 +- unified-runtime/scripts/core/exp-graph.yml | 153 ++++++++---------- unified-runtime/scripts/core/registry.yml | 8 +- .../source/adapters/cuda/queue.cpp | 11 +- .../adapters/cuda/ur_interface_loader.cpp | 2 +- unified-runtime/source/adapters/hip/queue.cpp | 11 +- .../adapters/hip/ur_interface_loader.cpp | 2 +- .../source/adapters/level_zero/queue.cpp | 10 +- .../level_zero/ur_interface_loader.cpp | 2 +- .../level_zero/ur_interface_loader.hpp | 14 +- .../adapters/level_zero/v2/queue_api.cpp | 18 +-- .../adapters/level_zero/v2/queue_api.hpp | 6 +- .../adapters/level_zero/v2/queue_batched.hpp | 9 +- .../v2/queue_immediate_in_order.hpp | 9 +- .../v2/queue_immediate_out_of_order.hpp | 9 +- .../source/adapters/mock/ur_mockddi.cpp | 51 +++--- .../source/adapters/native_cpu/queue.cpp | 11 +- .../native_cpu/ur_interface_loader.cpp | 2 +- .../source/adapters/offload/queue.cpp | 11 +- .../adapters/offload/ur_interface_loader.cpp | 2 +- .../source/adapters/opencl/queue.cpp | 11 +- .../adapters/opencl/ur_interface_loader.cpp | 2 +- .../loader/layers/tracing/ur_trcddi.cpp | 71 ++++---- .../loader/layers/validation/ur_valddi.cpp | 73 +++++---- unified-runtime/source/loader/loader.def.in | 4 +- unified-runtime/source/loader/loader.map.in | 4 +- unified-runtime/source/loader/ur_ldrddi.cpp | 43 ++--- unified-runtime/source/loader/ur_libapi.cpp | 83 ++++------ unified-runtime/source/loader/ur_print.cpp | 17 +- unified-runtime/source/ur_api.cpp | 70 ++++---- 35 files changed, 485 insertions(+), 503 deletions(-) diff --git a/unified-runtime/include/ur_api.h b/unified-runtime/include/ur_api.h index 75cb616f48dd4..e0f18d53ffe35 100644 --- a/unified-runtime/include/ur_api.h +++ b/unified-runtime/include/ur_api.h @@ -497,8 +497,6 @@ typedef enum ur_function_t { UR_FUNCTION_QUEUE_BEGIN_CAPTURE_INTO_GRAPH_EXP = 298, /// Enumerator for ::urQueueEndGraphCaptureExp UR_FUNCTION_QUEUE_END_GRAPH_CAPTURE_EXP = 299, - /// Enumerator for ::urQueueAppendGraphExp - UR_FUNCTION_QUEUE_APPEND_GRAPH_EXP = 301, /// Enumerator for ::urGraphDestroyExp UR_FUNCTION_GRAPH_DESTROY_EXP = 302, /// Enumerator for ::urGraphExecutableGraphDestroyExp @@ -511,6 +509,8 @@ typedef enum ur_function_t { UR_FUNCTION_GRAPH_DUMP_CONTENTS_EXP = 306, /// Enumerator for ::urGraphInstantiateGraphExp UR_FUNCTION_GRAPH_INSTANTIATE_GRAPH_EXP = 307, + /// Enumerator for ::urEnqueueGraphExp + UR_FUNCTION_ENQUEUE_GRAPH_EXP = 308, /// @cond UR_FUNCTION_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -2489,7 +2489,7 @@ typedef enum ur_device_info_t { UR_DEVICE_INFO_CLOCK_DEVICE_SUPPORT_EXP = 0x2062, /// [::ur_bool_t] returns true if the device is integrated GPU. UR_DEVICE_INFO_IS_INTEGRATED_GPU = 0x2070, - /// [::ur_bool_t] returns true if the device supports graph record and replay + /// [::ur_bool_t] Returns true if the device supports graph record and replay /// functionality. UR_DEVICE_INFO_GRAPH_RECORD_AND_REPLAY_SUPPORT_EXP = 0x2080, /// [::ur_bool_t] Returns true if the device supports the USM P2P @@ -7409,6 +7409,8 @@ typedef enum ur_command_t { UR_COMMAND_ENQUEUE_USM_HOST_ALLOC_EXP = 0x2052, /// Event created by ::urEnqueueUSMFreeExp UR_COMMAND_ENQUEUE_USM_FREE_EXP = 0x2053, + /// Event created by ::urEnqueueGraphExp + UR_COMMAND_ENQUEUE_GRAPH_EXP = 0x2100, /// @cond UR_COMMAND_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -13515,20 +13517,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueNativeCommandExp( #pragma region graph_(experimental) #endif /////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of record & replay graph object +/// @brief Handle of record & replay graph object. typedef struct ur_exp_graph_handle_t_ *ur_exp_graph_handle_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of record & replay executable graph object +/// @brief Handle of record & replay executable graph object. typedef struct ur_exp_executable_graph_handle_t_ *ur_exp_executable_graph_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Create a new record & replay graph instance explicitly. /// -/// @details -/// - Create a new record & replay graph instance explicitly. -/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED @@ -13538,8 +13537,6 @@ typedef struct ur_exp_executable_graph_handle_t_ /// + `NULL == hContext` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT UR_APIEXPORT ur_result_t UR_APICALL urGraphCreateExp( /// [in] Handle of the context object. ur_context_handle_t hContext, @@ -13547,7 +13544,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urGraphCreateExp( ur_exp_graph_handle_t *phGraph); /////////////////////////////////////////////////////////////////////////////// -/// @brief Begin graph capture on the specified immediate queue. +/// @brief Begin graph capture on the specified queue. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -13556,15 +13553,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urGraphCreateExp( /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT UR_APIEXPORT ur_result_t UR_APICALL urQueueBeginGraphCaptureExp( /// [in] Handle of the queue on which to begin graph capture. ur_queue_handle_t hQueue); /////////////////////////////////////////////////////////////////////////////// /// @brief Begin capturing commands into an existing graph on the specified -/// immediate queue. +/// queue. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -13574,8 +13569,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueBeginGraphCaptureExp( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` /// + `NULL == hGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT UR_APIEXPORT ur_result_t UR_APICALL urQueueBeginCaptureIntoGraphExp( /// [in] Handle of the queue on which to begin graph capture. ur_queue_handle_t hQueue, @@ -13583,7 +13576,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueBeginCaptureIntoGraphExp( ur_exp_graph_handle_t hGraph); /////////////////////////////////////////////////////////////////////////////// -/// @brief End graph capture on the specified immediate queue. +/// @brief End graph capture on the specified queue. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -13594,8 +13587,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueBeginCaptureIntoGraphExp( /// + `NULL == hQueue` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT UR_APIEXPORT ur_result_t UR_APICALL urQueueEndGraphCaptureExp( /// [in] Handle of the queue on which to end graph capture. ur_queue_handle_t hQueue, @@ -13616,8 +13607,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueEndGraphCaptureExp( /// + `NULL == hGraph` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phExecGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT UR_APIEXPORT ur_result_t UR_APICALL urGraphInstantiateGraphExp( /// [in] Handle of the recorded graph to instantiate. ur_exp_graph_handle_t hGraph, @@ -13625,7 +13614,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urGraphInstantiateGraphExp( ur_exp_executable_graph_handle_t *phExecGraph); /////////////////////////////////////////////////////////////////////////////// -/// @brief Append an executable graph to the queue. +/// @brief Enqueue an executable graph onto the queue. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -13635,20 +13624,27 @@ UR_APIEXPORT ur_result_t UR_APICALL urGraphInstantiateGraphExp( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` /// + `NULL == hGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT -UR_APIEXPORT ur_result_t UR_APICALL urQueueAppendGraphExp( - /// [in] Handle of the queue to append the graph to. +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueGraphExp( + /// [in] Handle of the queue to which the graph will be enqueued. ur_queue_handle_t hQueue, - /// [in] Handle of the executable graph to append. + /// [in] Handle of the executable graph to be enqueued. ur_exp_executable_graph_handle_t hGraph, - /// [in][optional] Event to be signaled on completion. - ur_event_handle_t hSignalEvent, /// [in][optional] Number of events to wait on before executing. - uint32_t numWaitEvents, - /// [in][optional][range(0, numWaitEvents)] Handle of the events to wait - /// on before launching. - ur_event_handle_t *phWaitEvents); + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] Pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] Event object that identifies this particular + /// command instance. + /// If phEventWaitList and phEvent are not nullptr, phEvent must not refer + /// to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroy a recorded graph object. All executable graph instances @@ -13662,8 +13658,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueAppendGraphExp( /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT UR_APIEXPORT ur_result_t UR_APICALL urGraphDestroyExp( /// [in] Handle of the graph object to destroy. ur_exp_graph_handle_t hGraph); @@ -13679,8 +13673,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urGraphDestroyExp( /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hExecutableGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT UR_APIEXPORT ur_result_t UR_APICALL urGraphExecutableGraphDestroyExp( /// [in] Handle of the executable graph object to destroy. ur_exp_executable_graph_handle_t hExecutableGraph); @@ -13696,14 +13688,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urGraphExecutableGraphDestroyExp( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == hResult` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT +/// + `NULL == pResult` UR_APIEXPORT ur_result_t UR_APICALL urQueueIsGraphCaptureEnabledExp( /// [in] Native queue to query. ur_queue_handle_t hQueue, /// [out] Pointer to a boolean where the result will be stored. - bool *hResult); + bool *pResult); /////////////////////////////////////////////////////////////////////////////// /// @brief Return whether the given recorded graph contains any nodes. @@ -13716,14 +13706,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueIsGraphCaptureEnabledExp( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hGraph` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == hResult` -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// + `NULL == pResult` +/// - ::UR_RESULT_ERROR_INVALID_GRAPH UR_APIEXPORT ur_result_t UR_APICALL urGraphIsEmptyExp( /// [in] Handle of the graph to query. ur_exp_graph_handle_t hGraph, /// [out] Pointer to a boolean where the result will be stored. - bool *hResult); + bool *pResult); /////////////////////////////////////////////////////////////////////////////// /// @brief Dump the contents of the recorded graph to the provided file path. @@ -13737,9 +13726,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urGraphIsEmptyExp( /// + `NULL == hGraph` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == filePath` -/// - ::UR_RESULT_ERROR_INVALID_VALUE -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL urGraphDumpContentsExp( /// [in] Handle of the graph to dump. ur_exp_graph_handle_t hGraph, @@ -14591,25 +14577,13 @@ typedef struct ur_queue_end_graph_capture_exp_params_t { ur_exp_graph_handle_t **pphGraph; } ur_queue_end_graph_capture_exp_params_t; -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urQueueAppendGraphExp -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_queue_append_graph_exp_params_t { - ur_queue_handle_t *phQueue; - ur_exp_executable_graph_handle_t *phGraph; - ur_event_handle_t *phSignalEvent; - uint32_t *pnumWaitEvents; - ur_event_handle_t **pphWaitEvents; -} ur_queue_append_graph_exp_params_t; - /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urQueueIsGraphCaptureEnabledExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value typedef struct ur_queue_is_graph_capture_enabled_exp_params_t { ur_queue_handle_t *phQueue; - bool **phResult; + bool **ppResult; } ur_queue_is_graph_capture_enabled_exp_params_t; /////////////////////////////////////////////////////////////////////////////// @@ -15354,6 +15328,18 @@ typedef struct ur_enqueue_native_command_exp_params_t { ur_event_handle_t **pphEvent; } ur_enqueue_native_command_exp_params_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueGraphExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_graph_exp_params_t { + ur_queue_handle_t *phQueue; + ur_exp_executable_graph_handle_t *phGraph; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_graph_exp_params_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urUSMHostAlloc /// @details Each entry is a pointer to the parameter passed to the function; @@ -16256,7 +16242,7 @@ typedef struct ur_graph_executable_graph_destroy_exp_params_t { /// allowing the callback the ability to modify the parameter's value typedef struct ur_graph_is_empty_exp_params_t { ur_exp_graph_handle_t *phGraph; - bool **phResult; + bool **ppResult; } ur_graph_is_empty_exp_params_t; /////////////////////////////////////////////////////////////////////////////// diff --git a/unified-runtime/include/ur_api_funcs.def b/unified-runtime/include/ur_api_funcs.def index 9deb1baf0b193..fba1cec526697 100644 --- a/unified-runtime/include/ur_api_funcs.def +++ b/unified-runtime/include/ur_api_funcs.def @@ -91,7 +91,6 @@ _UR_API(urQueueFlush) _UR_API(urQueueBeginGraphCaptureExp) _UR_API(urQueueBeginCaptureIntoGraphExp) _UR_API(urQueueEndGraphCaptureExp) -_UR_API(urQueueAppendGraphExp) _UR_API(urQueueIsGraphCaptureEnabledExp) _UR_API(urSamplerCreate) _UR_API(urSamplerRetain) @@ -147,6 +146,7 @@ _UR_API(urEnqueueUSMFreeExp) _UR_API(urEnqueueCommandBufferExp) _UR_API(urEnqueueTimestampRecordingExp) _UR_API(urEnqueueNativeCommandExp) +_UR_API(urEnqueueGraphExp) _UR_API(urUSMHostAlloc) _UR_API(urUSMDeviceAlloc) _UR_API(urUSMSharedAlloc) diff --git a/unified-runtime/include/ur_ddi.h b/unified-runtime/include/ur_ddi.h index 28f7d75d7b523..3e473faa1f7b2 100644 --- a/unified-runtime/include/ur_ddi.h +++ b/unified-runtime/include/ur_ddi.h @@ -698,12 +698,6 @@ typedef ur_result_t(UR_APICALL *ur_pfnQueueBeginCaptureIntoGraphExp_t)( typedef ur_result_t(UR_APICALL *ur_pfnQueueEndGraphCaptureExp_t)( ur_queue_handle_t, ur_exp_graph_handle_t *); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urQueueAppendGraphExp -typedef ur_result_t(UR_APICALL *ur_pfnQueueAppendGraphExp_t)( - ur_queue_handle_t, ur_exp_executable_graph_handle_t, ur_event_handle_t, - uint32_t, ur_event_handle_t *); - /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urQueueIsGraphCaptureEnabledExp typedef ur_result_t(UR_APICALL *ur_pfnQueueIsGraphCaptureEnabledExp_t)( @@ -715,7 +709,6 @@ typedef struct ur_queue_exp_dditable_t { ur_pfnQueueBeginGraphCaptureExp_t pfnBeginGraphCaptureExp; ur_pfnQueueBeginCaptureIntoGraphExp_t pfnBeginCaptureIntoGraphExp; ur_pfnQueueEndGraphCaptureExp_t pfnEndGraphCaptureExp; - ur_pfnQueueAppendGraphExp_t pfnAppendGraphExp; ur_pfnQueueIsGraphCaptureEnabledExp_t pfnIsGraphCaptureEnabledExp; } ur_queue_exp_dditable_t; @@ -1214,6 +1207,12 @@ typedef ur_result_t(UR_APICALL *ur_pfnEnqueueNativeCommandExp_t)( const ur_exp_enqueue_native_command_properties_t *, uint32_t, const ur_event_handle_t *, ur_event_handle_t *); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueGraphExp +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueGraphExp_t)( + ur_queue_handle_t, ur_exp_executable_graph_handle_t, uint32_t, + const ur_event_handle_t *, ur_event_handle_t *); + /////////////////////////////////////////////////////////////////////////////// /// @brief Table of EnqueueExp functions pointers typedef struct ur_enqueue_exp_dditable_t { @@ -1225,6 +1224,7 @@ typedef struct ur_enqueue_exp_dditable_t { ur_pfnEnqueueCommandBufferExp_t pfnCommandBufferExp; ur_pfnEnqueueTimestampRecordingExp_t pfnTimestampRecordingExp; ur_pfnEnqueueNativeCommandExp_t pfnNativeCommandExp; + ur_pfnEnqueueGraphExp_t pfnGraphExp; } ur_enqueue_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// diff --git a/unified-runtime/include/ur_print.h b/unified-runtime/include/ur_print.h index 251e0f9763a27..e0cbe0c89d488 100644 --- a/unified-runtime/include/ur_print.h +++ b/unified-runtime/include/ur_print.h @@ -2341,16 +2341,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintQueueEndGraphCaptureExpParams( const struct ur_queue_end_graph_capture_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_queue_append_graph_exp_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintQueueAppendGraphExpParams( - const struct ur_queue_append_graph_exp_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size); - /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_queue_is_graph_capture_enabled_exp_params_t struct /// @returns @@ -2905,6 +2895,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueNativeCommandExpParams( const struct ur_enqueue_native_command_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_graph_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueGraphExpParams( + const struct ur_enqueue_graph_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_usm_host_alloc_params_t struct /// @returns diff --git a/unified-runtime/include/ur_print.hpp b/unified-runtime/include/ur_print.hpp index a3afc20786add..27a7d4ea90ad2 100644 --- a/unified-runtime/include/ur_print.hpp +++ b/unified-runtime/include/ur_print.hpp @@ -1337,9 +1337,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_QUEUE_END_GRAPH_CAPTURE_EXP: os << "UR_FUNCTION_QUEUE_END_GRAPH_CAPTURE_EXP"; break; - case UR_FUNCTION_QUEUE_APPEND_GRAPH_EXP: - os << "UR_FUNCTION_QUEUE_APPEND_GRAPH_EXP"; - break; case UR_FUNCTION_GRAPH_DESTROY_EXP: os << "UR_FUNCTION_GRAPH_DESTROY_EXP"; break; @@ -1358,6 +1355,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_GRAPH_INSTANTIATE_GRAPH_EXP: os << "UR_FUNCTION_GRAPH_INSTANTIATE_GRAPH_EXP"; break; + case UR_FUNCTION_ENQUEUE_GRAPH_EXP: + os << "UR_FUNCTION_ENQUEUE_GRAPH_EXP"; + break; default: os << "unknown enumerator"; break; @@ -10799,6 +10799,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_command_t value) { case UR_COMMAND_ENQUEUE_USM_FREE_EXP: os << "UR_COMMAND_ENQUEUE_USM_FREE_EXP"; break; + case UR_COMMAND_ENQUEUE_GRAPH_EXP: + os << "UR_COMMAND_ENQUEUE_GRAPH_EXP"; + break; default: os << "unknown enumerator"; break; @@ -15306,52 +15309,6 @@ operator<<(std::ostream &os, return os; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_queue_append_graph_exp_params_t type -/// @returns -/// std::ostream & -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_queue_append_graph_exp_params_t *params) { - - os << ".hQueue = "; - - ur::details::printPtr(os, *(params->phQueue)); - - os << ", "; - os << ".hGraph = "; - - ur::details::printPtr(os, *(params->phGraph)); - - os << ", "; - os << ".hSignalEvent = "; - - ur::details::printPtr(os, *(params->phSignalEvent)); - - os << ", "; - os << ".numWaitEvents = "; - - os << *(params->pnumWaitEvents); - - os << ", "; - os << ".phWaitEvents = "; - ur::details::printPtr( - os, reinterpret_cast(*(params->pphWaitEvents))); - if (*(params->pphWaitEvents) != NULL) { - os << " {"; - for (size_t i = 0; i < *params->pnumWaitEvents; ++i) { - if (i != 0) { - os << ", "; - } - - ur::details::printPtr(os, (*(params->pphWaitEvents))[i]); - } - os << "}"; - } - - return os; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_queue_is_graph_capture_enabled_exp_params_t /// type @@ -15367,9 +15324,9 @@ inline std::ostream &operator<<( ur::details::printPtr(os, *(params->phQueue)); os << ", "; - os << ".hResult = "; + os << ".pResult = "; - ur::details::printPtr(os, *(params->phResult)); + ur::details::printPtr(os, *(params->ppResult)); return os; } @@ -18141,6 +18098,52 @@ operator<<(std::ostream &os, return os; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_graph_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_graph_exp_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hGraph = "; + + ur::details::printPtr(os, *(params->phGraph)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_usm_host_alloc_params_t type /// @returns @@ -21097,9 +21100,9 @@ inline std::ostream &operator<<( ur::details::printPtr(os, *(params->phGraph)); os << ", "; - os << ".hResult = "; + os << ".pResult = "; - ur::details::printPtr(os, *(params->phResult)); + ur::details::printPtr(os, *(params->ppResult)); return os; } @@ -22337,9 +22340,6 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, case UR_FUNCTION_QUEUE_END_GRAPH_CAPTURE_EXP: { os << (const struct ur_queue_end_graph_capture_exp_params_t *)params; } break; - case UR_FUNCTION_QUEUE_APPEND_GRAPH_EXP: { - os << (const struct ur_queue_append_graph_exp_params_t *)params; - } break; case UR_FUNCTION_QUEUE_IS_GRAPH_CAPTURE_ENABLED_EXP: { os << (const struct ur_queue_is_graph_capture_enabled_exp_params_t *)params; } break; @@ -22511,6 +22511,9 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, case UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP: { os << (const struct ur_enqueue_native_command_exp_params_t *)params; } break; + case UR_FUNCTION_ENQUEUE_GRAPH_EXP: { + os << (const struct ur_enqueue_graph_exp_params_t *)params; + } break; case UR_FUNCTION_USM_HOST_ALLOC: { os << (const struct ur_usm_host_alloc_params_t *)params; } break; diff --git a/unified-runtime/scripts/core/EXP-GRAPH.rst b/unified-runtime/scripts/core/EXP-GRAPH.rst index 7b3dff39fe787..344242c30cfb8 100644 --- a/unified-runtime/scripts/core/EXP-GRAPH.rst +++ b/unified-runtime/scripts/core/EXP-GRAPH.rst @@ -48,8 +48,8 @@ Functions * ${x}QueueBeginGraphCaptureExp * ${x}QueueBeginCaptureIntoGraphExp * ${x}QueueEndGraphCaptureExp - * ${x}QueueAppendGraphExp * ${x}QueueIsGraphCaptureEnabledExp + * ${x}EnqueueGraphExp Changelog -------------------------------------------------------------------------------- @@ -62,6 +62,12 @@ Changelog | 1.1 | Extend ${x}_device_info_t enumerator with | | | graph record and replay entry. | +-----------+---------------------------------------------+ +| 1.2 | Extend ${x}_command_t enumerator with | +| | enqueue graph event entry. Cleanup spec | +| | entry descriptions and return values. | +| | Rename QueueAppendGraphExp into | +| | EnqueueGraphExp. | ++-----------+---------------------------------------------+ Support -------------------------------------------------------------------------------- diff --git a/unified-runtime/scripts/core/exp-graph.yml b/unified-runtime/scripts/core/exp-graph.yml index f2f6b9dc258e7..2c2306107abf7 100644 --- a/unified-runtime/scripts/core/exp-graph.yml +++ b/unified-runtime/scripts/core/exp-graph.yml @@ -7,21 +7,16 @@ # # See YaML.md for syntax definition # -# TODO: -# ZE_RESULT_ERROR_INVALID_GRAPH -# ZE_RESULT_QUERY_TRUE -# ZE_RESULT_QUERY_FALSE -# --- #-------------------------------------------------------------------------- type: header desc: "Intel $OneApi Unified Runtime Experimental APIs for Graph Record and Replay" --- #-------------------------------------------------------------------------- type: handle -desc: "Handle of record & replay graph object" +desc: "Handle of record & replay graph object." name: "$x_exp_graph_handle_t" --- #-------------------------------------------------------------------------- type: handle -desc: "Handle of record & replay executable graph object" +desc: "Handle of record & replay executable graph object." name: "$x_exp_executable_graph_handle_t" --- #-------------------------------------------------------------------------- type: enum @@ -33,16 +28,23 @@ etors: - name: GRAPH_RECORD_AND_REPLAY_SUPPORT_EXP value: "0x2080" desc: | - [$x_bool_t] returns true if the device supports graph record and replay + [$x_bool_t] Returns true if the device supports graph record and replay functionality. --- #-------------------------------------------------------------------------- +type: enum +extend: true +desc: "Command Type experimental enumerations." +name: $x_command_t +etors: + - name: ENQUEUE_GRAPH_EXP + value: "0x2100" + desc: "Event created by $xEnqueueGraphExp" +--- #-------------------------------------------------------------------------- type: function desc: "Create a new record & replay graph instance explicitly." class: $xGraph name: CreateExp decl: static -details: - - "Create a new record & replay graph instance explicitly." params: - type: $x_context_handle_t name: hContext @@ -50,91 +52,82 @@ params: - type: $x_exp_graph_handle_t* name: phGraph desc: "[out][alloc] Pointer to the handle of the created graph object." -returns: - - $X_RESULT_SUCCESS - - $X_RESULT_ERROR_INVALID_ARGUMENT --- #-------------------------------------------------------------------------- type: function -desc: "Begin graph capture on the specified immediate queue." +desc: "Begin graph capture on the specified queue." class: $xQueue name: BeginGraphCaptureExp params: - - type: $x_queue_handle_t - name: hQueue - desc: "[in] Handle of the queue on which to begin graph capture." -returns: - - $X_RESULT_SUCCESS - - $X_RESULT_ERROR_INVALID_ARGUMENT + - type: $x_queue_handle_t + name: hQueue + desc: "[in] Handle of the queue on which to begin graph capture." --- #-------------------------------------------------------------------------- type: function -desc: "Begin capturing commands into an existing graph on the specified immediate queue." +desc: "Begin capturing commands into an existing graph on the specified queue." class: $xQueue name: BeginCaptureIntoGraphExp params: - - type: $x_queue_handle_t - name: hQueue - desc: "[in] Handle of the queue on which to begin graph capture." - - type: $x_exp_graph_handle_t - name: hGraph - desc: "[in] Handle of the graph object to capture into." -returns: - - $X_RESULT_SUCCESS - - $X_RESULT_ERROR_INVALID_ARGUMENT + - type: $x_queue_handle_t + name: hQueue + desc: "[in] Handle of the queue on which to begin graph capture." + - type: $x_exp_graph_handle_t + name: hGraph + desc: "[in] Handle of the graph object to capture into." --- #-------------------------------------------------------------------------- type: function -desc: "End graph capture on the specified immediate queue." +desc: "End graph capture on the specified queue." class: $xQueue name: EndGraphCaptureExp params: - - type: $x_queue_handle_t - name: hQueue - desc: "[in] Handle of the queue on which to end graph capture." - - type: $x_exp_graph_handle_t* - name: phGraph - desc: "[out] Pointer to the handle of the recorded graph object. If $xQueueBeginCaptureIntoGraphExp - was used to begin the capture, then phGraph will contain the same graph that was passed to it." -returns: - - $X_RESULT_SUCCESS - - $X_RESULT_ERROR_INVALID_ARGUMENT + - type: $x_queue_handle_t + name: hQueue + desc: "[in] Handle of the queue on which to end graph capture." + - type: $x_exp_graph_handle_t* + name: phGraph + desc: "[out] Pointer to the handle of the recorded graph object. If $xQueueBeginCaptureIntoGraphExp + was used to begin the capture, then phGraph will contain the same graph that was passed to it." --- #-------------------------------------------------------------------------- type: function desc: "Instantiate an executable graph from a recorded graph." class: $xGraph name: InstantiateGraphExp params: - - type: $x_exp_graph_handle_t - name: hGraph - desc: "[in] Handle of the recorded graph to instantiate." - - type: $x_exp_executable_graph_handle_t* - name: phExecGraph - desc: "[out] Pointer to the handle of the instantiated executable graph." -returns: - - $X_RESULT_SUCCESS - - $X_RESULT_ERROR_INVALID_ARGUMENT + - type: $x_exp_graph_handle_t + name: hGraph + desc: "[in] Handle of the recorded graph to instantiate." + - type: $x_exp_executable_graph_handle_t* + name: phExecGraph + desc: "[out] Pointer to the handle of the instantiated executable graph." --- #-------------------------------------------------------------------------- type: function -desc: "Append an executable graph to the queue." -class: $xQueue -name: AppendGraphExp +desc: "Enqueue an executable graph onto the queue." +class: $xEnqueue +name: GraphExp params: - - type: $x_queue_handle_t - name: hQueue - desc: "[in] Handle of the queue to append the graph to." - - type: $x_exp_executable_graph_handle_t - name: hGraph - desc: "[in] Handle of the executable graph to append." - - type: $x_event_handle_t - name: hSignalEvent - desc: "[in][optional] Event to be signaled on completion." - - type: uint32_t - name: numWaitEvents - desc: "[in][optional] Number of events to wait on before executing." - - type: $x_event_handle_t* - name: phWaitEvents - desc: "[in][optional][range(0, numWaitEvents)] Handle of the events to wait on before launching." + - type: $x_queue_handle_t + name: hQueue + desc: "[in] Handle of the queue to which the graph will be enqueued." + - type: $x_exp_executable_graph_handle_t + name: hGraph + desc: "[in] Handle of the executable graph to be enqueued." + - type: uint32_t + name: numEventsInWaitList + desc: "[in][optional] Number of events to wait on before executing." + - type: const $x_event_handle_t* + name: phEventWaitList + desc: | + [in][optional][range(0, numEventsInWaitList)] Pointer to a list of events that must be complete before this command can be executed. + If nullptr, the numEventsInWaitList must be 0, indicating that this command does not wait on any event to complete. + - type: $x_event_handle_t* + name: phEvent + desc: | + [out][optional][alloc] Event object that identifies this particular command instance. + If phEventWaitList and phEvent are not nullptr, phEvent must not refer to an element of the phEventWaitList array. returns: - - $X_RESULT_SUCCESS - - $X_RESULT_ERROR_INVALID_ARGUMENT + - $X_RESULT_ERROR_INVALID_EVENT_WAIT_LIST: + - "`phEventWaitList == NULL && numEventsInWaitList > 0`" + - "`phEventWaitList != NULL && numEventsInWaitList == 0`" + - "If event objects in phEventWaitList are not valid events." --- #-------------------------------------------------------------------------- type: function desc: "Destroy a recorded graph object. All executable graph instances created from this recorded graph must be destroyed before calling this function." @@ -144,9 +137,6 @@ params: - type: $x_exp_graph_handle_t name: hGraph desc: "[in] Handle of the graph object to destroy." -returns: - - $X_RESULT_SUCCESS - - $X_RESULT_ERROR_INVALID_ARGUMENT --- #-------------------------------------------------------------------------- type: function desc: "Destroy an instantiated executable graph object. The graph instance must not be executing on any queue." @@ -156,9 +146,6 @@ params: - type: $x_exp_executable_graph_handle_t name: hExecutableGraph desc: "[in] Handle of the executable graph object to destroy." -returns: - - $X_RESULT_SUCCESS - - $X_RESULT_ERROR_INVALID_ARGUMENT --- #-------------------------------------------------------------------------- type: function desc: "Query whether graph capture is currently enabled on the given queue." @@ -169,11 +156,8 @@ params: name: hQueue desc: "[in] Native queue to query." - type: bool* - name: hResult + name: pResult desc: "[out] Pointer to a boolean where the result will be stored." -returns: - - $X_RESULT_SUCCESS - - $X_RESULT_ERROR_INVALID_ARGUMENT --- #-------------------------------------------------------------------------- type: function desc: "Return whether the given recorded graph contains any nodes." @@ -184,11 +168,10 @@ params: name: hGraph desc: "[in] Handle of the graph to query." - type: bool* - name: hResult + name: pResult desc: "[out] Pointer to a boolean where the result will be stored." returns: - - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY - - $X_RESULT_ERROR_OUT_OF_RESOURCES + - $X_RESULT_ERROR_INVALID_GRAPH --- #-------------------------------------------------------------------------- type: function desc: "Dump the contents of the recorded graph to the provided file path." @@ -201,7 +184,3 @@ params: - type: const char* name: filePath desc: "[in] Path to the file to write the dumped graph contents." -returns: - - $X_RESULT_ERROR_INVALID_VALUE - - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY - - $X_RESULT_ERROR_OUT_OF_RESOURCES diff --git a/unified-runtime/scripts/core/registry.yml b/unified-runtime/scripts/core/registry.yml index 7fa6ab676fbc7..3146664d412ac 100644 --- a/unified-runtime/scripts/core/registry.yml +++ b/unified-runtime/scripts/core/registry.yml @@ -703,9 +703,6 @@ etors: - name: QUEUE_END_GRAPH_CAPTURE_EXP desc: Enumerator for $xQueueEndGraphCaptureExp value: '299' -- name: QUEUE_APPEND_GRAPH_EXP - desc: Enumerator for $xQueueAppendGraphExp - value: '301' - name: GRAPH_DESTROY_EXP desc: Enumerator for $xGraphDestroyExp value: '302' @@ -724,7 +721,10 @@ etors: - name: GRAPH_INSTANTIATE_GRAPH_EXP desc: Enumerator for $xGraphInstantiateGraphExp value: '307' -max_id: '307' +- name: ENQUEUE_GRAPH_EXP + desc: Enumerator for $xEnqueueGraphExp + value: '308' +max_id: '308' --- type: enum desc: Defines structure types diff --git a/unified-runtime/source/adapters/cuda/queue.cpp b/unified-runtime/source/adapters/cuda/queue.cpp index be3a71cc5299d..d9ad7eed159f4 100644 --- a/unified-runtime/source/adapters/cuda/queue.cpp +++ b/unified-runtime/source/adapters/cuda/queue.cpp @@ -275,11 +275,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueEndGraphCaptureExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urQueueAppendGraphExp( - ur_queue_handle_t /* hQueue */, - ur_exp_executable_graph_handle_t /* hGraph */, - ur_event_handle_t /* hSignalEvent */, uint32_t /* numWaitEvents */, - ur_event_handle_t * /* phWaitEvents */) { +UR_APIEXPORT ur_result_t UR_APICALL +urEnqueueGraphExp(ur_queue_handle_t /* hQueue */, + ur_exp_executable_graph_handle_t /* hGraph */, + uint32_t /* numEventsInWaitList */, + const ur_event_handle_t * /* phEventWaitList */, + ur_event_handle_t * /* phEvent */) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/cuda/ur_interface_loader.cpp b/unified-runtime/source/adapters/cuda/ur_interface_loader.cpp index 15e6ea7582dd5..88122acce13d2 100644 --- a/unified-runtime/source/adapters/cuda/ur_interface_loader.cpp +++ b/unified-runtime/source/adapters/cuda/ur_interface_loader.cpp @@ -259,7 +259,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urGetQueueExpProcAddrTable( pDdiTable->pfnBeginGraphCaptureExp = urQueueBeginGraphCaptureExp; pDdiTable->pfnBeginCaptureIntoGraphExp = urQueueBeginCaptureIntoGraphExp; pDdiTable->pfnEndGraphCaptureExp = urQueueEndGraphCaptureExp; - pDdiTable->pfnAppendGraphExp = urQueueAppendGraphExp; pDdiTable->pfnIsGraphCaptureEnabledExp = urQueueIsGraphCaptureEnabledExp; return UR_RESULT_SUCCESS; @@ -496,6 +495,7 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( pDdiTable->pfnUSMFreeExp = urEnqueueUSMFreeExp; pDdiTable->pfnCommandBufferExp = urEnqueueCommandBufferExp; pDdiTable->pfnKernelLaunchWithArgsExp = urEnqueueKernelLaunchWithArgsExp; + pDdiTable->pfnGraphExp = urEnqueueGraphExp; return UR_RESULT_SUCCESS; } diff --git a/unified-runtime/source/adapters/hip/queue.cpp b/unified-runtime/source/adapters/hip/queue.cpp index 3f9b5fee40adc..362e4b6d7f2bd 100644 --- a/unified-runtime/source/adapters/hip/queue.cpp +++ b/unified-runtime/source/adapters/hip/queue.cpp @@ -268,11 +268,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueEndGraphCaptureExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urQueueAppendGraphExp( - ur_queue_handle_t /* hQueue */, - ur_exp_executable_graph_handle_t /* hGraph */, - ur_event_handle_t /* hSignalEvent */, uint32_t /* numWaitEvents */, - ur_event_handle_t * /* phWaitEvents */) { +UR_APIEXPORT ur_result_t UR_APICALL +urEnqueueGraphExp(ur_queue_handle_t /* hQueue */, + ur_exp_executable_graph_handle_t /* hGraph */, + uint32_t /* numEventsInWaitList */, + const ur_event_handle_t * /* phEventWaitList */, + ur_event_handle_t * /* phEvent */) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/hip/ur_interface_loader.cpp b/unified-runtime/source/adapters/hip/ur_interface_loader.cpp index ba9f3053b9320..5640836cce825 100644 --- a/unified-runtime/source/adapters/hip/ur_interface_loader.cpp +++ b/unified-runtime/source/adapters/hip/ur_interface_loader.cpp @@ -259,7 +259,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urGetQueueExpProcAddrTable( pDdiTable->pfnBeginGraphCaptureExp = urQueueBeginGraphCaptureExp; pDdiTable->pfnBeginCaptureIntoGraphExp = urQueueBeginCaptureIntoGraphExp; pDdiTable->pfnEndGraphCaptureExp = urQueueEndGraphCaptureExp; - pDdiTable->pfnAppendGraphExp = urQueueAppendGraphExp; pDdiTable->pfnIsGraphCaptureEnabledExp = urQueueIsGraphCaptureEnabledExp; return UR_RESULT_SUCCESS; @@ -489,6 +488,7 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( pDdiTable->pfnNativeCommandExp = urEnqueueNativeCommandExp; pDdiTable->pfnCommandBufferExp = urEnqueueCommandBufferExp; pDdiTable->pfnKernelLaunchWithArgsExp = urEnqueueKernelLaunchWithArgsExp; + pDdiTable->pfnGraphExp = urEnqueueGraphExp; return UR_RESULT_SUCCESS; } diff --git a/unified-runtime/source/adapters/level_zero/queue.cpp b/unified-runtime/source/adapters/level_zero/queue.cpp index d2cef4cc58523..6a18cd1a9f52e 100644 --- a/unified-runtime/source/adapters/level_zero/queue.cpp +++ b/unified-runtime/source/adapters/level_zero/queue.cpp @@ -954,11 +954,11 @@ ur_result_t urQueueEndGraphCaptureExp(ur_queue_handle_t /* hQueue */, return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t urQueueAppendGraphExp(ur_queue_handle_t /* hQueue */, - ur_exp_executable_graph_handle_t /* hGraph */, - ur_event_handle_t /* hSignalEvent */, - uint32_t /* numWaitEvents */, - ur_event_handle_t * /* phWaitEvents */) { +ur_result_t urEnqueueGraphExp(ur_queue_handle_t /* hQueue */, + ur_exp_executable_graph_handle_t /* hGraph */, + uint32_t /* numEventsInWaitList */, + const ur_event_handle_t * /* phEventWaitList */, + ur_event_handle_t * /* phEvent */) { UR_LOG_LEGACY(ERR, logger::LegacyMessage("[UR][L0] {} function not implemented!"), "{} function not implemented!", __FUNCTION__); diff --git a/unified-runtime/source/adapters/level_zero/ur_interface_loader.cpp b/unified-runtime/source/adapters/level_zero/ur_interface_loader.cpp index 435e7cb80fa73..cdff8a4f4d3e8 100644 --- a/unified-runtime/source/adapters/level_zero/ur_interface_loader.cpp +++ b/unified-runtime/source/adapters/level_zero/ur_interface_loader.cpp @@ -235,6 +235,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( pDdiTable->pfnTimestampRecordingExp = ur::level_zero::urEnqueueTimestampRecordingExp; pDdiTable->pfnNativeCommandExp = ur::level_zero::urEnqueueNativeCommandExp; + pDdiTable->pfnGraphExp = ur::level_zero::urEnqueueGraphExp; return result; } @@ -474,7 +475,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urGetQueueExpProcAddrTable( pDdiTable->pfnBeginCaptureIntoGraphExp = ur::level_zero::urQueueBeginCaptureIntoGraphExp; pDdiTable->pfnEndGraphCaptureExp = ur::level_zero::urQueueEndGraphCaptureExp; - pDdiTable->pfnAppendGraphExp = ur::level_zero::urQueueAppendGraphExp; pDdiTable->pfnIsGraphCaptureEnabledExp = ur::level_zero::urQueueIsGraphCaptureEnabledExp; diff --git a/unified-runtime/source/adapters/level_zero/ur_interface_loader.hpp b/unified-runtime/source/adapters/level_zero/ur_interface_loader.hpp index c53091fb05eb2..b65fed856f7e0 100644 --- a/unified-runtime/source/adapters/level_zero/ur_interface_loader.hpp +++ b/unified-runtime/source/adapters/level_zero/ur_interface_loader.hpp @@ -853,17 +853,17 @@ ur_result_t urQueueEndGraphCaptureExp(ur_queue_handle_t hQueue, ur_result_t urGraphInstantiateGraphExp(ur_exp_graph_handle_t hGraph, ur_exp_executable_graph_handle_t *phExecGraph); -ur_result_t urQueueAppendGraphExp(ur_queue_handle_t hQueue, - ur_exp_executable_graph_handle_t hGraph, - ur_event_handle_t hSignalEvent, - uint32_t numWaitEvents, - ur_event_handle_t *phWaitEvents); +ur_result_t urEnqueueGraphExp(ur_queue_handle_t hQueue, + ur_exp_executable_graph_handle_t hGraph, + uint32_t numEventsInWaitList, + const ur_event_handle_t *phEventWaitList, + ur_event_handle_t *phEvent); ur_result_t urGraphDestroyExp(ur_exp_graph_handle_t hGraph); ur_result_t urGraphExecutableGraphDestroyExp( ur_exp_executable_graph_handle_t hExecutableGraph); ur_result_t urQueueIsGraphCaptureEnabledExp(ur_queue_handle_t hQueue, - bool *hResult); -ur_result_t urGraphIsEmptyExp(ur_exp_graph_handle_t hGraph, bool *hResult); + bool *pResult); +ur_result_t urGraphIsEmptyExp(ur_exp_graph_handle_t hGraph, bool *pResult); ur_result_t urGraphDumpContentsExp(ur_exp_graph_handle_t hGraph, const char *filePath); #ifdef UR_STATIC_ADAPTER_LEVEL_ZERO diff --git a/unified-runtime/source/adapters/level_zero/v2/queue_api.cpp b/unified-runtime/source/adapters/level_zero/v2/queue_api.cpp index 75bfe171e2367..6d7fe1cc99b5a 100644 --- a/unified-runtime/source/adapters/level_zero/v2/queue_api.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/queue_api.cpp @@ -496,19 +496,19 @@ ur_result_t urQueueEndGraphCaptureExp(ur_queue_handle_t hQueue, } catch (...) { return exceptionToResult(std::current_exception()); } -ur_result_t urQueueAppendGraphExp(ur_queue_handle_t hQueue, - ur_exp_executable_graph_handle_t hGraph, - ur_event_handle_t hSignalEvent, - uint32_t numWaitEvents, - ur_event_handle_t *phWaitEvents) try { - return hQueue->get().queueAppendGraphExp(hGraph, hSignalEvent, numWaitEvents, - phWaitEvents); +ur_result_t urEnqueueGraphExp(ur_queue_handle_t hQueue, + ur_exp_executable_graph_handle_t hGraph, + uint32_t numEventsInWaitList, + const ur_event_handle_t *phEventWaitList, + ur_event_handle_t *phEvent) try { + return hQueue->get().enqueueGraphExp(hGraph, numEventsInWaitList, + phEventWaitList, phEvent); } catch (...) { return exceptionToResult(std::current_exception()); } ur_result_t urQueueIsGraphCaptureEnabledExp(ur_queue_handle_t hQueue, - bool *hResult) try { - return hQueue->get().queueIsGraphCapteEnabledExp(hResult); + bool *pResult) try { + return hQueue->get().queueIsGraphCapteEnabledExp(pResult); } catch (...) { return exceptionToResult(std::current_exception()); } diff --git a/unified-runtime/source/adapters/level_zero/v2/queue_api.hpp b/unified-runtime/source/adapters/level_zero/v2/queue_api.hpp index 87b272cf9d413..06ffc5dbf526f 100644 --- a/unified-runtime/source/adapters/level_zero/v2/queue_api.hpp +++ b/unified-runtime/source/adapters/level_zero/v2/queue_api.hpp @@ -181,8 +181,8 @@ struct ur_queue_t_ : ur_queue_extensions { virtual ur_result_t queueBeginGraphCapteExp() = 0; virtual ur_result_t queueBeginCapteIntoGraphExp(ur_exp_graph_handle_t) = 0; virtual ur_result_t queueEndGraphCapteExp(ur_exp_graph_handle_t *) = 0; - virtual ur_result_t queueAppendGraphExp(ur_exp_executable_graph_handle_t, - ur_event_handle_t, uint32_t, - ur_event_handle_t *) = 0; + virtual ur_result_t enqueueGraphExp(ur_exp_executable_graph_handle_t, + uint32_t, const ur_event_handle_t *, + ur_event_handle_t *) = 0; virtual ur_result_t queueIsGraphCapteEnabledExp(bool *) = 0; }; diff --git a/unified-runtime/source/adapters/level_zero/v2/queue_batched.hpp b/unified-runtime/source/adapters/level_zero/v2/queue_batched.hpp index 86c4e8b740fae..882145cf22996 100644 --- a/unified-runtime/source/adapters/level_zero/v2/queue_batched.hpp +++ b/unified-runtime/source/adapters/level_zero/v2/queue_batched.hpp @@ -465,11 +465,10 @@ struct ur_queue_batched_t : ur_object, ur_queue_t_ { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_result_t - queueAppendGraphExp(ur_exp_executable_graph_handle_t /* hGraph */, - ur_event_handle_t /* hSignalEvent */, - uint32_t /* numWaitEvents */, - ur_event_handle_t * /* phWaitEvents */) override { + ur_result_t enqueueGraphExp(ur_exp_executable_graph_handle_t /* hGraph */, + uint32_t /* numEventsInWaitList */, + const ur_event_handle_t * /* phEventWaitList */, + ur_event_handle_t * /* phEvent */) override { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.hpp b/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.hpp index bdaf99d67ff82..6db4993e98b36 100644 --- a/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.hpp +++ b/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.hpp @@ -562,11 +562,10 @@ struct ur_queue_immediate_in_order_t : ur_object, ur_queue_t_ { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_result_t - queueAppendGraphExp(ur_exp_executable_graph_handle_t /* hGraph */, - ur_event_handle_t /* hSignalEvent */, - uint32_t /* numWaitEvents */, - ur_event_handle_t * /* phWaitEvents */) override { + ur_result_t enqueueGraphExp(ur_exp_executable_graph_handle_t /* hGraph */, + uint32_t /* numEventsInWaitList */, + const ur_event_handle_t * /* phEventWaitList */, + ur_event_handle_t * /* phEvent */) override { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/level_zero/v2/queue_immediate_out_of_order.hpp b/unified-runtime/source/adapters/level_zero/v2/queue_immediate_out_of_order.hpp index e02f49361eaa8..d771ca8cce79a 100644 --- a/unified-runtime/source/adapters/level_zero/v2/queue_immediate_out_of_order.hpp +++ b/unified-runtime/source/adapters/level_zero/v2/queue_immediate_out_of_order.hpp @@ -617,11 +617,10 @@ struct ur_queue_immediate_out_of_order_t : ur_object, ur_queue_t_ { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_result_t - queueAppendGraphExp(ur_exp_executable_graph_handle_t /* hGraph */, - ur_event_handle_t /* hSignalEvent */, - uint32_t /* numWaitEvents */, - ur_event_handle_t * /* phWaitEvents */) override { + ur_result_t enqueueGraphExp(ur_exp_executable_graph_handle_t /* hGraph */, + uint32_t /* numEventsInWaitList */, + const ur_event_handle_t * /* phEventWaitList */, + ur_event_handle_t * /* phEvent */) override { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/mock/ur_mockddi.cpp b/unified-runtime/source/adapters/mock/ur_mockddi.cpp index 56a73ee8af011..85b7e143d15be 100644 --- a/unified-runtime/source/adapters/mock/ur_mockddi.cpp +++ b/unified-runtime/source/adapters/mock/ur_mockddi.cpp @@ -12653,26 +12653,31 @@ __urdlllocal ur_result_t UR_APICALL urGraphInstantiateGraphExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urQueueAppendGraphExp -__urdlllocal ur_result_t UR_APICALL urQueueAppendGraphExp( - /// [in] Handle of the queue to append the graph to. +/// @brief Intercept function for urEnqueueGraphExp +__urdlllocal ur_result_t UR_APICALL urEnqueueGraphExp( + /// [in] Handle of the queue to which the graph will be enqueued. ur_queue_handle_t hQueue, - /// [in] Handle of the executable graph to append. + /// [in] Handle of the executable graph to be enqueued. ur_exp_executable_graph_handle_t hGraph, - /// [in][optional] Event to be signaled on completion. - ur_event_handle_t hSignalEvent, /// [in][optional] Number of events to wait on before executing. - uint32_t numWaitEvents, - /// [in][optional][range(0, numWaitEvents)] Handle of the events to wait - /// on before launching. - ur_event_handle_t *phWaitEvents) try { + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] Pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] Event object that identifies this particular + /// command instance. + /// If phEventWaitList and phEvent are not nullptr, phEvent must not refer + /// to an element of the phEventWaitList array. + ur_event_handle_t *phEvent) try { ur_result_t result = UR_RESULT_SUCCESS; - ur_queue_append_graph_exp_params_t params = {&hQueue, &hGraph, &hSignalEvent, - &numWaitEvents, &phWaitEvents}; + ur_enqueue_graph_exp_params_t params = { + &hQueue, &hGraph, &numEventsInWaitList, &phEventWaitList, &phEvent}; auto beforeCallback = reinterpret_cast( - mock::getCallbacks().get_before_callback("urQueueAppendGraphExp")); + mock::getCallbacks().get_before_callback("urEnqueueGraphExp")); if (beforeCallback) { result = beforeCallback(¶ms); if (result != UR_RESULT_SUCCESS) { @@ -12681,11 +12686,15 @@ __urdlllocal ur_result_t UR_APICALL urQueueAppendGraphExp( } auto replaceCallback = reinterpret_cast( - mock::getCallbacks().get_replace_callback("urQueueAppendGraphExp")); + mock::getCallbacks().get_replace_callback("urEnqueueGraphExp")); if (replaceCallback) { result = replaceCallback(¶ms); } else { + // optional output handle + if (phEvent) { + *phEvent = mock::createDummyHandle(); + } result = UR_RESULT_SUCCESS; } @@ -12694,7 +12703,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueAppendGraphExp( } auto afterCallback = reinterpret_cast( - mock::getCallbacks().get_after_callback("urQueueAppendGraphExp")); + mock::getCallbacks().get_after_callback("urEnqueueGraphExp")); if (afterCallback) { return afterCallback(¶ms); } @@ -12797,10 +12806,10 @@ __urdlllocal ur_result_t UR_APICALL urQueueIsGraphCaptureEnabledExp( /// [in] Native queue to query. ur_queue_handle_t hQueue, /// [out] Pointer to a boolean where the result will be stored. - bool *hResult) try { + bool *pResult) try { ur_result_t result = UR_RESULT_SUCCESS; - ur_queue_is_graph_capture_enabled_exp_params_t params = {&hQueue, &hResult}; + ur_queue_is_graph_capture_enabled_exp_params_t params = {&hQueue, &pResult}; auto beforeCallback = reinterpret_cast( mock::getCallbacks().get_before_callback( @@ -12844,10 +12853,10 @@ __urdlllocal ur_result_t UR_APICALL urGraphIsEmptyExp( /// [in] Handle of the graph to query. ur_exp_graph_handle_t hGraph, /// [out] Pointer to a boolean where the result will be stored. - bool *hResult) try { + bool *pResult) try { ur_result_t result = UR_RESULT_SUCCESS; - ur_graph_is_empty_exp_params_t params = {&hGraph, &hResult}; + ur_graph_is_empty_exp_params_t params = {&hGraph, &pResult}; auto beforeCallback = reinterpret_cast( mock::getCallbacks().get_before_callback("urGraphIsEmptyExp")); @@ -13303,6 +13312,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( pDdiTable->pfnNativeCommandExp = driver::urEnqueueNativeCommandExp; + pDdiTable->pfnGraphExp = driver::urEnqueueGraphExp; + return result; } catch (...) { return exceptionToResult(std::current_exception()); @@ -13803,8 +13814,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetQueueExpProcAddrTable( pDdiTable->pfnEndGraphCaptureExp = driver::urQueueEndGraphCaptureExp; - pDdiTable->pfnAppendGraphExp = driver::urQueueAppendGraphExp; - pDdiTable->pfnIsGraphCaptureEnabledExp = driver::urQueueIsGraphCaptureEnabledExp; diff --git a/unified-runtime/source/adapters/native_cpu/queue.cpp b/unified-runtime/source/adapters/native_cpu/queue.cpp index a8999fab9da71..9b5bcc369f37a 100644 --- a/unified-runtime/source/adapters/native_cpu/queue.cpp +++ b/unified-runtime/source/adapters/native_cpu/queue.cpp @@ -113,11 +113,12 @@ UR_APIEXPORT ur_result_t urQueueEndGraphCaptureExp( DIE_NO_IMPLEMENTATION; } -UR_APIEXPORT ur_result_t urQueueAppendGraphExp( - ur_queue_handle_t /* hQueue */, - ur_exp_executable_graph_handle_t /* hGraph */, - ur_event_handle_t /* hSignalEvent */, uint32_t /* numWaitEvents */, - ur_event_handle_t * /* phWaitEvents */) { +UR_APIEXPORT ur_result_t +urEnqueueGraphExp(ur_queue_handle_t /* hQueue */, + ur_exp_executable_graph_handle_t /* hGraph */, + uint32_t /* numEventsInWaitList */, + const ur_event_handle_t * /* phEventWaitList */, + ur_event_handle_t * /* phEvent */) { DIE_NO_IMPLEMENTATION; } diff --git a/unified-runtime/source/adapters/native_cpu/ur_interface_loader.cpp b/unified-runtime/source/adapters/native_cpu/ur_interface_loader.cpp index fc6e152be2922..139f80475e5dd 100644 --- a/unified-runtime/source/adapters/native_cpu/ur_interface_loader.cpp +++ b/unified-runtime/source/adapters/native_cpu/ur_interface_loader.cpp @@ -259,7 +259,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urGetQueueExpProcAddrTable( pDdiTable->pfnBeginGraphCaptureExp = urQueueBeginGraphCaptureExp; pDdiTable->pfnBeginCaptureIntoGraphExp = urQueueBeginCaptureIntoGraphExp; pDdiTable->pfnEndGraphCaptureExp = urQueueEndGraphCaptureExp; - pDdiTable->pfnAppendGraphExp = urQueueAppendGraphExp; pDdiTable->pfnIsGraphCaptureEnabledExp = urQueueIsGraphCaptureEnabledExp; return UR_RESULT_SUCCESS; @@ -473,6 +472,7 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( pDdiTable->pfnNativeCommandExp = urEnqueueNativeCommandExp; pDdiTable->pfnCommandBufferExp = urEnqueueCommandBufferExp; pDdiTable->pfnKernelLaunchWithArgsExp = urEnqueueKernelLaunchWithArgsExp; + pDdiTable->pfnGraphExp = urEnqueueGraphExp; return UR_RESULT_SUCCESS; } diff --git a/unified-runtime/source/adapters/offload/queue.cpp b/unified-runtime/source/adapters/offload/queue.cpp index c5435929dbeb5..4eb9502b59353 100644 --- a/unified-runtime/source/adapters/offload/queue.cpp +++ b/unified-runtime/source/adapters/offload/queue.cpp @@ -140,11 +140,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueEndGraphCaptureExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urQueueAppendGraphExp( - ur_queue_handle_t /* hQueue */, - ur_exp_executable_graph_handle_t /* hGraph */, - ur_event_handle_t /* hSignalEvent */, uint32_t /* numWaitEvents */, - ur_event_handle_t * /* phWaitEvents */) { +UR_APIEXPORT ur_result_t UR_APICALL +urEnqueueGraphExp(ur_queue_handle_t /* hQueue */, + ur_exp_executable_graph_handle_t /* hGraph */, + uint32_t /* numEventsInWaitList */, + const ur_event_handle_t * /* phEventWaitList */, + ur_event_handle_t * /* phEvent */) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/offload/ur_interface_loader.cpp b/unified-runtime/source/adapters/offload/ur_interface_loader.cpp index 0dd1ec836c7fb..eea537b87c610 100644 --- a/unified-runtime/source/adapters/offload/ur_interface_loader.cpp +++ b/unified-runtime/source/adapters/offload/ur_interface_loader.cpp @@ -222,7 +222,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urGetQueueExpProcAddrTable( pDdiTable->pfnBeginGraphCaptureExp = urQueueBeginGraphCaptureExp; pDdiTable->pfnBeginCaptureIntoGraphExp = urQueueBeginCaptureIntoGraphExp; pDdiTable->pfnEndGraphCaptureExp = urQueueEndGraphCaptureExp; - pDdiTable->pfnAppendGraphExp = urQueueAppendGraphExp; pDdiTable->pfnIsGraphCaptureEnabledExp = urQueueIsGraphCaptureEnabledExp; return UR_RESULT_SUCCESS; } @@ -425,6 +424,7 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( pDdiTable->pfnTimestampRecordingExp = nullptr; pDdiTable->pfnNativeCommandExp = nullptr; pDdiTable->pfnKernelLaunchWithArgsExp = urEnqueueKernelLaunchWithArgsExp; + pDdiTable->pfnGraphExp = urEnqueueGraphExp; return UR_RESULT_SUCCESS; } diff --git a/unified-runtime/source/adapters/opencl/queue.cpp b/unified-runtime/source/adapters/opencl/queue.cpp index eb511a7966229..7d52571a32bd1 100644 --- a/unified-runtime/source/adapters/opencl/queue.cpp +++ b/unified-runtime/source/adapters/opencl/queue.cpp @@ -327,11 +327,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueEndGraphCaptureExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urQueueAppendGraphExp( - ur_queue_handle_t /* hQueue */, - ur_exp_executable_graph_handle_t /* hGraph */, - ur_event_handle_t /* hSignalEvent */, uint32_t /* numWaitEvents */, - ur_event_handle_t * /* phWaitEvents */) { +UR_APIEXPORT ur_result_t UR_APICALL +urEnqueueGraphExp(ur_queue_handle_t /* hQueue */, + ur_exp_executable_graph_handle_t /* hGraph */, + uint32_t /* numEventsInWaitList */, + const ur_event_handle_t * /* phEventWaitList */, + ur_event_handle_t * /* phEvent */) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/opencl/ur_interface_loader.cpp b/unified-runtime/source/adapters/opencl/ur_interface_loader.cpp index d6885f480a57c..ba2221074baa5 100644 --- a/unified-runtime/source/adapters/opencl/ur_interface_loader.cpp +++ b/unified-runtime/source/adapters/opencl/ur_interface_loader.cpp @@ -445,6 +445,7 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( pDdiTable->pfnNativeCommandExp = urEnqueueNativeCommandExp; pDdiTable->pfnCommandBufferExp = urEnqueueCommandBufferExp; pDdiTable->pfnKernelLaunchWithArgsExp = urEnqueueKernelLaunchWithArgsExp; + pDdiTable->pfnGraphExp = urEnqueueGraphExp; return UR_RESULT_SUCCESS; } @@ -489,7 +490,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urGetQueueExpProcAddrTable( pDdiTable->pfnBeginGraphCaptureExp = urQueueBeginGraphCaptureExp; pDdiTable->pfnBeginCaptureIntoGraphExp = urQueueBeginCaptureIntoGraphExp; pDdiTable->pfnEndGraphCaptureExp = urQueueEndGraphCaptureExp; - pDdiTable->pfnAppendGraphExp = urQueueAppendGraphExp; pDdiTable->pfnIsGraphCaptureEnabledExp = urQueueIsGraphCaptureEnabledExp; return UR_RESULT_SUCCESS; diff --git a/unified-runtime/source/loader/layers/tracing/ur_trcddi.cpp b/unified-runtime/source/loader/layers/tracing/ur_trcddi.cpp index 2dc7e4ada1ace..905381c0a13d4 100644 --- a/unified-runtime/source/loader/layers/tracing/ur_trcddi.cpp +++ b/unified-runtime/source/loader/layers/tracing/ur_trcddi.cpp @@ -10723,43 +10723,48 @@ __urdlllocal ur_result_t UR_APICALL urGraphInstantiateGraphExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urQueueAppendGraphExp -__urdlllocal ur_result_t UR_APICALL urQueueAppendGraphExp( - /// [in] Handle of the queue to append the graph to. +/// @brief Intercept function for urEnqueueGraphExp +__urdlllocal ur_result_t UR_APICALL urEnqueueGraphExp( + /// [in] Handle of the queue to which the graph will be enqueued. ur_queue_handle_t hQueue, - /// [in] Handle of the executable graph to append. + /// [in] Handle of the executable graph to be enqueued. ur_exp_executable_graph_handle_t hGraph, - /// [in][optional] Event to be signaled on completion. - ur_event_handle_t hSignalEvent, /// [in][optional] Number of events to wait on before executing. - uint32_t numWaitEvents, - /// [in][optional][range(0, numWaitEvents)] Handle of the events to wait - /// on before launching. - ur_event_handle_t *phWaitEvents) { - auto pfnAppendGraphExp = getContext()->urDdiTable.QueueExp.pfnAppendGraphExp; + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] Pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] Event object that identifies this particular + /// command instance. + /// If phEventWaitList and phEvent are not nullptr, phEvent must not refer + /// to an element of the phEventWaitList array. + ur_event_handle_t *phEvent) { + auto pfnGraphExp = getContext()->urDdiTable.EnqueueExp.pfnGraphExp; - if (nullptr == pfnAppendGraphExp) + if (nullptr == pfnGraphExp) return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; - ur_queue_append_graph_exp_params_t params = {&hQueue, &hGraph, &hSignalEvent, - &numWaitEvents, &phWaitEvents}; - uint64_t instance = getContext()->notify_begin( - UR_FUNCTION_QUEUE_APPEND_GRAPH_EXP, "urQueueAppendGraphExp", ¶ms); + ur_enqueue_graph_exp_params_t params = { + &hQueue, &hGraph, &numEventsInWaitList, &phEventWaitList, &phEvent}; + uint64_t instance = getContext()->notify_begin(UR_FUNCTION_ENQUEUE_GRAPH_EXP, + "urEnqueueGraphExp", ¶ms); auto &logger = getContext()->logger; - UR_LOG_L(logger, INFO, " ---> urQueueAppendGraphExp\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueGraphExp\n"); - ur_result_t result = pfnAppendGraphExp(hQueue, hGraph, hSignalEvent, - numWaitEvents, phWaitEvents); + ur_result_t result = pfnGraphExp(hQueue, hGraph, numEventsInWaitList, + phEventWaitList, phEvent); - getContext()->notify_end(UR_FUNCTION_QUEUE_APPEND_GRAPH_EXP, - "urQueueAppendGraphExp", ¶ms, &result, instance); + getContext()->notify_end(UR_FUNCTION_ENQUEUE_GRAPH_EXP, "urEnqueueGraphExp", + ¶ms, &result, instance); if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_QUEUE_APPEND_GRAPH_EXP, ¶ms); - UR_LOG_L(logger, INFO, " <--- urQueueAppendGraphExp({}) -> {};\n", + ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_GRAPH_EXP, + ¶ms); + UR_LOG_L(logger, INFO, " <--- urEnqueueGraphExp({}) -> {};\n", args_str.str(), result); } @@ -10842,14 +10847,14 @@ __urdlllocal ur_result_t UR_APICALL urQueueIsGraphCaptureEnabledExp( /// [in] Native queue to query. ur_queue_handle_t hQueue, /// [out] Pointer to a boolean where the result will be stored. - bool *hResult) { + bool *pResult) { auto pfnIsGraphCaptureEnabledExp = getContext()->urDdiTable.QueueExp.pfnIsGraphCaptureEnabledExp; if (nullptr == pfnIsGraphCaptureEnabledExp) return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; - ur_queue_is_graph_capture_enabled_exp_params_t params = {&hQueue, &hResult}; + ur_queue_is_graph_capture_enabled_exp_params_t params = {&hQueue, &pResult}; uint64_t instance = getContext()->notify_begin(UR_FUNCTION_QUEUE_IS_GRAPH_CAPTURE_ENABLED_EXP, "urQueueIsGraphCaptureEnabledExp", ¶ms); @@ -10857,7 +10862,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueIsGraphCaptureEnabledExp( auto &logger = getContext()->logger; UR_LOG_L(logger, INFO, " ---> urQueueIsGraphCaptureEnabledExp\n"); - ur_result_t result = pfnIsGraphCaptureEnabledExp(hQueue, hResult); + ur_result_t result = pfnIsGraphCaptureEnabledExp(hQueue, pResult); getContext()->notify_end(UR_FUNCTION_QUEUE_IS_GRAPH_CAPTURE_ENABLED_EXP, "urQueueIsGraphCaptureEnabledExp", ¶ms, &result, @@ -10881,20 +10886,20 @@ __urdlllocal ur_result_t UR_APICALL urGraphIsEmptyExp( /// [in] Handle of the graph to query. ur_exp_graph_handle_t hGraph, /// [out] Pointer to a boolean where the result will be stored. - bool *hResult) { + bool *pResult) { auto pfnIsEmptyExp = getContext()->urDdiTable.GraphExp.pfnIsEmptyExp; if (nullptr == pfnIsEmptyExp) return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; - ur_graph_is_empty_exp_params_t params = {&hGraph, &hResult}; + ur_graph_is_empty_exp_params_t params = {&hGraph, &pResult}; uint64_t instance = getContext()->notify_begin(UR_FUNCTION_GRAPH_IS_EMPTY_EXP, "urGraphIsEmptyExp", ¶ms); auto &logger = getContext()->logger; UR_LOG_L(logger, INFO, " ---> urGraphIsEmptyExp\n"); - ur_result_t result = pfnIsEmptyExp(hGraph, hResult); + ur_result_t result = pfnIsEmptyExp(hGraph, pResult); getContext()->notify_end(UR_FUNCTION_GRAPH_IS_EMPTY_EXP, "urGraphIsEmptyExp", ¶ms, &result, instance); @@ -11459,6 +11464,9 @@ __urdlllocal ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( dditable.pfnNativeCommandExp = pDdiTable->pfnNativeCommandExp; pDdiTable->pfnNativeCommandExp = ur_tracing_layer::urEnqueueNativeCommandExp; + dditable.pfnGraphExp = pDdiTable->pfnGraphExp; + pDdiTable->pfnGraphExp = ur_tracing_layer::urEnqueueGraphExp; + return result; } /////////////////////////////////////////////////////////////////////////////// @@ -12084,9 +12092,6 @@ __urdlllocal ur_result_t UR_APICALL urGetQueueExpProcAddrTable( pDdiTable->pfnEndGraphCaptureExp = ur_tracing_layer::urQueueEndGraphCaptureExp; - dditable.pfnAppendGraphExp = pDdiTable->pfnAppendGraphExp; - pDdiTable->pfnAppendGraphExp = ur_tracing_layer::urQueueAppendGraphExp; - dditable.pfnIsGraphCaptureEnabledExp = pDdiTable->pfnIsGraphCaptureEnabledExp; pDdiTable->pfnIsGraphCaptureEnabledExp = ur_tracing_layer::urQueueIsGraphCaptureEnabledExp; diff --git a/unified-runtime/source/loader/layers/validation/ur_valddi.cpp b/unified-runtime/source/loader/layers/validation/ur_valddi.cpp index b0245d25daef4..8a5cccca06159 100644 --- a/unified-runtime/source/loader/layers/validation/ur_valddi.cpp +++ b/unified-runtime/source/loader/layers/validation/ur_valddi.cpp @@ -11502,22 +11502,27 @@ __urdlllocal ur_result_t UR_APICALL urGraphInstantiateGraphExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urQueueAppendGraphExp -__urdlllocal ur_result_t UR_APICALL urQueueAppendGraphExp( - /// [in] Handle of the queue to append the graph to. +/// @brief Intercept function for urEnqueueGraphExp +__urdlllocal ur_result_t UR_APICALL urEnqueueGraphExp( + /// [in] Handle of the queue to which the graph will be enqueued. ur_queue_handle_t hQueue, - /// [in] Handle of the executable graph to append. + /// [in] Handle of the executable graph to be enqueued. ur_exp_executable_graph_handle_t hGraph, - /// [in][optional] Event to be signaled on completion. - ur_event_handle_t hSignalEvent, /// [in][optional] Number of events to wait on before executing. - uint32_t numWaitEvents, - /// [in][optional][range(0, numWaitEvents)] Handle of the events to wait - /// on before launching. - ur_event_handle_t *phWaitEvents) { - auto pfnAppendGraphExp = getContext()->urDdiTable.QueueExp.pfnAppendGraphExp; + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] Pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] Event object that identifies this particular + /// command instance. + /// If phEventWaitList and phEvent are not nullptr, phEvent must not refer + /// to an element of the phEventWaitList array. + ur_event_handle_t *phEvent) { + auto pfnGraphExp = getContext()->urDdiTable.EnqueueExp.pfnGraphExp; - if (nullptr == pfnAppendGraphExp) { + if (nullptr == pfnGraphExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -11527,6 +11532,20 @@ __urdlllocal ur_result_t UR_APICALL urQueueAppendGraphExp( if (NULL == hGraph) return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (phEventWaitList == NULL && numEventsInWaitList > 0) + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + + if (phEventWaitList != NULL && numEventsInWaitList == 0) + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } if (getContext()->enableLifetimeValidation && @@ -11534,13 +11553,13 @@ __urdlllocal ur_result_t UR_APICALL urQueueAppendGraphExp( URLOG_CTX_INVALID_REFERENCE(hQueue); } - if (getContext()->enableLifetimeValidation && - !getContext()->refCountContext->isReferenceValid(hSignalEvent)) { - URLOG_CTX_INVALID_REFERENCE(hSignalEvent); - } + ur_result_t result = pfnGraphExp(hQueue, hGraph, numEventsInWaitList, + phEventWaitList, phEvent); - ur_result_t result = pfnAppendGraphExp(hQueue, hGraph, hSignalEvent, - numWaitEvents, phWaitEvents); + if (getContext()->enableLeakChecking && result == UR_RESULT_SUCCESS && + phEvent) { + getContext()->refCountContext->createRefCount(*phEvent); + } return result; } @@ -11594,7 +11613,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueIsGraphCaptureEnabledExp( /// [in] Native queue to query. ur_queue_handle_t hQueue, /// [out] Pointer to a boolean where the result will be stored. - bool *hResult) { + bool *pResult) { auto pfnIsGraphCaptureEnabledExp = getContext()->urDdiTable.QueueExp.pfnIsGraphCaptureEnabledExp; @@ -11603,7 +11622,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueIsGraphCaptureEnabledExp( } if (getContext()->enableParameterValidation) { - if (NULL == hResult) + if (NULL == pResult) return UR_RESULT_ERROR_INVALID_NULL_POINTER; if (NULL == hQueue) @@ -11615,7 +11634,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueIsGraphCaptureEnabledExp( URLOG_CTX_INVALID_REFERENCE(hQueue); } - ur_result_t result = pfnIsGraphCaptureEnabledExp(hQueue, hResult); + ur_result_t result = pfnIsGraphCaptureEnabledExp(hQueue, pResult); return result; } @@ -11626,7 +11645,7 @@ __urdlllocal ur_result_t UR_APICALL urGraphIsEmptyExp( /// [in] Handle of the graph to query. ur_exp_graph_handle_t hGraph, /// [out] Pointer to a boolean where the result will be stored. - bool *hResult) { + bool *pResult) { auto pfnIsEmptyExp = getContext()->urDdiTable.GraphExp.pfnIsEmptyExp; if (nullptr == pfnIsEmptyExp) { @@ -11634,14 +11653,14 @@ __urdlllocal ur_result_t UR_APICALL urGraphIsEmptyExp( } if (getContext()->enableParameterValidation) { - if (NULL == hResult) + if (NULL == pResult) return UR_RESULT_ERROR_INVALID_NULL_POINTER; if (NULL == hGraph) return UR_RESULT_ERROR_INVALID_NULL_HANDLE; } - ur_result_t result = pfnIsEmptyExp(hGraph, hResult); + ur_result_t result = pfnIsEmptyExp(hGraph, pResult); return result; } @@ -12197,6 +12216,9 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( pDdiTable->pfnNativeCommandExp = ur_validation_layer::urEnqueueNativeCommandExp; + dditable.pfnGraphExp = pDdiTable->pfnGraphExp; + pDdiTable->pfnGraphExp = ur_validation_layer::urEnqueueGraphExp; + return result; } @@ -12838,9 +12860,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetQueueExpProcAddrTable( pDdiTable->pfnEndGraphCaptureExp = ur_validation_layer::urQueueEndGraphCaptureExp; - dditable.pfnAppendGraphExp = pDdiTable->pfnAppendGraphExp; - pDdiTable->pfnAppendGraphExp = ur_validation_layer::urQueueAppendGraphExp; - dditable.pfnIsGraphCaptureEnabledExp = pDdiTable->pfnIsGraphCaptureEnabledExp; pDdiTable->pfnIsGraphCaptureEnabledExp = ur_validation_layer::urQueueIsGraphCaptureEnabledExp; diff --git a/unified-runtime/source/loader/loader.def.in b/unified-runtime/source/loader/loader.def.in index e368adca367dd..0435ec9315e1d 100644 --- a/unified-runtime/source/loader/loader.def.in +++ b/unified-runtime/source/loader/loader.def.in @@ -76,6 +76,7 @@ EXPORTS urEnqueueEventsWait urEnqueueEventsWaitWithBarrier urEnqueueEventsWaitWithBarrierExt + urEnqueueGraphExp urEnqueueKernelLaunch urEnqueueKernelLaunchWithArgsExp urEnqueueMemBufferCopy @@ -304,6 +305,7 @@ EXPORTS urPrintEnqueueEventsWaitParams urPrintEnqueueEventsWaitWithBarrierExtParams urPrintEnqueueEventsWaitWithBarrierParams + urPrintEnqueueGraphExpParams urPrintEnqueueKernelLaunchParams urPrintEnqueueKernelLaunchWithArgsExpParams urPrintEnqueueMemBufferCopyParams @@ -501,7 +503,6 @@ EXPORTS urPrintProgramReleaseParams urPrintProgramRetainParams urPrintProgramSetSpecializationConstantsParams - urPrintQueueAppendGraphExpParams urPrintQueueBeginCaptureIntoGraphExpParams urPrintQueueBeginGraphCaptureExpParams urPrintQueueCreateParams @@ -603,7 +604,6 @@ EXPORTS urProgramRelease urProgramRetain urProgramSetSpecializationConstants - urQueueAppendGraphExp urQueueBeginCaptureIntoGraphExp urQueueBeginGraphCaptureExp urQueueCreate diff --git a/unified-runtime/source/loader/loader.map.in b/unified-runtime/source/loader/loader.map.in index a9d015469ef6a..ac8dcf2522ea8 100644 --- a/unified-runtime/source/loader/loader.map.in +++ b/unified-runtime/source/loader/loader.map.in @@ -76,6 +76,7 @@ urEnqueueEventsWait; urEnqueueEventsWaitWithBarrier; urEnqueueEventsWaitWithBarrierExt; + urEnqueueGraphExp; urEnqueueKernelLaunch; urEnqueueKernelLaunchWithArgsExp; urEnqueueMemBufferCopy; @@ -304,6 +305,7 @@ urPrintEnqueueEventsWaitParams; urPrintEnqueueEventsWaitWithBarrierExtParams; urPrintEnqueueEventsWaitWithBarrierParams; + urPrintEnqueueGraphExpParams; urPrintEnqueueKernelLaunchParams; urPrintEnqueueKernelLaunchWithArgsExpParams; urPrintEnqueueMemBufferCopyParams; @@ -501,7 +503,6 @@ urPrintProgramReleaseParams; urPrintProgramRetainParams; urPrintProgramSetSpecializationConstantsParams; - urPrintQueueAppendGraphExpParams; urPrintQueueBeginCaptureIntoGraphExpParams; urPrintQueueBeginGraphCaptureExpParams; urPrintQueueCreateParams; @@ -603,7 +604,6 @@ urProgramRelease; urProgramRetain; urProgramSetSpecializationConstants; - urQueueAppendGraphExp; urQueueBeginCaptureIntoGraphExp; urQueueBeginGraphCaptureExp; urQueueCreate; diff --git a/unified-runtime/source/loader/ur_ldrddi.cpp b/unified-runtime/source/loader/ur_ldrddi.cpp index c7c60ec879dc9..3a366b990055c 100644 --- a/unified-runtime/source/loader/ur_ldrddi.cpp +++ b/unified-runtime/source/loader/ur_ldrddi.cpp @@ -6085,29 +6085,34 @@ __urdlllocal ur_result_t UR_APICALL urGraphInstantiateGraphExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urQueueAppendGraphExp -__urdlllocal ur_result_t UR_APICALL urQueueAppendGraphExp( - /// [in] Handle of the queue to append the graph to. +/// @brief Intercept function for urEnqueueGraphExp +__urdlllocal ur_result_t UR_APICALL urEnqueueGraphExp( + /// [in] Handle of the queue to which the graph will be enqueued. ur_queue_handle_t hQueue, - /// [in] Handle of the executable graph to append. + /// [in] Handle of the executable graph to be enqueued. ur_exp_executable_graph_handle_t hGraph, - /// [in][optional] Event to be signaled on completion. - ur_event_handle_t hSignalEvent, /// [in][optional] Number of events to wait on before executing. - uint32_t numWaitEvents, - /// [in][optional][range(0, numWaitEvents)] Handle of the events to wait - /// on before launching. - ur_event_handle_t *phWaitEvents) { + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] Pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] Event object that identifies this particular + /// command instance. + /// If phEventWaitList and phEvent are not nullptr, phEvent must not refer + /// to an element of the phEventWaitList array. + ur_event_handle_t *phEvent) { auto *dditable = *reinterpret_cast(hQueue); - auto *pfnAppendGraphExp = dditable->QueueExp.pfnAppendGraphExp; - if (nullptr == pfnAppendGraphExp) + auto *pfnGraphExp = dditable->EnqueueExp.pfnGraphExp; + if (nullptr == pfnGraphExp) return UR_RESULT_ERROR_UNINITIALIZED; // forward to device-platform - return pfnAppendGraphExp(hQueue, hGraph, hSignalEvent, numWaitEvents, - phWaitEvents); + return pfnGraphExp(hQueue, hGraph, numEventsInWaitList, phEventWaitList, + phEvent); } /////////////////////////////////////////////////////////////////////////////// @@ -6149,7 +6154,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueIsGraphCaptureEnabledExp( /// [in] Native queue to query. ur_queue_handle_t hQueue, /// [out] Pointer to a boolean where the result will be stored. - bool *hResult) { + bool *pResult) { auto *dditable = *reinterpret_cast(hQueue); @@ -6159,7 +6164,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueIsGraphCaptureEnabledExp( return UR_RESULT_ERROR_UNINITIALIZED; // forward to device-platform - return pfnIsGraphCaptureEnabledExp(hQueue, hResult); + return pfnIsGraphCaptureEnabledExp(hQueue, pResult); } /////////////////////////////////////////////////////////////////////////////// @@ -6168,7 +6173,7 @@ __urdlllocal ur_result_t UR_APICALL urGraphIsEmptyExp( /// [in] Handle of the graph to query. ur_exp_graph_handle_t hGraph, /// [out] Pointer to a boolean where the result will be stored. - bool *hResult) { + bool *pResult) { auto *dditable = *reinterpret_cast(hGraph); @@ -6177,7 +6182,7 @@ __urdlllocal ur_result_t UR_APICALL urGraphIsEmptyExp( return UR_RESULT_ERROR_UNINITIALIZED; // forward to device-platform - return pfnIsEmptyExp(hGraph, hResult); + return pfnIsEmptyExp(hGraph, pResult); } /////////////////////////////////////////////////////////////////////////////// @@ -6641,6 +6646,7 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( pDdiTable->pfnTimestampRecordingExp = ur_loader::urEnqueueTimestampRecordingExp; pDdiTable->pfnNativeCommandExp = ur_loader::urEnqueueNativeCommandExp; + pDdiTable->pfnGraphExp = ur_loader::urEnqueueGraphExp; } else { // return pointers directly to platform's DDIs *pDdiTable = @@ -7362,7 +7368,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetQueueExpProcAddrTable( pDdiTable->pfnBeginCaptureIntoGraphExp = ur_loader::urQueueBeginCaptureIntoGraphExp; pDdiTable->pfnEndGraphCaptureExp = ur_loader::urQueueEndGraphCaptureExp; - pDdiTable->pfnAppendGraphExp = ur_loader::urQueueAppendGraphExp; pDdiTable->pfnIsGraphCaptureEnabledExp = ur_loader::urQueueIsGraphCaptureEnabledExp; } else { diff --git a/unified-runtime/source/loader/ur_libapi.cpp b/unified-runtime/source/loader/ur_libapi.cpp index 48366210af215..7e5d6977b619d 100644 --- a/unified-runtime/source/loader/ur_libapi.cpp +++ b/unified-runtime/source/loader/ur_libapi.cpp @@ -11018,9 +11018,6 @@ ur_result_t UR_APICALL urEnqueueNativeCommandExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Create a new record & replay graph instance explicitly. /// -/// @details -/// - Create a new record & replay graph instance explicitly. -/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED @@ -11030,8 +11027,6 @@ ur_result_t UR_APICALL urEnqueueNativeCommandExp( /// + `NULL == hContext` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT ur_result_t UR_APICALL urGraphCreateExp( /// [in] Handle of the context object. ur_context_handle_t hContext, @@ -11047,7 +11042,7 @@ ur_result_t UR_APICALL urGraphCreateExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Begin graph capture on the specified immediate queue. +/// @brief Begin graph capture on the specified queue. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -11056,8 +11051,6 @@ ur_result_t UR_APICALL urGraphCreateExp( /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT ur_result_t UR_APICALL urQueueBeginGraphCaptureExp( /// [in] Handle of the queue on which to begin graph capture. ur_queue_handle_t hQueue) try { @@ -11073,7 +11066,7 @@ ur_result_t UR_APICALL urQueueBeginGraphCaptureExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Begin capturing commands into an existing graph on the specified -/// immediate queue. +/// queue. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -11083,8 +11076,6 @@ ur_result_t UR_APICALL urQueueBeginGraphCaptureExp( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` /// + `NULL == hGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT ur_result_t UR_APICALL urQueueBeginCaptureIntoGraphExp( /// [in] Handle of the queue on which to begin graph capture. ur_queue_handle_t hQueue, @@ -11101,7 +11092,7 @@ ur_result_t UR_APICALL urQueueBeginCaptureIntoGraphExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief End graph capture on the specified immediate queue. +/// @brief End graph capture on the specified queue. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -11112,8 +11103,6 @@ ur_result_t UR_APICALL urQueueBeginCaptureIntoGraphExp( /// + `NULL == hQueue` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT ur_result_t UR_APICALL urQueueEndGraphCaptureExp( /// [in] Handle of the queue on which to end graph capture. ur_queue_handle_t hQueue, @@ -11143,8 +11132,6 @@ ur_result_t UR_APICALL urQueueEndGraphCaptureExp( /// + `NULL == hGraph` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phExecGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT ur_result_t UR_APICALL urGraphInstantiateGraphExp( /// [in] Handle of the recorded graph to instantiate. ur_exp_graph_handle_t hGraph, @@ -11161,7 +11148,7 @@ ur_result_t UR_APICALL urGraphInstantiateGraphExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Append an executable graph to the queue. +/// @brief Enqueue an executable graph onto the queue. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -11171,27 +11158,33 @@ ur_result_t UR_APICALL urGraphInstantiateGraphExp( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` /// + `NULL == hGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT -ur_result_t UR_APICALL urQueueAppendGraphExp( - /// [in] Handle of the queue to append the graph to. +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +ur_result_t UR_APICALL urEnqueueGraphExp( + /// [in] Handle of the queue to which the graph will be enqueued. ur_queue_handle_t hQueue, - /// [in] Handle of the executable graph to append. + /// [in] Handle of the executable graph to be enqueued. ur_exp_executable_graph_handle_t hGraph, - /// [in][optional] Event to be signaled on completion. - ur_event_handle_t hSignalEvent, /// [in][optional] Number of events to wait on before executing. - uint32_t numWaitEvents, - /// [in][optional][range(0, numWaitEvents)] Handle of the events to wait - /// on before launching. - ur_event_handle_t *phWaitEvents) try { - auto pfnAppendGraphExp = - ur_lib::getContext()->urDdiTable.QueueExp.pfnAppendGraphExp; - if (nullptr == pfnAppendGraphExp) + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] Pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] Event object that identifies this particular + /// command instance. + /// If phEventWaitList and phEvent are not nullptr, phEvent must not refer + /// to an element of the phEventWaitList array. + ur_event_handle_t *phEvent) try { + auto pfnGraphExp = ur_lib::getContext()->urDdiTable.EnqueueExp.pfnGraphExp; + if (nullptr == pfnGraphExp) return UR_RESULT_ERROR_UNINITIALIZED; - return pfnAppendGraphExp(hQueue, hGraph, hSignalEvent, numWaitEvents, - phWaitEvents); + return pfnGraphExp(hQueue, hGraph, numEventsInWaitList, phEventWaitList, + phEvent); } catch (...) { return exceptionToResult(std::current_exception()); } @@ -11208,8 +11201,6 @@ ur_result_t UR_APICALL urQueueAppendGraphExp( /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT ur_result_t UR_APICALL urGraphDestroyExp( /// [in] Handle of the graph object to destroy. ur_exp_graph_handle_t hGraph) try { @@ -11233,8 +11224,6 @@ ur_result_t UR_APICALL urGraphDestroyExp( /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hExecutableGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT ur_result_t UR_APICALL urGraphExecutableGraphDestroyExp( /// [in] Handle of the executable graph object to destroy. ur_exp_executable_graph_handle_t hExecutableGraph) try { @@ -11259,20 +11248,18 @@ ur_result_t UR_APICALL urGraphExecutableGraphDestroyExp( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == hResult` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT +/// + `NULL == pResult` ur_result_t UR_APICALL urQueueIsGraphCaptureEnabledExp( /// [in] Native queue to query. ur_queue_handle_t hQueue, /// [out] Pointer to a boolean where the result will be stored. - bool *hResult) try { + bool *pResult) try { auto pfnIsGraphCaptureEnabledExp = ur_lib::getContext()->urDdiTable.QueueExp.pfnIsGraphCaptureEnabledExp; if (nullptr == pfnIsGraphCaptureEnabledExp) return UR_RESULT_ERROR_UNINITIALIZED; - return pfnIsGraphCaptureEnabledExp(hQueue, hResult); + return pfnIsGraphCaptureEnabledExp(hQueue, pResult); } catch (...) { return exceptionToResult(std::current_exception()); } @@ -11288,19 +11275,18 @@ ur_result_t UR_APICALL urQueueIsGraphCaptureEnabledExp( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hGraph` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == hResult` -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// + `NULL == pResult` +/// - ::UR_RESULT_ERROR_INVALID_GRAPH ur_result_t UR_APICALL urGraphIsEmptyExp( /// [in] Handle of the graph to query. ur_exp_graph_handle_t hGraph, /// [out] Pointer to a boolean where the result will be stored. - bool *hResult) try { + bool *pResult) try { auto pfnIsEmptyExp = ur_lib::getContext()->urDdiTable.GraphExp.pfnIsEmptyExp; if (nullptr == pfnIsEmptyExp) return UR_RESULT_ERROR_UNINITIALIZED; - return pfnIsEmptyExp(hGraph, hResult); + return pfnIsEmptyExp(hGraph, pResult); } catch (...) { return exceptionToResult(std::current_exception()); } @@ -11317,9 +11303,6 @@ ur_result_t UR_APICALL urGraphIsEmptyExp( /// + `NULL == hGraph` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == filePath` -/// - ::UR_RESULT_ERROR_INVALID_VALUE -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urGraphDumpContentsExp( /// [in] Handle of the graph to dump. ur_exp_graph_handle_t hGraph, diff --git a/unified-runtime/source/loader/ur_print.cpp b/unified-runtime/source/loader/ur_print.cpp index 3f254d6830de7..6fe53ce867ca3 100644 --- a/unified-runtime/source/loader/ur_print.cpp +++ b/unified-runtime/source/loader/ur_print.cpp @@ -1996,6 +1996,15 @@ ur_result_t urPrintEnqueueNativeCommandExpParams( return str_copy(&ss, buffer, buff_size, out_size); } +ur_result_t +urPrintEnqueueGraphExpParams(const struct ur_enqueue_graph_exp_params_t *params, + char *buffer, const size_t buff_size, + size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + ur_result_t urPrintEventGetInfoParams(const struct ur_event_get_info_params_t *params, char *buffer, const size_t buff_size, @@ -2795,14 +2804,6 @@ ur_result_t urPrintQueueEndGraphCaptureExpParams( return str_copy(&ss, buffer, buff_size, out_size); } -ur_result_t urPrintQueueAppendGraphExpParams( - const struct ur_queue_append_graph_exp_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size) { - std::stringstream ss; - ss << params; - return str_copy(&ss, buffer, buff_size, out_size); -} - ur_result_t urPrintQueueIsGraphCaptureEnabledExpParams( const struct ur_queue_is_graph_capture_enabled_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size) { diff --git a/unified-runtime/source/ur_api.cpp b/unified-runtime/source/ur_api.cpp index d3460ba4879ab..6b76c3a1f306d 100644 --- a/unified-runtime/source/ur_api.cpp +++ b/unified-runtime/source/ur_api.cpp @@ -9588,9 +9588,6 @@ ur_result_t UR_APICALL urEnqueueNativeCommandExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Create a new record & replay graph instance explicitly. /// -/// @details -/// - Create a new record & replay graph instance explicitly. -/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED @@ -9600,8 +9597,6 @@ ur_result_t UR_APICALL urEnqueueNativeCommandExp( /// + `NULL == hContext` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT ur_result_t UR_APICALL urGraphCreateExp( /// [in] Handle of the context object. ur_context_handle_t hContext, @@ -9612,7 +9607,7 @@ ur_result_t UR_APICALL urGraphCreateExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Begin graph capture on the specified immediate queue. +/// @brief Begin graph capture on the specified queue. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -9621,8 +9616,6 @@ ur_result_t UR_APICALL urGraphCreateExp( /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT ur_result_t UR_APICALL urQueueBeginGraphCaptureExp( /// [in] Handle of the queue on which to begin graph capture. ur_queue_handle_t hQueue) { @@ -9632,7 +9625,7 @@ ur_result_t UR_APICALL urQueueBeginGraphCaptureExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Begin capturing commands into an existing graph on the specified -/// immediate queue. +/// queue. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -9642,8 +9635,6 @@ ur_result_t UR_APICALL urQueueBeginGraphCaptureExp( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` /// + `NULL == hGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT ur_result_t UR_APICALL urQueueBeginCaptureIntoGraphExp( /// [in] Handle of the queue on which to begin graph capture. ur_queue_handle_t hQueue, @@ -9654,7 +9645,7 @@ ur_result_t UR_APICALL urQueueBeginCaptureIntoGraphExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief End graph capture on the specified immediate queue. +/// @brief End graph capture on the specified queue. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -9665,8 +9656,6 @@ ur_result_t UR_APICALL urQueueBeginCaptureIntoGraphExp( /// + `NULL == hQueue` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT ur_result_t UR_APICALL urQueueEndGraphCaptureExp( /// [in] Handle of the queue on which to end graph capture. ur_queue_handle_t hQueue, @@ -9690,8 +9679,6 @@ ur_result_t UR_APICALL urQueueEndGraphCaptureExp( /// + `NULL == hGraph` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phExecGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT ur_result_t UR_APICALL urGraphInstantiateGraphExp( /// [in] Handle of the recorded graph to instantiate. ur_exp_graph_handle_t hGraph, @@ -9702,7 +9689,7 @@ ur_result_t UR_APICALL urGraphInstantiateGraphExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Append an executable graph to the queue. +/// @brief Enqueue an executable graph onto the queue. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -9712,20 +9699,27 @@ ur_result_t UR_APICALL urGraphInstantiateGraphExp( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` /// + `NULL == hGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT -ur_result_t UR_APICALL urQueueAppendGraphExp( - /// [in] Handle of the queue to append the graph to. +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +ur_result_t UR_APICALL urEnqueueGraphExp( + /// [in] Handle of the queue to which the graph will be enqueued. ur_queue_handle_t hQueue, - /// [in] Handle of the executable graph to append. + /// [in] Handle of the executable graph to be enqueued. ur_exp_executable_graph_handle_t hGraph, - /// [in][optional] Event to be signaled on completion. - ur_event_handle_t hSignalEvent, /// [in][optional] Number of events to wait on before executing. - uint32_t numWaitEvents, - /// [in][optional][range(0, numWaitEvents)] Handle of the events to wait - /// on before launching. - ur_event_handle_t *phWaitEvents) { + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] Pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] Event object that identifies this particular + /// command instance. + /// If phEventWaitList and phEvent are not nullptr, phEvent must not refer + /// to an element of the phEventWaitList array. + ur_event_handle_t *phEvent) { ur_result_t result = UR_RESULT_SUCCESS; return result; } @@ -9742,8 +9736,6 @@ ur_result_t UR_APICALL urQueueAppendGraphExp( /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT ur_result_t UR_APICALL urGraphDestroyExp( /// [in] Handle of the graph object to destroy. ur_exp_graph_handle_t hGraph) { @@ -9762,8 +9754,6 @@ ur_result_t UR_APICALL urGraphDestroyExp( /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hExecutableGraph` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT ur_result_t UR_APICALL urGraphExecutableGraphDestroyExp( /// [in] Handle of the executable graph object to destroy. ur_exp_executable_graph_handle_t hExecutableGraph) { @@ -9782,14 +9772,12 @@ ur_result_t UR_APICALL urGraphExecutableGraphDestroyExp( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == hResult` -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT +/// + `NULL == pResult` ur_result_t UR_APICALL urQueueIsGraphCaptureEnabledExp( /// [in] Native queue to query. ur_queue_handle_t hQueue, /// [out] Pointer to a boolean where the result will be stored. - bool *hResult) { + bool *pResult) { ur_result_t result = UR_RESULT_SUCCESS; return result; } @@ -9805,14 +9793,13 @@ ur_result_t UR_APICALL urQueueIsGraphCaptureEnabledExp( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hGraph` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == hResult` -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// + `NULL == pResult` +/// - ::UR_RESULT_ERROR_INVALID_GRAPH ur_result_t UR_APICALL urGraphIsEmptyExp( /// [in] Handle of the graph to query. ur_exp_graph_handle_t hGraph, /// [out] Pointer to a boolean where the result will be stored. - bool *hResult) { + bool *pResult) { ur_result_t result = UR_RESULT_SUCCESS; return result; } @@ -9829,9 +9816,6 @@ ur_result_t UR_APICALL urGraphIsEmptyExp( /// + `NULL == hGraph` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == filePath` -/// - ::UR_RESULT_ERROR_INVALID_VALUE -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urGraphDumpContentsExp( /// [in] Handle of the graph to dump. ur_exp_graph_handle_t hGraph,