diff --git a/include/ur_api.h b/include/ur_api.h index 81d7a92c01..fec0164ac0 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -375,16 +375,10 @@ typedef enum ur_function_t { UR_FUNCTION_PROGRAM_GET_GLOBAL_VARIABLE_POINTER = 216, /// Enumerator for ::urDeviceGetSelected UR_FUNCTION_DEVICE_GET_SELECTED = 217, - /// Enumerator for ::urCommandBufferRetainCommandExp - UR_FUNCTION_COMMAND_BUFFER_RETAIN_COMMAND_EXP = 218, - /// Enumerator for ::urCommandBufferReleaseCommandExp - UR_FUNCTION_COMMAND_BUFFER_RELEASE_COMMAND_EXP = 219, /// Enumerator for ::urCommandBufferUpdateKernelLaunchExp UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP = 220, /// Enumerator for ::urCommandBufferGetInfoExp UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP = 221, - /// Enumerator for ::urCommandBufferCommandGetInfoExp - UR_FUNCTION_COMMAND_BUFFER_COMMAND_GET_INFO_EXP = 222, /// Enumerator for ::urEnqueueTimestampRecordingExp UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP = 223, /// Enumerator for ::urEnqueueKernelLaunchCustomExp @@ -11021,41 +11015,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp( /// array. ur_event_handle_t *phEvent); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Increment the command object's reference count. -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_DEVICE_LOST -/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `NULL == hCommand` -/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferRetainCommandExp( - /// [in][retain] Handle of the command-buffer command. - ur_exp_command_buffer_command_handle_t hCommand); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Decrement the command object's reference count and delete the command -/// object if the reference count becomes zero. -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_DEVICE_LOST -/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `NULL == hCommand` -/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferReleaseCommandExp( - /// [in][release] Handle of the command-buffer command. - ur_exp_command_buffer_command_handle_t hCommand); - /////////////////////////////////////////////////////////////////////////////// /// @brief Update a kernel launch command in a finalized command-buffer. /// @@ -11244,43 +11203,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferGetInfoExp( /// [out][optional] bytes returned in command-buffer property size_t *pPropSizeRet); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get command-buffer object information. -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_DEVICE_LOST -/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `NULL == hCommand` -/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_EXP_COMMAND_BUFFER_COMMAND_INFO_REFERENCE_COUNT < propName` -/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION -/// + If `propName` is not supported by the adapter. -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// + `propSize == 0 && pPropValue != NULL` -/// + If `propSize` is less than the real number of bytes needed to -/// return the info. -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `propSize != 0 && pPropValue == NULL` -/// + `pPropValue == NULL && pPropSizeRet == NULL` -/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCommandGetInfoExp( - /// [in] handle of the command-buffer command object - ur_exp_command_buffer_command_handle_t hCommand, - /// [in] the name of the command-buffer command property to query - ur_exp_command_buffer_command_info_t propName, - /// [in] size in bytes of the command-buffer command property value - size_t propSize, - /// [out][optional][typename(propName, propSize)] value of the - /// command-buffer command property - void *pPropValue, - /// [out][optional] bytes returned in command-buffer command property - size_t *pPropSizeRet); - #if !defined(__GNUC__) #pragma endregion #endif @@ -14249,22 +14171,6 @@ typedef struct ur_command_buffer_enqueue_exp_params_t { ur_event_handle_t **pphEvent; } ur_command_buffer_enqueue_exp_params_t; -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferRetainCommandExp -/// @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_command_buffer_retain_command_exp_params_t { - ur_exp_command_buffer_command_handle_t *phCommand; -} ur_command_buffer_retain_command_exp_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferReleaseCommandExp -/// @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_command_buffer_release_command_exp_params_t { - ur_exp_command_buffer_command_handle_t *phCommand; -} ur_command_buffer_release_command_exp_params_t; - /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urCommandBufferUpdateKernelLaunchExp /// @details Each entry is a pointer to the parameter passed to the function; @@ -14306,18 +14212,6 @@ typedef struct ur_command_buffer_get_info_exp_params_t { size_t **ppPropSizeRet; } ur_command_buffer_get_info_exp_params_t; -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferCommandGetInfoExp -/// @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_command_buffer_command_get_info_exp_params_t { - ur_exp_command_buffer_command_handle_t *phCommand; - ur_exp_command_buffer_command_info_t *ppropName; - size_t *ppropSize; - void **ppPropValue; - size_t **ppPropSizeRet; -} ur_command_buffer_command_get_info_exp_params_t; - /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urUsmP2PEnablePeerAccessExp /// @details Each entry is a pointer to the parameter passed to the function; diff --git a/include/ur_api_funcs.def b/include/ur_api_funcs.def index 9aef728a58..8c25dde67f 100644 --- a/include/ur_api_funcs.def +++ b/include/ur_api_funcs.def @@ -182,13 +182,10 @@ _UR_API(urCommandBufferAppendMemBufferFillExp) _UR_API(urCommandBufferAppendUSMPrefetchExp) _UR_API(urCommandBufferAppendUSMAdviseExp) _UR_API(urCommandBufferEnqueueExp) -_UR_API(urCommandBufferRetainCommandExp) -_UR_API(urCommandBufferReleaseCommandExp) _UR_API(urCommandBufferUpdateKernelLaunchExp) _UR_API(urCommandBufferUpdateSignalEventExp) _UR_API(urCommandBufferUpdateWaitEventsExp) _UR_API(urCommandBufferGetInfoExp) -_UR_API(urCommandBufferCommandGetInfoExp) _UR_API(urUsmP2PEnablePeerAccessExp) _UR_API(urUsmP2PDisablePeerAccessExp) _UR_API(urUsmP2PPeerAccessGetInfoExp) diff --git a/include/ur_ddi.h b/include/ur_ddi.h index 9e27b87f17..c64aaa8d46 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -1596,16 +1596,6 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferEnqueueExp_t)( ur_exp_command_buffer_handle_t, ur_queue_handle_t, uint32_t, const ur_event_handle_t *, ur_event_handle_t *); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferRetainCommandExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferRetainCommandExp_t)( - ur_exp_command_buffer_command_handle_t); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferReleaseCommandExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferReleaseCommandExp_t)( - ur_exp_command_buffer_command_handle_t); - /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urCommandBufferUpdateKernelLaunchExp typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateKernelLaunchExp_t)( @@ -1629,12 +1619,6 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferGetInfoExp_t)( ur_exp_command_buffer_handle_t, ur_exp_command_buffer_info_t, size_t, void *, size_t *); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferCommandGetInfoExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferCommandGetInfoExp_t)( - ur_exp_command_buffer_command_handle_t, - ur_exp_command_buffer_command_info_t, size_t, void *, size_t *); - /////////////////////////////////////////////////////////////////////////////// /// @brief Table of CommandBufferExp functions pointers typedef struct ur_command_buffer_exp_dditable_t { @@ -1656,13 +1640,10 @@ typedef struct ur_command_buffer_exp_dditable_t { ur_pfnCommandBufferAppendUSMPrefetchExp_t pfnAppendUSMPrefetchExp; ur_pfnCommandBufferAppendUSMAdviseExp_t pfnAppendUSMAdviseExp; ur_pfnCommandBufferEnqueueExp_t pfnEnqueueExp; - ur_pfnCommandBufferRetainCommandExp_t pfnRetainCommandExp; - ur_pfnCommandBufferReleaseCommandExp_t pfnReleaseCommandExp; ur_pfnCommandBufferUpdateKernelLaunchExp_t pfnUpdateKernelLaunchExp; ur_pfnCommandBufferUpdateSignalEventExp_t pfnUpdateSignalEventExp; ur_pfnCommandBufferUpdateWaitEventsExp_t pfnUpdateWaitEventsExp; ur_pfnCommandBufferGetInfoExp_t pfnGetInfoExp; - ur_pfnCommandBufferCommandGetInfoExp_t pfnCommandGetInfoExp; } ur_command_buffer_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// diff --git a/include/ur_print.h b/include/ur_print.h index bcdd8172f8..f58133bb8a 100644 --- a/include/ur_print.h +++ b/include/ur_print.h @@ -3171,26 +3171,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferEnqueueExpParams( const struct ur_command_buffer_enqueue_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_command_buffer_retain_command_exp_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferRetainCommandExpParams( - const struct ur_command_buffer_retain_command_exp_params_t *params, - char *buffer, const size_t buff_size, size_t *out_size); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_command_buffer_release_command_exp_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferReleaseCommandExpParams( - const struct ur_command_buffer_release_command_exp_params_t *params, - char *buffer, const size_t buff_size, size_t *out_size); - /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_command_buffer_update_kernel_launch_exp_params_t struct /// @returns @@ -3234,16 +3214,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferGetInfoExpParams( const struct ur_command_buffer_get_info_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_command_buffer_command_get_info_exp_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferCommandGetInfoExpParams( - const struct ur_command_buffer_command_get_info_exp_params_t *params, - char *buffer, const size_t buff_size, size_t *out_size); - /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_usm_p2p_enable_peer_access_exp_params_t struct /// @returns diff --git a/include/ur_print.hpp b/include/ur_print.hpp index c9a4d3d246..57a30597d1 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -1096,21 +1096,12 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_DEVICE_GET_SELECTED: os << "UR_FUNCTION_DEVICE_GET_SELECTED"; break; - case UR_FUNCTION_COMMAND_BUFFER_RETAIN_COMMAND_EXP: - os << "UR_FUNCTION_COMMAND_BUFFER_RETAIN_COMMAND_EXP"; - break; - case UR_FUNCTION_COMMAND_BUFFER_RELEASE_COMMAND_EXP: - os << "UR_FUNCTION_COMMAND_BUFFER_RELEASE_COMMAND_EXP"; - break; case UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP"; break; case UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_COMMAND_GET_INFO_EXP: - os << "UR_FUNCTION_COMMAND_BUFFER_COMMAND_GET_INFO_EXP"; - break; case UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP: os << "UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP"; break; @@ -18612,40 +18603,6 @@ operator<<(std::ostream &os, return os; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_command_buffer_retain_command_exp_params_t -/// type -/// @returns -/// std::ostream & -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_command_buffer_retain_command_exp_params_t - *params) { - - os << ".hCommand = "; - - ur::details::printPtr(os, *(params->phCommand)); - - return os; -} - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_command_buffer_release_command_exp_params_t -/// type -/// @returns -/// std::ostream & -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_command_buffer_release_command_exp_params_t - *params) { - - os << ".hCommand = "; - - ur::details::printPtr(os, *(params->phCommand)); - - return os; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the /// ur_command_buffer_update_kernel_launch_exp_params_t type @@ -18761,42 +18718,6 @@ operator<<(std::ostream &os, return os; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the -/// ur_command_buffer_command_get_info_exp_params_t type -/// @returns -/// std::ostream & -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_command_buffer_command_get_info_exp_params_t *params) { - - os << ".hCommand = "; - - ur::details::printPtr(os, *(params->phCommand)); - - os << ", "; - os << ".propName = "; - - os << *(params->ppropName); - - os << ", "; - os << ".propSize = "; - - os << *(params->ppropSize); - - os << ", "; - os << ".pPropValue = "; - ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); - - os << ", "; - os << ".pPropSizeRet = "; - - ur::details::printPtr(os, *(params->ppPropSizeRet)); - - return os; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_usm_p2p_enable_peer_access_exp_params_t /// type @@ -20067,12 +19988,6 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, case UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP: { os << (const struct ur_command_buffer_enqueue_exp_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_RETAIN_COMMAND_EXP: { - os << (const struct ur_command_buffer_retain_command_exp_params_t *)params; - } break; - case UR_FUNCTION_COMMAND_BUFFER_RELEASE_COMMAND_EXP: { - os << (const struct ur_command_buffer_release_command_exp_params_t *)params; - } break; case UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP: { os << (const struct ur_command_buffer_update_kernel_launch_exp_params_t *) params; @@ -20088,10 +20003,6 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, case UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP: { os << (const struct ur_command_buffer_get_info_exp_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_COMMAND_GET_INFO_EXP: { - os << (const struct ur_command_buffer_command_get_info_exp_params_t *) - params; - } break; case UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP: { os << (const struct ur_usm_p2p_enable_peer_access_exp_params_t *)params; } break; diff --git a/scripts/core/EXP-COMMAND-BUFFER.rst b/scripts/core/EXP-COMMAND-BUFFER.rst index 2313afd036..1a4925e83f 100644 --- a/scripts/core/EXP-COMMAND-BUFFER.rst +++ b/scripts/core/EXP-COMMAND-BUFFER.rst @@ -486,13 +486,10 @@ Functions * ${x}CommandBufferAppendUSMPrefetchExp * ${x}CommandBufferAppendUSMAdviseExp * ${x}CommandBufferEnqueueExp -* ${x}CommandBufferRetainCommandExp -* ${x}CommandBufferReleaseCommandExp * ${x}CommandBufferUpdateKernelLaunchExp * ${x}CommandBufferUpdateSignalEventExp * ${x}CommandBufferUpdateWaitEventsExp * ${x}CommandBufferGetInfoExp -* ${x}CommandBufferCommandGetInfoExp Changelog -------------------------------------------------------------------------------- @@ -515,6 +512,8 @@ Changelog +-----------+-------------------------------------------------------+ | 1.6 | Command level synchronization with event objects | +-----------+-------------------------------------------------------+ +| 1.7 | Remove command handle reference counting and querying | ++-----------+-------------------------------------------------------+ Contributors -------------------------------------------------------------------------------- diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index bec96d99a5..11ea144d53 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -1165,32 +1165,6 @@ returns: - $X_RESULT_ERROR_OUT_OF_RESOURCES --- #-------------------------------------------------------------------------- type: function -desc: "Increment the command object's reference count." -class: $xCommandBuffer -name: RetainCommandExp -params: - - type: $x_exp_command_buffer_command_handle_t - name: hCommand - desc: "[in][retain] Handle of the command-buffer command." -returns: - - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP - - $X_RESULT_ERROR_OUT_OF_RESOURCES - - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY ---- #-------------------------------------------------------------------------- -type: function -desc: "Decrement the command object's reference count and delete the command object if the reference count becomes zero." -class: $xCommandBuffer -name: ReleaseCommandExp -params: - - type: $x_exp_command_buffer_command_handle_t - name: hCommand - desc: "[in][release] Handle of the command-buffer command." -returns: - - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP - - $X_RESULT_ERROR_OUT_OF_RESOURCES - - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY ---- #-------------------------------------------------------------------------- -type: function desc: "Update a kernel launch command in a finalized command-buffer." details: "This entry-point is synchronous and may block if the command-buffer is executing when the entry-point is called." class: $xCommandBuffer @@ -1313,36 +1287,3 @@ returns: - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP - $X_RESULT_ERROR_OUT_OF_RESOURCES - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY ---- #-------------------------------------------------------------------------- -type: function -desc: "Get command-buffer object information." -class: $xCommandBuffer -name: CommandGetInfoExp -params: - - type: $x_exp_command_buffer_command_handle_t - name: hCommand - desc: "[in] handle of the command-buffer command object" - - type: $x_exp_command_buffer_command_info_t - name: propName - desc: "[in] the name of the command-buffer command property to query" - - type: size_t - name: propSize - desc: "[in] size in bytes of the command-buffer command property value" - - type: void* - name: pPropValue - desc: "[out][optional][typename(propName, propSize)] value of the command-buffer command property" - - type: size_t* - name: pPropSizeRet - desc: "[out][optional] bytes returned in command-buffer command property" -returns: - - $X_RESULT_ERROR_UNSUPPORTED_ENUMERATION: - - "If `propName` is not supported by the adapter." - - $X_RESULT_ERROR_INVALID_SIZE: - - "`propSize == 0 && pPropValue != NULL`" - - "If `propSize` is less than the real number of bytes needed to return the info." - - $X_RESULT_ERROR_INVALID_NULL_POINTER: - - "`propSize != 0 && pPropValue == NULL`" - - "`pPropValue == NULL && pPropSizeRet == NULL`" - - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP - - $X_RESULT_ERROR_OUT_OF_RESOURCES - - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY diff --git a/scripts/core/registry.yml b/scripts/core/registry.yml index 379ef87b35..c774642482 100644 --- a/scripts/core/registry.yml +++ b/scripts/core/registry.yml @@ -520,21 +520,12 @@ etors: - name: DEVICE_GET_SELECTED desc: Enumerator for $xDeviceGetSelected value: '217' -- name: COMMAND_BUFFER_RETAIN_COMMAND_EXP - desc: Enumerator for $xCommandBufferRetainCommandExp - value: '218' -- name: COMMAND_BUFFER_RELEASE_COMMAND_EXP - desc: Enumerator for $xCommandBufferReleaseCommandExp - value: '219' - name: COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP desc: Enumerator for $xCommandBufferUpdateKernelLaunchExp value: '220' - name: COMMAND_BUFFER_GET_INFO_EXP desc: Enumerator for $xCommandBufferGetInfoExp value: '221' -- name: COMMAND_BUFFER_COMMAND_GET_INFO_EXP - desc: Enumerator for $xCommandBufferCommandGetInfoExp - value: '222' - name: ENQUEUE_TIMESTAMP_RECORDING_EXP desc: Enumerator for $xEnqueueTimestampRecordingExp value: '223' diff --git a/source/adapters/cuda/command_buffer.cpp b/source/adapters/cuda/command_buffer.cpp index 545ef8f6e3..0d274e6c15 100644 --- a/source/adapters/cuda/command_buffer.cpp +++ b/source/adapters/cuda/command_buffer.cpp @@ -21,11 +21,7 @@ namespace { ur_result_t -commandBufferReleaseInternal(ur_exp_command_buffer_handle_t CommandBuffer) try { - if (CommandBuffer->decrementInternalReferenceCount() != 0) { - return UR_RESULT_SUCCESS; - } - +commandBufferDestroy(ur_exp_command_buffer_handle_t CommandBuffer) try { // Release the memory allocated to the CudaGraph UR_CHECK_ERROR(cuGraphDestroy(CommandBuffer->CudaGraph)); @@ -40,15 +36,8 @@ commandBufferReleaseInternal(ur_exp_command_buffer_handle_t CommandBuffer) try { return Err; } -ur_result_t commandHandleReleaseInternal( - ur_exp_command_buffer_command_handle_t Command) try { - if (Command->decrementInternalReferenceCount() != 0) { - return UR_RESULT_SUCCESS; - } - - // Decrement parent command-buffer internal ref count - commandBufferReleaseInternal(Command->CommandBuffer); - +ur_result_t commandHandleDestroy( + std::unique_ptr &Command) try { // We create the ur_event_t returned to the user for a signal node using // `makeWithNative` which sets `HasOwnership` to false. Therefore destruction // of the `ur_event_t` object doesn't free the underlying CuEvent_t object and @@ -60,7 +49,6 @@ ur_result_t commandHandleReleaseInternal( UR_CHECK_ERROR(cuEventDestroy(SignalEvent)); } - delete Command; return UR_RESULT_SUCCESS; } catch (ur_result_t Err) { return Err; @@ -70,8 +58,8 @@ ur_result_t commandHandleReleaseInternal( ur_exp_command_buffer_handle_t_::ur_exp_command_buffer_handle_t_( ur_context_handle_t Context, ur_device_handle_t Device, bool IsUpdatable) : Context(Context), Device(Device), IsUpdatable(IsUpdatable), - CudaGraph{nullptr}, CudaGraphExec{nullptr}, RefCountInternal{1}, - RefCountExternal{1}, NextSyncPoint{0} { + CudaGraph{nullptr}, CudaGraphExec{nullptr}, RefCount{1}, + NextSyncPoint{0} { urContextRetain(Context); urDeviceRetain(Device); } @@ -150,15 +138,6 @@ kernel_command_handle::kernel_command_handle( } }; -ur_exp_command_buffer_command_handle_t_:: - ur_exp_command_buffer_command_handle_t_( - ur_exp_command_buffer_handle_t CommandBuffer, CUgraphNode Node, - CUgraphNode SignalNode, const std::vector &WaitNodes) - : CommandBuffer(CommandBuffer), Node(Node), SignalNode(SignalNode), - WaitNodes(WaitNodes), RefCountInternal(1), RefCountExternal(1) { - CommandBuffer->incrementInternalReferenceCount(); -} - /// Helper function for finding the Cuda Nodes associated with the /// commands in a command-buffer, each event is pointed to by a sync-point in /// the wait list. @@ -356,14 +335,14 @@ static ur_result_t enqueueCommandBufferFillHelper( std::vector WaitNodes = NumEventsInWaitList ? std::move(DepsList) : std::vector(); - auto NewCommand = new T(CommandBuffer, GraphNode, SignalNode, WaitNodes, - std::move(DecomposedNodes)); - CommandBuffer->CommandHandles.push_back(NewCommand); - + auto NewCommand = std::make_unique(CommandBuffer, GraphNode, SignalNode, + WaitNodes, std::move(DecomposedNodes)); if (RetCommand) { - NewCommand->incrementInternalReferenceCount(); - *RetCommand = NewCommand; + *RetCommand = NewCommand.get(); } + + CommandBuffer->CommandHandles.push_back(std::move(NewCommand)); + return UR_RESULT_SUCCESS; } catch (ur_result_t Err) { return Err; @@ -397,22 +376,22 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCreateExp( UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferRetainExp(ur_exp_command_buffer_handle_t hCommandBuffer) { - hCommandBuffer->incrementInternalReferenceCount(); - hCommandBuffer->incrementExternalReferenceCount(); + hCommandBuffer->incrementReferenceCount(); return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferReleaseExp(ur_exp_command_buffer_handle_t hCommandBuffer) { - if (hCommandBuffer->decrementExternalReferenceCount() == 0) { - // External ref count has reached zero, internal release of created - // commands. - for (auto Command : hCommandBuffer->CommandHandles) { - commandHandleReleaseInternal(Command); + if (hCommandBuffer->decrementReferenceCount() == 0) { + // Ref count has reached zero, release of created commands + for (auto &Command : hCommandBuffer->CommandHandles) { + commandHandleDestroy(Command); } + + return commandBufferDestroy(hCommandBuffer); } - return commandBufferReleaseInternal(hCommandBuffer); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL @@ -556,16 +535,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( std::vector WaitNodes = numEventsInWaitList ? std::move(DepsList) : std::vector(); - auto NewCommand = new kernel_command_handle( + auto NewCommand = std::make_unique( hCommandBuffer, hKernel, GraphNode, NodeParams, workDim, pGlobalWorkOffset, pGlobalWorkSize, pLocalWorkSize, numKernelAlternatives, phKernelAlternatives, SignalNode, WaitNodes); - hCommandBuffer->CommandHandles.push_back(NewCommand); if (phCommand) { - NewCommand->incrementInternalReferenceCount(); - *phCommand = NewCommand; + *phCommand = NewCommand.get(); } + + hCommandBuffer->CommandHandles.push_back(std::move(NewCommand)); } catch (ur_result_t Err) { return Err; } @@ -613,14 +592,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( std::vector WaitNodes = numEventsInWaitList ? std::move(DepsList) : std::vector(); - auto NewCommand = new usm_memcpy_command_handle(hCommandBuffer, GraphNode, - SignalNode, WaitNodes); - hCommandBuffer->CommandHandles.push_back(NewCommand); - + auto NewCommand = std::make_unique( + hCommandBuffer, GraphNode, SignalNode, WaitNodes); if (phCommand) { - NewCommand->incrementInternalReferenceCount(); - *phCommand = NewCommand; + *phCommand = NewCommand.get(); } + + hCommandBuffer->CommandHandles.push_back(std::move(NewCommand)); return UR_RESULT_SUCCESS; } catch (ur_result_t Err) { return Err; @@ -679,14 +657,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( std::vector WaitNodes = numEventsInWaitList ? std::move(DepsList) : std::vector(); - auto NewCommand = new buffer_copy_command_handle(hCommandBuffer, GraphNode, - SignalNode, WaitNodes); - hCommandBuffer->CommandHandles.push_back(NewCommand); + auto NewCommand = std::make_unique( + hCommandBuffer, GraphNode, SignalNode, WaitNodes); if (phCommand) { - NewCommand->incrementInternalReferenceCount(); - *phCommand = NewCommand; + *phCommand = NewCommand.get(); } + + hCommandBuffer->CommandHandles.push_back(std::move(NewCommand)); return UR_RESULT_SUCCESS; } catch (ur_result_t Err) { return Err; @@ -742,14 +720,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( std::vector WaitNodes = numEventsInWaitList ? std::move(DepsList) : std::vector(); - auto NewCommand = new buffer_copy_rect_command_handle( + auto NewCommand = std::make_unique( hCommandBuffer, GraphNode, SignalNode, WaitNodes); - hCommandBuffer->CommandHandles.push_back(NewCommand); if (phCommand) { - NewCommand->incrementInternalReferenceCount(); - *phCommand = NewCommand; + *phCommand = NewCommand.get(); } + + hCommandBuffer->CommandHandles.push_back(std::move(NewCommand)); return UR_RESULT_SUCCESS; } catch (ur_result_t Err) { return Err; @@ -801,14 +779,13 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( std::vector WaitNodes = numEventsInWaitList ? std::move(DepsList) : std::vector(); - auto NewCommand = new buffer_write_command_handle(hCommandBuffer, GraphNode, - SignalNode, WaitNodes); - hCommandBuffer->CommandHandles.push_back(NewCommand); - + auto NewCommand = std::make_unique( + hCommandBuffer, GraphNode, SignalNode, WaitNodes); if (phCommand) { - NewCommand->incrementInternalReferenceCount(); - *phCommand = NewCommand; + *phCommand = NewCommand.get(); } + + hCommandBuffer->CommandHandles.push_back(std::move(NewCommand)); return UR_RESULT_SUCCESS; } catch (ur_result_t Err) { return Err; @@ -859,14 +836,13 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( std::vector WaitNodes = numEventsInWaitList ? std::move(DepsList) : std::vector(); - auto NewCommand = new buffer_read_command_handle(hCommandBuffer, GraphNode, - SignalNode, WaitNodes); - hCommandBuffer->CommandHandles.push_back(NewCommand); - + auto NewCommand = std::make_unique( + hCommandBuffer, GraphNode, SignalNode, WaitNodes); if (phCommand) { - NewCommand->incrementInternalReferenceCount(); - *phCommand = NewCommand; + *phCommand = NewCommand.get(); } + + hCommandBuffer->CommandHandles.push_back(std::move(NewCommand)); return UR_RESULT_SUCCESS; } catch (ur_result_t Err) { return Err; @@ -921,14 +897,14 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( std::vector WaitNodes = numEventsInWaitList ? std::move(DepsList) : std::vector(); - auto NewCommand = new buffer_write_rect_command_handle( + auto NewCommand = std::make_unique( hCommandBuffer, GraphNode, SignalNode, WaitNodes); - hCommandBuffer->CommandHandles.push_back(NewCommand); if (phCommand) { - NewCommand->incrementInternalReferenceCount(); - *phCommand = NewCommand; + *phCommand = NewCommand.get(); } + + hCommandBuffer->CommandHandles.push_back(std::move(NewCommand)); return UR_RESULT_SUCCESS; } catch (ur_result_t Err) { return Err; @@ -983,14 +959,14 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( std::vector WaitNodes = numEventsInWaitList ? std::move(DepsList) : std::vector(); - auto NewCommand = new buffer_read_rect_command_handle( + auto NewCommand = std::make_unique( hCommandBuffer, GraphNode, SignalNode, WaitNodes); - hCommandBuffer->CommandHandles.push_back(NewCommand); if (phCommand) { - NewCommand->incrementInternalReferenceCount(); - *phCommand = NewCommand; + *phCommand = NewCommand.get(); } + + hCommandBuffer->CommandHandles.push_back(std::move(NewCommand)); return UR_RESULT_SUCCESS; } catch (ur_result_t Err) { return Err; @@ -1037,14 +1013,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( std::vector WaitNodes = numEventsInWaitList ? std::move(DepsList) : std::vector(); - auto NewCommand = new usm_prefetch_command_handle(hCommandBuffer, GraphNode, - SignalNode, WaitNodes); - hCommandBuffer->CommandHandles.push_back(NewCommand); + auto NewCommand = std::make_unique( + hCommandBuffer, GraphNode, SignalNode, WaitNodes); if (phCommand) { - NewCommand->incrementInternalReferenceCount(); - *phCommand = NewCommand; + *phCommand = NewCommand.get(); } + + hCommandBuffer->CommandHandles.push_back(std::move(NewCommand)); return UR_RESULT_SUCCESS; } catch (ur_result_t Err) { return Err; @@ -1091,15 +1067,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( std::vector WaitNodes = numEventsInWaitList ? std::move(DepsList) : std::vector(); - auto NewCommand = new usm_advise_command_handle(hCommandBuffer, GraphNode, - SignalNode, WaitNodes); - hCommandBuffer->CommandHandles.push_back(NewCommand); + auto NewCommand = std::make_unique( + hCommandBuffer, GraphNode, SignalNode, WaitNodes); if (phCommand) { - NewCommand->incrementInternalReferenceCount(); - *phCommand = NewCommand; + *phCommand = NewCommand.get(); } + hCommandBuffer->CommandHandles.push_back(std::move(NewCommand)); + return UR_RESULT_SUCCESS; } catch (ur_result_t Err) { return Err; @@ -1186,19 +1162,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp( return Err; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferRetainCommandExp( - ur_exp_command_buffer_command_handle_t hCommand) { - hCommand->incrementExternalReferenceCount(); - hCommand->incrementInternalReferenceCount(); - return UR_RESULT_SUCCESS; -} - -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferReleaseCommandExp( - ur_exp_command_buffer_command_handle_t hCommand) { - hCommand->decrementExternalReferenceCount(); - return commandHandleReleaseInternal(hCommand); -} - /** * Validates contents of the update command description. * @param[in] Command The command which is being updated. @@ -1487,7 +1450,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferGetInfoExp( switch (propName) { case UR_EXP_COMMAND_BUFFER_INFO_REFERENCE_COUNT: - return ReturnValue(hCommandBuffer->getExternalReferenceCount()); + return ReturnValue(hCommandBuffer->getReferenceCount()); case UR_EXP_COMMAND_BUFFER_INFO_DESCRIPTOR: { ur_exp_command_buffer_desc_t Descriptor{}; Descriptor.stype = UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC; @@ -1504,19 +1467,3 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferGetInfoExp( return UR_RESULT_ERROR_INVALID_ENUMERATION; } - -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCommandGetInfoExp( - ur_exp_command_buffer_command_handle_t hCommand, - ur_exp_command_buffer_command_info_t propName, size_t propSize, - void *pPropValue, size_t *pPropSizeRet) { - UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet); - - switch (propName) { - case UR_EXP_COMMAND_BUFFER_COMMAND_INFO_REFERENCE_COUNT: - return ReturnValue(hCommand->getExternalReferenceCount()); - default: - assert(!"Command-buffer command info request not implemented"); - } - - return UR_RESULT_ERROR_INVALID_ENUMERATION; -} diff --git a/source/adapters/cuda/command_buffer.hpp b/source/adapters/cuda/command_buffer.hpp index 9b40088f75..97d809e5a3 100644 --- a/source/adapters/cuda/command_buffer.hpp +++ b/source/adapters/cuda/command_buffer.hpp @@ -56,29 +56,14 @@ enum class CommandType { struct ur_exp_command_buffer_command_handle_t_ { ur_exp_command_buffer_command_handle_t_( ur_exp_command_buffer_handle_t CommandBuffer, CUgraphNode Node, - CUgraphNode SignalNode, const std::vector &WaitNodes); + CUgraphNode SignalNode, const std::vector &WaitNodes) + : CommandBuffer(CommandBuffer), Node(Node), SignalNode(SignalNode), + WaitNodes(WaitNodes) {} virtual ~ur_exp_command_buffer_command_handle_t_() {} virtual CommandType getCommandType() const noexcept = 0; - uint32_t incrementInternalReferenceCount() noexcept { - return ++RefCountInternal; - } - uint32_t decrementInternalReferenceCount() noexcept { - return --RefCountInternal; - } - - uint32_t incrementExternalReferenceCount() noexcept { - return ++RefCountExternal; - } - uint32_t decrementExternalReferenceCount() noexcept { - return --RefCountExternal; - } - uint32_t getExternalReferenceCount() const noexcept { - return RefCountExternal; - } - // Parent UR command-buffer. ur_exp_command_buffer_handle_t CommandBuffer; // Node created in graph for the command. @@ -89,10 +74,6 @@ struct ur_exp_command_buffer_command_handle_t_ { // Optional list of EventWait Nodes to wait on commands from outside of the // command-buffer. std::vector WaitNodes; - -private: - std::atomic_uint32_t RefCountInternal; - std::atomic_uint32_t RefCountExternal; }; struct kernel_command_handle : ur_exp_command_buffer_command_handle_t_ { @@ -340,25 +321,9 @@ struct ur_exp_command_buffer_handle_t_ { return SyncPoint; } - uint32_t incrementInternalReferenceCount() noexcept { - return ++RefCountInternal; - } - uint32_t decrementInternalReferenceCount() noexcept { - return --RefCountInternal; - } - uint32_t getInternalReferenceCount() const noexcept { - return RefCountInternal; - } - - uint32_t incrementExternalReferenceCount() noexcept { - return ++RefCountExternal; - } - uint32_t decrementExternalReferenceCount() noexcept { - return --RefCountExternal; - } - uint32_t getExternalReferenceCount() const noexcept { - return RefCountExternal; - } + uint32_t incrementReferenceCount() noexcept { return ++RefCount; } + uint32_t decrementReferenceCount() noexcept { return --RefCount; } + uint32_t getReferenceCount() const noexcept { return RefCount; } // UR context associated with this command-buffer ur_context_handle_t Context; @@ -372,8 +337,7 @@ struct ur_exp_command_buffer_handle_t_ { CUgraphExec CudaGraphExec = nullptr; // Atomic variable counting the number of reference to this command_buffer // using std::atomic prevents data race when incrementing/decrementing. - std::atomic_uint32_t RefCountInternal; - std::atomic_uint32_t RefCountExternal; + std::atomic_uint32_t RefCount; // Map of sync_points to ur_events std::unordered_map @@ -383,5 +347,6 @@ struct ur_exp_command_buffer_handle_t_ { ur_exp_command_buffer_sync_point_t NextSyncPoint; // Handles to individual commands in the command-buffer - std::vector CommandHandles; + std::vector> + CommandHandles; }; diff --git a/source/adapters/cuda/ur_interface_loader.cpp b/source/adapters/cuda/ur_interface_loader.cpp index b373570d38..d701c93d44 100644 --- a/source/adapters/cuda/ur_interface_loader.cpp +++ b/source/adapters/cuda/ur_interface_loader.cpp @@ -299,9 +299,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnEnqueueExp = urCommandBufferEnqueueExp; pDdiTable->pfnUpdateKernelLaunchExp = urCommandBufferUpdateKernelLaunchExp; pDdiTable->pfnGetInfoExp = urCommandBufferGetInfoExp; - pDdiTable->pfnCommandGetInfoExp = urCommandBufferCommandGetInfoExp; - pDdiTable->pfnReleaseCommandExp = urCommandBufferReleaseCommandExp; - pDdiTable->pfnRetainCommandExp = urCommandBufferRetainCommandExp; pDdiTable->pfnUpdateWaitEventsExp = urCommandBufferUpdateWaitEventsExp; pDdiTable->pfnUpdateSignalEventExp = urCommandBufferUpdateSignalEventExp; return retVal; diff --git a/source/adapters/hip/command_buffer.cpp b/source/adapters/hip/command_buffer.cpp index 8d22dc04a0..4c65e61dab 100644 --- a/source/adapters/hip/command_buffer.cpp +++ b/source/adapters/hip/command_buffer.cpp @@ -21,36 +21,10 @@ #include -namespace { -ur_result_t -commandBufferReleaseInternal(ur_exp_command_buffer_handle_t CommandBuffer) { - if (CommandBuffer->decrementInternalReferenceCount() != 0) { - return UR_RESULT_SUCCESS; - } - - delete CommandBuffer; - return UR_RESULT_SUCCESS; -} - -ur_result_t -commandHandleReleaseInternal(ur_exp_command_buffer_command_handle_t Command) { - if (Command->decrementInternalReferenceCount() != 0) { - return UR_RESULT_SUCCESS; - } - - // Decrement parent command-buffer internal ref count - commandBufferReleaseInternal(Command->CommandBuffer); - - delete Command; - return UR_RESULT_SUCCESS; -} -} // end anonymous namespace - ur_exp_command_buffer_handle_t_::ur_exp_command_buffer_handle_t_( ur_context_handle_t hContext, ur_device_handle_t hDevice, bool IsUpdatable) : Context(hContext), Device(hDevice), IsUpdatable(IsUpdatable), - HIPGraph{nullptr}, HIPGraphExec{nullptr}, RefCountInternal{1}, - RefCountExternal{1}, NextSyncPoint{0} { + HIPGraph{nullptr}, HIPGraphExec{nullptr}, RefCount{1}, NextSyncPoint{0} { urContextRetain(hContext); urDeviceRetain(hDevice); } @@ -81,9 +55,7 @@ ur_exp_command_buffer_command_handle_t_:: const size_t *LocalWorkSizePtr, uint32_t NumKernelAlternatives, ur_kernel_handle_t *KernelAlternatives) : CommandBuffer(CommandBuffer), Kernel(Kernel), Node(Node), Params(Params), - WorkDim(WorkDim), RefCountInternal(1), RefCountExternal(1) { - CommandBuffer->incrementInternalReferenceCount(); - + WorkDim(WorkDim) { const size_t CopySize = sizeof(size_t) * WorkDim; std::memcpy(GlobalWorkOffset, GlobalWorkOffsetPtr, CopySize); std::memcpy(GlobalWorkSize, GlobalWorkSizePtr, CopySize); @@ -284,22 +256,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCreateExp( UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferRetainExp(ur_exp_command_buffer_handle_t hCommandBuffer) { - hCommandBuffer->incrementInternalReferenceCount(); - hCommandBuffer->incrementExternalReferenceCount(); + hCommandBuffer->incrementReferenceCount(); return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferReleaseExp(ur_exp_command_buffer_handle_t hCommandBuffer) { - if (hCommandBuffer->decrementExternalReferenceCount() == 0) { - // External ref count has reached zero, internal release of created - // commands. - for (auto Command : hCommandBuffer->CommandHandles) { - commandHandleReleaseInternal(Command); - } + if (hCommandBuffer->decrementReferenceCount() == 0) { + delete hCommandBuffer; } - - return commandBufferReleaseInternal(hCommandBuffer); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL @@ -402,19 +368,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( *pSyncPoint = SyncPoint; } - auto NewCommand = new ur_exp_command_buffer_command_handle_t_{ - hCommandBuffer, hKernel, GraphNode, - NodeParams, workDim, pGlobalWorkOffset, - pGlobalWorkSize, pLocalWorkSize, numKernelAlternatives, - phKernelAlternatives}; - - NewCommand->incrementInternalReferenceCount(); - hCommandBuffer->CommandHandles.push_back(NewCommand); + auto NewCommand = std::make_unique( + hCommandBuffer, hKernel, GraphNode, NodeParams, workDim, + pGlobalWorkOffset, pGlobalWorkSize, pLocalWorkSize, + numKernelAlternatives, phKernelAlternatives); if (phCommand) { - *phCommand = NewCommand; + *phCommand = NewCommand.get(); } + hCommandBuffer->CommandHandles.push_back(std::move(NewCommand)); + } catch (ur_result_t Err) { return Err; } @@ -901,19 +865,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp( return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferRetainCommandExp( - ur_exp_command_buffer_command_handle_t hCommand) { - hCommand->incrementExternalReferenceCount(); - hCommand->incrementInternalReferenceCount(); - return UR_RESULT_SUCCESS; -} - -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferReleaseCommandExp( - ur_exp_command_buffer_command_handle_t hCommand) { - hCommand->decrementExternalReferenceCount(); - return commandHandleReleaseInternal(hCommand); -} - /** * Validates contents of the update command description. * @param[in] Command The command which is being updated. @@ -1133,7 +1084,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferGetInfoExp( switch (propName) { case UR_EXP_COMMAND_BUFFER_INFO_REFERENCE_COUNT: - return ReturnValue(hCommandBuffer->getExternalReferenceCount()); + return ReturnValue(hCommandBuffer->getReferenceCount()); case UR_EXP_COMMAND_BUFFER_INFO_DESCRIPTOR: { ur_exp_command_buffer_desc_t Descriptor{}; Descriptor.stype = UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC; @@ -1149,19 +1100,3 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferGetInfoExp( return UR_RESULT_ERROR_INVALID_ENUMERATION; } - -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCommandGetInfoExp( - ur_exp_command_buffer_command_handle_t hCommand, - ur_exp_command_buffer_command_info_t propName, size_t propSize, - void *pPropValue, size_t *pPropSizeRet) { - UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet); - - switch (propName) { - case UR_EXP_COMMAND_BUFFER_COMMAND_INFO_REFERENCE_COUNT: - return ReturnValue(hCommand->getExternalReferenceCount()); - default: - assert(!"Command-buffer command info request not implemented"); - } - - return UR_RESULT_ERROR_INVALID_ENUMERATION; -} diff --git a/source/adapters/hip/command_buffer.hpp b/source/adapters/hip/command_buffer.hpp index b59cb30c97..c5f9489767 100644 --- a/source/adapters/hip/command_buffer.hpp +++ b/source/adapters/hip/command_buffer.hpp @@ -83,23 +83,6 @@ struct ur_exp_command_buffer_command_handle_t_ { return 0 == std::memcmp(LocalWorkSize, Zeros, sizeof(LocalWorkSize)); } - uint32_t incrementInternalReferenceCount() noexcept { - return ++RefCountInternal; - } - uint32_t decrementInternalReferenceCount() noexcept { - return --RefCountInternal; - } - - uint32_t incrementExternalReferenceCount() noexcept { - return ++RefCountExternal; - } - uint32_t decrementExternalReferenceCount() noexcept { - return --RefCountExternal; - } - uint32_t getExternalReferenceCount() const noexcept { - return RefCountExternal; - } - ur_exp_command_buffer_handle_t CommandBuffer; // The currently active kernel handle for this command. @@ -115,10 +98,6 @@ struct ur_exp_command_buffer_command_handle_t_ { size_t GlobalWorkOffset[3]; size_t GlobalWorkSize[3]; size_t LocalWorkSize[3]; - -private: - std::atomic_uint32_t RefCountInternal; - std::atomic_uint32_t RefCountExternal; }; struct ur_exp_command_buffer_handle_t_ { @@ -146,25 +125,9 @@ struct ur_exp_command_buffer_handle_t_ { registerSyncPoint(SyncPoint, std::move(HIPNode)); return SyncPoint; } - uint32_t incrementInternalReferenceCount() noexcept { - return ++RefCountInternal; - } - uint32_t decrementInternalReferenceCount() noexcept { - return --RefCountInternal; - } - uint32_t getInternalReferenceCount() const noexcept { - return RefCountInternal; - } - - uint32_t incrementExternalReferenceCount() noexcept { - return ++RefCountExternal; - } - uint32_t decrementExternalReferenceCount() noexcept { - return --RefCountExternal; - } - uint32_t getExternalReferenceCount() const noexcept { - return RefCountExternal; - } + uint32_t incrementReferenceCount() noexcept { return ++RefCount; } + uint32_t decrementReferenceCount() noexcept { return --RefCount; } + uint32_t getReferenceCount() const noexcept { return RefCount; } // UR context associated with this command-buffer ur_context_handle_t Context; @@ -178,8 +141,7 @@ struct ur_exp_command_buffer_handle_t_ { hipGraphExec_t HIPGraphExec = nullptr; // Atomic variable counting the number of reference to this command_buffer // using std::atomic prevents data race when incrementing/decrementing. - std::atomic_uint32_t RefCountInternal; - std::atomic_uint32_t RefCountExternal; + std::atomic_uint32_t RefCount; // Map of sync_points to ur_events std::unordered_map @@ -189,5 +151,6 @@ struct ur_exp_command_buffer_handle_t_ { ur_exp_command_buffer_sync_point_t NextSyncPoint; // Handles to individual commands in the command-buffer - std::vector CommandHandles; + std::vector> + CommandHandles; }; diff --git a/source/adapters/hip/ur_interface_loader.cpp b/source/adapters/hip/ur_interface_loader.cpp index 413fa385d0..77e9aa3a40 100644 --- a/source/adapters/hip/ur_interface_loader.cpp +++ b/source/adapters/hip/ur_interface_loader.cpp @@ -296,9 +296,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendMemBufferFillExp = urCommandBufferAppendMemBufferFillExp; pDdiTable->pfnUpdateKernelLaunchExp = urCommandBufferUpdateKernelLaunchExp; pDdiTable->pfnGetInfoExp = urCommandBufferGetInfoExp; - pDdiTable->pfnCommandGetInfoExp = urCommandBufferCommandGetInfoExp; - pDdiTable->pfnReleaseCommandExp = urCommandBufferReleaseCommandExp; - pDdiTable->pfnRetainCommandExp = urCommandBufferRetainCommandExp; pDdiTable->pfnUpdateWaitEventsExp = urCommandBufferUpdateWaitEventsExp; pDdiTable->pfnUpdateSignalEventExp = urCommandBufferUpdateSignalEventExp; diff --git a/source/adapters/level_zero/command_buffer.cpp b/source/adapters/level_zero/command_buffer.cpp index 22c31ad8e0..879ee0f1cc 100644 --- a/source/adapters/level_zero/command_buffer.cpp +++ b/source/adapters/level_zero/command_buffer.cpp @@ -468,18 +468,6 @@ void ur_exp_command_buffer_handle_t_::cleanupCommandBufferResources() { } } -ur_exp_command_buffer_command_handle_t_:: - ur_exp_command_buffer_command_handle_t_( - ur_exp_command_buffer_handle_t CommandBuffer, uint64_t CommandId) - : CommandBuffer(CommandBuffer), CommandId(CommandId) { - ur::level_zero::urCommandBufferRetainExp(CommandBuffer); -} - -ur_exp_command_buffer_command_handle_t_:: - ~ur_exp_command_buffer_command_handle_t_() { - ur::level_zero::urCommandBufferReleaseExp(CommandBuffer); -} - void ur_exp_command_buffer_handle_t_::registerSyncPoint( ur_exp_command_buffer_sync_point_t SyncPoint, ur_event_handle_t Event) { SyncPoints[SyncPoint] = Event; @@ -932,7 +920,7 @@ createCommandHandle(ur_exp_command_buffer_handle_t CommandBuffer, ur_kernel_handle_t Kernel, uint32_t WorkDim, const size_t *LocalWorkSize, uint32_t NumKernelAlternatives, ur_kernel_handle_t *KernelAlternatives, - ur_exp_command_buffer_command_handle_t &Command) { + ur_exp_command_buffer_command_handle_t *Command) { assert(CommandBuffer->IsUpdatable); @@ -1000,9 +988,13 @@ createCommandHandle(ur_exp_command_buffer_handle_t CommandBuffer, DEBUG_LOG(CommandId); try { - Command = new kernel_command_handle( + auto NewCommand = std::make_unique( CommandBuffer, Kernel, CommandId, WorkDim, LocalWorkSize != nullptr, NumKernelAlternatives, KernelAlternatives); + + *Command = NewCommand.get(); + + CommandBuffer->CommandHandles.push_back(std::move(NewCommand)); } catch (const std::bad_alloc &) { return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; } catch (...) { @@ -1076,7 +1068,7 @@ ur_result_t urCommandBufferAppendKernelLaunchExp( if (Command) { UR_CALL(createCommandHandle(CommandBuffer, Kernel, WorkDim, LocalWorkSize, NumKernelAlternatives, KernelAlternatives, - *Command)); + Command)); } std::vector ZeEventList; ze_event_handle_t ZeLaunchEvent = nullptr; @@ -1769,21 +1761,6 @@ ur_result_t urCommandBufferEnqueueExp( return UR_RESULT_SUCCESS; } -ur_result_t urCommandBufferRetainCommandExp( - ur_exp_command_buffer_command_handle_t Command) { - Command->RefCount.increment(); - return UR_RESULT_SUCCESS; -} - -ur_result_t urCommandBufferReleaseCommandExp( - ur_exp_command_buffer_command_handle_t Command) { - if (!Command->RefCount.decrementAndTest()) - return UR_RESULT_SUCCESS; - - delete Command; - return UR_RESULT_SUCCESS; -} - /** * Validates contents of the update command description. * @param[in] Command The command which is being updated. @@ -2222,22 +2199,4 @@ urCommandBufferGetInfoExp(ur_exp_command_buffer_handle_t hCommandBuffer, return UR_RESULT_ERROR_INVALID_ENUMERATION; } - -ur_result_t -urCommandBufferCommandGetInfoExp(ur_exp_command_buffer_command_handle_t Command, - ur_exp_command_buffer_command_info_t PropName, - size_t PropSize, void *PropValue, - size_t *PropSizeRet) { - UrReturnHelper ReturnValue(PropSize, PropValue, PropSizeRet); - - switch (PropName) { - case UR_EXP_COMMAND_BUFFER_COMMAND_INFO_REFERENCE_COUNT: - return ReturnValue(uint32_t{Command->RefCount.load()}); - default: - assert(!"Command-buffer command info request not implemented"); - } - - return UR_RESULT_ERROR_INVALID_ENUMERATION; -} - } // namespace ur::level_zero diff --git a/source/adapters/level_zero/command_buffer.hpp b/source/adapters/level_zero/command_buffer.hpp index b6a3bb24a8..c9389eaf11 100644 --- a/source/adapters/level_zero/command_buffer.hpp +++ b/source/adapters/level_zero/command_buffer.hpp @@ -145,13 +145,17 @@ struct ur_exp_command_buffer_handle_t_ : public _ur_object { // Set this value to true when a command-buffer is enqueued, and false after // any fence or event synchronization to avoid repeated calls to synchronize. bool NeedsUpdateSynchronization = false; + // Track handle objects to free when command-buffer is destroyed. + std::vector> + CommandHandles; }; struct ur_exp_command_buffer_command_handle_t_ : public _ur_object { - ur_exp_command_buffer_command_handle_t_(ur_exp_command_buffer_handle_t, - uint64_t); + ur_exp_command_buffer_command_handle_t_( + ur_exp_command_buffer_handle_t CommandBuffer, uint64_t CommandId) + : CommandBuffer(CommandBuffer), CommandId(CommandId) {} - virtual ~ur_exp_command_buffer_command_handle_t_(); + virtual ~ur_exp_command_buffer_command_handle_t_() {} // Command-buffer of this command. ur_exp_command_buffer_handle_t CommandBuffer; diff --git a/source/adapters/level_zero/ur_interface_loader.cpp b/source/adapters/level_zero/ur_interface_loader.cpp index c938ff1f95..c237581016 100644 --- a/source/adapters/level_zero/ur_interface_loader.cpp +++ b/source/adapters/level_zero/ur_interface_loader.cpp @@ -128,10 +128,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendUSMAdviseExp = ur::level_zero::urCommandBufferAppendUSMAdviseExp; pDdiTable->pfnEnqueueExp = ur::level_zero::urCommandBufferEnqueueExp; - pDdiTable->pfnRetainCommandExp = - ur::level_zero::urCommandBufferRetainCommandExp; - pDdiTable->pfnReleaseCommandExp = - ur::level_zero::urCommandBufferReleaseCommandExp; pDdiTable->pfnUpdateKernelLaunchExp = ur::level_zero::urCommandBufferUpdateKernelLaunchExp; pDdiTable->pfnUpdateSignalEventExp = @@ -139,8 +135,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnUpdateWaitEventsExp = ur::level_zero::urCommandBufferUpdateWaitEventsExp; pDdiTable->pfnGetInfoExp = ur::level_zero::urCommandBufferGetInfoExp; - pDdiTable->pfnCommandGetInfoExp = - ur::level_zero::urCommandBufferCommandGetInfoExp; return result; } diff --git a/source/adapters/level_zero/ur_interface_loader.hpp b/source/adapters/level_zero/ur_interface_loader.hpp index 8620eeea81..8803b86b07 100644 --- a/source/adapters/level_zero/ur_interface_loader.hpp +++ b/source/adapters/level_zero/ur_interface_loader.hpp @@ -663,10 +663,6 @@ ur_result_t urCommandBufferEnqueueExp( ur_exp_command_buffer_handle_t hCommandBuffer, ur_queue_handle_t hQueue, uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent); -ur_result_t urCommandBufferRetainCommandExp( - ur_exp_command_buffer_command_handle_t hCommand); -ur_result_t urCommandBufferReleaseCommandExp( - ur_exp_command_buffer_command_handle_t hCommand); ur_result_t urCommandBufferUpdateKernelLaunchExp( ur_exp_command_buffer_command_handle_t hCommand, const ur_exp_command_buffer_update_kernel_launch_desc_t @@ -682,10 +678,6 @@ urCommandBufferGetInfoExp(ur_exp_command_buffer_handle_t hCommandBuffer, ur_exp_command_buffer_info_t propName, size_t propSize, void *pPropValue, size_t *pPropSizeRet); -ur_result_t urCommandBufferCommandGetInfoExp( - ur_exp_command_buffer_command_handle_t hCommand, - ur_exp_command_buffer_command_info_t propName, size_t propSize, - void *pPropValue, size_t *pPropSizeRet); ur_result_t urEnqueueCooperativeKernelLaunchExp( ur_queue_handle_t hQueue, ur_kernel_handle_t hKernel, uint32_t workDim, const size_t *pGlobalWorkOffset, const size_t *pGlobalWorkSize, diff --git a/source/adapters/level_zero/v2/api.cpp b/source/adapters/level_zero/v2/api.cpp index edd9687445..88fde2cfac 100644 --- a/source/adapters/level_zero/v2/api.cpp +++ b/source/adapters/level_zero/v2/api.cpp @@ -374,18 +374,6 @@ ur_result_t urCommandBufferAppendUSMAdviseExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t urCommandBufferRetainCommandExp( - ur_exp_command_buffer_command_handle_t hCommand) { - logger::error("{} function not implemented!", __FUNCTION__); - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ur_result_t urCommandBufferReleaseCommandExp( - ur_exp_command_buffer_command_handle_t hCommand) { - logger::error("{} function not implemented!", __FUNCTION__); - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - ur_result_t urCommandBufferUpdateKernelLaunchExp( ur_exp_command_buffer_command_handle_t hCommand, const ur_exp_command_buffer_update_kernel_launch_desc_t @@ -408,12 +396,4 @@ ur_result_t urCommandBufferUpdateWaitEventsExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t urCommandBufferCommandGetInfoExp( - ur_exp_command_buffer_command_handle_t hCommand, - ur_exp_command_buffer_command_info_t propName, size_t propSize, - void *pPropValue, size_t *pPropSizeRet) { - logger::error("{} function not implemented!", __FUNCTION__); - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - } // namespace ur::level_zero diff --git a/source/adapters/mock/ur_mockddi.cpp b/source/adapters/mock/ur_mockddi.cpp index bb73c1c172..c255dc0bcf 100644 --- a/source/adapters/mock/ur_mockddi.cpp +++ b/source/adapters/mock/ur_mockddi.cpp @@ -9809,98 +9809,6 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( return exceptionToResult(std::current_exception()); } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferRetainCommandExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferRetainCommandExp( - /// [in][retain] Handle of the command-buffer command. - ur_exp_command_buffer_command_handle_t hCommand) try { - ur_result_t result = UR_RESULT_SUCCESS; - - ur_command_buffer_retain_command_exp_params_t params = {&hCommand}; - - auto beforeCallback = reinterpret_cast( - mock::getCallbacks().get_before_callback( - "urCommandBufferRetainCommandExp")); - if (beforeCallback) { - result = beforeCallback(¶ms); - if (result != UR_RESULT_SUCCESS) { - return result; - } - } - - auto replaceCallback = reinterpret_cast( - mock::getCallbacks().get_replace_callback( - "urCommandBufferRetainCommandExp")); - if (replaceCallback) { - result = replaceCallback(¶ms); - } else { - - mock::retainDummyHandle(hCommand); - result = UR_RESULT_SUCCESS; - } - - if (result != UR_RESULT_SUCCESS) { - return result; - } - - auto afterCallback = reinterpret_cast( - mock::getCallbacks().get_after_callback( - "urCommandBufferRetainCommandExp")); - if (afterCallback) { - return afterCallback(¶ms); - } - - return result; -} catch (...) { - return exceptionToResult(std::current_exception()); -} - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferReleaseCommandExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseCommandExp( - /// [in][release] Handle of the command-buffer command. - ur_exp_command_buffer_command_handle_t hCommand) try { - ur_result_t result = UR_RESULT_SUCCESS; - - ur_command_buffer_release_command_exp_params_t params = {&hCommand}; - - auto beforeCallback = reinterpret_cast( - mock::getCallbacks().get_before_callback( - "urCommandBufferReleaseCommandExp")); - if (beforeCallback) { - result = beforeCallback(¶ms); - if (result != UR_RESULT_SUCCESS) { - return result; - } - } - - auto replaceCallback = reinterpret_cast( - mock::getCallbacks().get_replace_callback( - "urCommandBufferReleaseCommandExp")); - if (replaceCallback) { - result = replaceCallback(¶ms); - } else { - - mock::releaseDummyHandle(hCommand); - result = UR_RESULT_SUCCESS; - } - - if (result != UR_RESULT_SUCCESS) { - return result; - } - - auto afterCallback = reinterpret_cast( - mock::getCallbacks().get_after_callback( - "urCommandBufferReleaseCommandExp")); - if (afterCallback) { - return afterCallback(¶ms); - } - - return result; -} catch (...) { - return exceptionToResult(std::current_exception()); -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferUpdateKernelLaunchExp __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp( @@ -10103,61 +10011,6 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferGetInfoExp( return exceptionToResult(std::current_exception()); } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferCommandGetInfoExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferCommandGetInfoExp( - /// [in] handle of the command-buffer command object - ur_exp_command_buffer_command_handle_t hCommand, - /// [in] the name of the command-buffer command property to query - ur_exp_command_buffer_command_info_t propName, - /// [in] size in bytes of the command-buffer command property value - size_t propSize, - /// [out][optional][typename(propName, propSize)] value of the - /// command-buffer command property - void *pPropValue, - /// [out][optional] bytes returned in command-buffer command property - size_t *pPropSizeRet) try { - ur_result_t result = UR_RESULT_SUCCESS; - - ur_command_buffer_command_get_info_exp_params_t params = { - &hCommand, &propName, &propSize, &pPropValue, &pPropSizeRet}; - - auto beforeCallback = reinterpret_cast( - mock::getCallbacks().get_before_callback( - "urCommandBufferCommandGetInfoExp")); - if (beforeCallback) { - result = beforeCallback(¶ms); - if (result != UR_RESULT_SUCCESS) { - return result; - } - } - - auto replaceCallback = reinterpret_cast( - mock::getCallbacks().get_replace_callback( - "urCommandBufferCommandGetInfoExp")); - if (replaceCallback) { - result = replaceCallback(¶ms); - } else { - - result = UR_RESULT_SUCCESS; - } - - if (result != UR_RESULT_SUCCESS) { - return result; - } - - auto afterCallback = reinterpret_cast( - mock::getCallbacks().get_after_callback( - "urCommandBufferCommandGetInfoExp")); - if (afterCallback) { - return afterCallback(¶ms); - } - - return result; -} catch (...) { - return exceptionToResult(std::current_exception()); -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueCooperativeKernelLaunchExp __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( @@ -11195,10 +11048,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnEnqueueExp = driver::urCommandBufferEnqueueExp; - pDdiTable->pfnRetainCommandExp = driver::urCommandBufferRetainCommandExp; - - pDdiTable->pfnReleaseCommandExp = driver::urCommandBufferReleaseCommandExp; - pDdiTable->pfnUpdateKernelLaunchExp = driver::urCommandBufferUpdateKernelLaunchExp; @@ -11210,8 +11059,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnGetInfoExp = driver::urCommandBufferGetInfoExp; - pDdiTable->pfnCommandGetInfoExp = driver::urCommandBufferCommandGetInfoExp; - return result; } catch (...) { return exceptionToResult(std::current_exception()); diff --git a/source/adapters/native_cpu/command_buffer.cpp b/source/adapters/native_cpu/command_buffer.cpp index 91044771ec..b49974b3c0 100644 --- a/source/adapters/native_cpu/command_buffer.cpp +++ b/source/adapters/native_cpu/command_buffer.cpp @@ -175,16 +175,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferRetainCommandExp(ur_exp_command_buffer_command_handle_t) { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferReleaseCommandExp(ur_exp_command_buffer_command_handle_t) { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp( ur_exp_command_buffer_command_handle_t, const ur_exp_command_buffer_update_kernel_launch_desc_t *) { diff --git a/source/adapters/native_cpu/ur_interface_loader.cpp b/source/adapters/native_cpu/ur_interface_loader.cpp index 3fe3863bcd..d94380e405 100644 --- a/source/adapters/native_cpu/ur_interface_loader.cpp +++ b/source/adapters/native_cpu/ur_interface_loader.cpp @@ -289,9 +289,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnEnqueueExp = urCommandBufferEnqueueExp; pDdiTable->pfnUpdateKernelLaunchExp = urCommandBufferUpdateKernelLaunchExp; pDdiTable->pfnGetInfoExp = urCommandBufferGetInfoExp; - pDdiTable->pfnCommandGetInfoExp = urCommandBufferCommandGetInfoExp; - pDdiTable->pfnReleaseCommandExp = urCommandBufferReleaseCommandExp; - pDdiTable->pfnRetainCommandExp = urCommandBufferRetainCommandExp; pDdiTable->pfnUpdateWaitEventsExp = urCommandBufferUpdateWaitEventsExp; pDdiTable->pfnUpdateSignalEventExp = urCommandBufferUpdateSignalEventExp; diff --git a/source/adapters/opencl/command_buffer.cpp b/source/adapters/opencl/command_buffer.cpp index 5087e65f0b..d78ef0121b 100644 --- a/source/adapters/opencl/command_buffer.cpp +++ b/source/adapters/opencl/command_buffer.cpp @@ -11,31 +11,6 @@ #include "command_buffer.hpp" #include "common.hpp" -namespace { -ur_result_t -commandBufferReleaseInternal(ur_exp_command_buffer_handle_t CommandBuffer) { - if (CommandBuffer->decrementInternalReferenceCount() != 0) { - return UR_RESULT_SUCCESS; - } - - delete CommandBuffer; - return UR_RESULT_SUCCESS; -} - -ur_result_t -commandHandleReleaseInternal(ur_exp_command_buffer_command_handle_t Command) { - if (Command->decrementInternalReferenceCount() != 0) { - return UR_RESULT_SUCCESS; - } - - // Decrement parent command-buffer internal ref count - commandBufferReleaseInternal(Command->hCommandBuffer); - - delete Command; - return UR_RESULT_SUCCESS; -} -} // end anonymous namespace - /// The ur_exp_command_buffer_handle_t_ destructor calls CL release /// command-buffer to free the underlying object. ur_exp_command_buffer_handle_t_::~ur_exp_command_buffer_handle_t_() { @@ -104,22 +79,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCreateExp( UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferRetainExp(ur_exp_command_buffer_handle_t hCommandBuffer) { - hCommandBuffer->incrementInternalReferenceCount(); - hCommandBuffer->incrementExternalReferenceCount(); + hCommandBuffer->incrementReferenceCount(); return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferReleaseExp(ur_exp_command_buffer_handle_t hCommandBuffer) { - if (hCommandBuffer->decrementExternalReferenceCount() == 0) { - // External ref count has reached zero, internal release of created - // commands. - for (auto Command : hCommandBuffer->CommandHandles) { - commandHandleReleaseInternal(Command); - } + if (hCommandBuffer->decrementReferenceCount() == 0) { + delete hCommandBuffer; } - return commandBufferReleaseInternal(hCommandBuffer); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL @@ -185,15 +155,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( pSyncPointWaitList, pSyncPoint, OutCommandHandle)); try { - auto URCommandHandle = - std::make_unique( - hCommandBuffer, CommandHandle, hKernel, workDim, - pLocalWorkSize != nullptr); - ur_exp_command_buffer_command_handle_t Handle = URCommandHandle.release(); - hCommandBuffer->CommandHandles.push_back(Handle); + auto Handle = std::make_unique( + hCommandBuffer, CommandHandle, hKernel, workDim, + pLocalWorkSize != nullptr); if (phCommandHandle) { - *phCommandHandle = Handle; + *phCommandHandle = Handle.get(); } + + hCommandBuffer->CommandHandles.push_back(std::move(Handle)); } catch (...) { return UR_RESULT_ERROR_OUT_OF_RESOURCES; } @@ -469,19 +438,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp( return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferRetainCommandExp( - ur_exp_command_buffer_command_handle_t hCommand) { - hCommand->incrementExternalReferenceCount(); - hCommand->incrementInternalReferenceCount(); - return UR_RESULT_SUCCESS; -} - -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferReleaseCommandExp( - ur_exp_command_buffer_command_handle_t hCommand) { - hCommand->decrementExternalReferenceCount(); - return commandHandleReleaseInternal(hCommand); -} - namespace { void updateKernelPointerArgs( std::vector &CLUSMArgs, @@ -699,7 +655,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferGetInfoExp( switch (propName) { case UR_EXP_COMMAND_BUFFER_INFO_REFERENCE_COUNT: - return ReturnValue(hCommandBuffer->getExternalReferenceCount()); + return ReturnValue(hCommandBuffer->getReferenceCount()); case UR_EXP_COMMAND_BUFFER_INFO_DESCRIPTOR: { ur_exp_command_buffer_desc_t Descriptor{}; Descriptor.stype = UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC; @@ -716,19 +672,3 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferGetInfoExp( return UR_RESULT_ERROR_INVALID_ENUMERATION; } - -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCommandGetInfoExp( - ur_exp_command_buffer_command_handle_t hCommand, - ur_exp_command_buffer_command_info_t propName, size_t propSize, - void *pPropValue, size_t *pPropSizeRet) { - UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet); - - switch (propName) { - case UR_EXP_COMMAND_BUFFER_COMMAND_INFO_REFERENCE_COUNT: - return ReturnValue(hCommand->getExternalReferenceCount()); - default: - assert(!"Command-buffer command info request not implemented"); - } - - return UR_RESULT_ERROR_INVALID_ENUMERATION; -} diff --git a/source/adapters/opencl/command_buffer.hpp b/source/adapters/opencl/command_buffer.hpp index 6873edec51..83fedc3c1e 100644 --- a/source/adapters/opencl/command_buffer.hpp +++ b/source/adapters/opencl/command_buffer.hpp @@ -23,13 +23,6 @@ struct ur_exp_command_buffer_command_handle_t_ { cl_uint WorkDim; /// Set to true if the user set the local work size on command creation. bool UserDefinedLocalSize; - /// Internal & External reference counts. - /// We need to maintain these because in OpenCL a command-handle isn't - /// reference counting, but is tied to the lifetime of the parent - /// command-buffer. This is not the case in UR where a command-handle is - /// reference counted. - std::atomic_uint32_t RefCountInternal; - std::atomic_uint32_t RefCountExternal; ur_exp_command_buffer_command_handle_t_( ur_exp_command_buffer_handle_t hCommandBuffer, @@ -37,25 +30,7 @@ struct ur_exp_command_buffer_command_handle_t_ { cl_uint WorkDim, bool UserDefinedLocalSize) : hCommandBuffer(hCommandBuffer), CLMutableCommand(CLMutableCommand), Kernel(Kernel), WorkDim(WorkDim), - UserDefinedLocalSize(UserDefinedLocalSize), RefCountInternal(0), - RefCountExternal(0) {} - - uint32_t incrementInternalReferenceCount() noexcept { - return ++RefCountInternal; - } - uint32_t decrementInternalReferenceCount() noexcept { - return --RefCountInternal; - } - - uint32_t incrementExternalReferenceCount() noexcept { - return ++RefCountExternal; - } - uint32_t decrementExternalReferenceCount() noexcept { - return --RefCountExternal; - } - uint32_t getExternalReferenceCount() const noexcept { - return RefCountExternal; - } + UserDefinedLocalSize(UserDefinedLocalSize) {} }; /// Handle to a command-buffer object. @@ -74,14 +49,10 @@ struct ur_exp_command_buffer_handle_t_ { /// Set to true if the command-buffer has been finalized, false otherwise bool IsFinalized; /// List of commands in the command-buffer. - std::vector CommandHandles; - /// Internal & External reference counts of the command-buffer. We do this - /// manually rather than forward to the OpenCL retain/release APIs because - /// we also need to track the lifetimes of command handle objects, which - /// extended the lifetime of a UR command-buffer even if its reference - /// count is zero. - std::atomic_uint32_t RefCountInternal; - std::atomic_uint32_t RefCountExternal; + std::vector> + CommandHandles; + /// Object reference count + std::atomic_uint32_t RefCount; ur_exp_command_buffer_handle_t_(ur_queue_handle_t hQueue, ur_context_handle_t hContext, @@ -90,24 +61,11 @@ struct ur_exp_command_buffer_handle_t_ { bool IsUpdatable) : hInternalQueue(hQueue), hContext(hContext), hDevice(hDevice), CLCommandBuffer(CLCommandBuffer), IsUpdatable(IsUpdatable), - IsFinalized(false), RefCountInternal(0), RefCountExternal(0) {} + IsFinalized(false), RefCount(0) {} ~ur_exp_command_buffer_handle_t_(); - uint32_t incrementInternalReferenceCount() noexcept { - return ++RefCountInternal; - } - uint32_t decrementInternalReferenceCount() noexcept { - return --RefCountInternal; - } - - uint32_t incrementExternalReferenceCount() noexcept { - return ++RefCountExternal; - } - uint32_t decrementExternalReferenceCount() noexcept { - return --RefCountExternal; - } - uint32_t getExternalReferenceCount() const noexcept { - return RefCountExternal; - } + uint32_t incrementReferenceCount() noexcept { return ++RefCount; } + uint32_t decrementReferenceCount() noexcept { return --RefCount; } + uint32_t getReferenceCount() const noexcept { return RefCount; } }; diff --git a/source/adapters/opencl/ur_interface_loader.cpp b/source/adapters/opencl/ur_interface_loader.cpp index a80c5bcca1..44ba406e00 100644 --- a/source/adapters/opencl/ur_interface_loader.cpp +++ b/source/adapters/opencl/ur_interface_loader.cpp @@ -308,9 +308,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnEnqueueExp = urCommandBufferEnqueueExp; pDdiTable->pfnUpdateKernelLaunchExp = urCommandBufferUpdateKernelLaunchExp; pDdiTable->pfnGetInfoExp = urCommandBufferGetInfoExp; - pDdiTable->pfnCommandGetInfoExp = urCommandBufferCommandGetInfoExp; - pDdiTable->pfnReleaseCommandExp = urCommandBufferReleaseCommandExp; - pDdiTable->pfnRetainCommandExp = urCommandBufferRetainCommandExp; pDdiTable->pfnUpdateWaitEventsExp = urCommandBufferUpdateWaitEventsExp; pDdiTable->pfnUpdateSignalEventExp = urCommandBufferUpdateSignalEventExp; diff --git a/source/loader/layers/sanitizer/asan/asan_ddi.cpp b/source/loader/layers/sanitizer/asan/asan_ddi.cpp index f6b2227558..c11e6a77b1 100644 --- a/source/loader/layers/sanitizer/asan/asan_ddi.cpp +++ b/source/loader/layers/sanitizer/asan/asan_ddi.cpp @@ -1986,7 +1986,6 @@ __urdlllocal ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( FuncPtr = CommandBufferNotSupported::ReportError; \ } while (0) - SET_UNSUPPORTED(pDdiTable->pfnCreateExp); SET_UNSUPPORTED(pDdiTable->pfnRetainExp); SET_UNSUPPORTED(pDdiTable->pfnReleaseExp); SET_UNSUPPORTED(pDdiTable->pfnFinalizeExp); @@ -2002,13 +2001,10 @@ __urdlllocal ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( SET_UNSUPPORTED(pDdiTable->pfnAppendUSMPrefetchExp); SET_UNSUPPORTED(pDdiTable->pfnAppendUSMAdviseExp); SET_UNSUPPORTED(pDdiTable->pfnEnqueueExp); - SET_UNSUPPORTED(pDdiTable->pfnRetainCommandExp); - SET_UNSUPPORTED(pDdiTable->pfnReleaseCommandExp); SET_UNSUPPORTED(pDdiTable->pfnUpdateKernelLaunchExp); SET_UNSUPPORTED(pDdiTable->pfnUpdateSignalEventExp); SET_UNSUPPORTED(pDdiTable->pfnUpdateWaitEventsExp); SET_UNSUPPORTED(pDdiTable->pfnGetInfoExp); - SET_UNSUPPORTED(pDdiTable->pfnCommandGetInfoExp); #undef SET_UNSUPPORTED diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index 561b12e983..f53e7c1c4d 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -8178,78 +8178,6 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( return result; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferRetainCommandExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferRetainCommandExp( - /// [in][retain] Handle of the command-buffer command. - ur_exp_command_buffer_command_handle_t hCommand) { - auto pfnRetainCommandExp = - getContext()->urDdiTable.CommandBufferExp.pfnRetainCommandExp; - - if (nullptr == pfnRetainCommandExp) - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; - - ur_command_buffer_retain_command_exp_params_t params = {&hCommand}; - uint64_t instance = - getContext()->notify_begin(UR_FUNCTION_COMMAND_BUFFER_RETAIN_COMMAND_EXP, - "urCommandBufferRetainCommandExp", ¶ms); - - auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferRetainCommandExp\n"); - - ur_result_t result = pfnRetainCommandExp(hCommand); - - getContext()->notify_end(UR_FUNCTION_COMMAND_BUFFER_RETAIN_COMMAND_EXP, - "urCommandBufferRetainCommandExp", ¶ms, &result, - instance); - - if (logger.getLevel() <= logger::Level::INFO) { - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_RETAIN_COMMAND_EXP, ¶ms); - logger.info(" <--- urCommandBufferRetainCommandExp({}) -> {};\n", - args_str.str(), result); - } - - return result; -} - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferReleaseCommandExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseCommandExp( - /// [in][release] Handle of the command-buffer command. - ur_exp_command_buffer_command_handle_t hCommand) { - auto pfnReleaseCommandExp = - getContext()->urDdiTable.CommandBufferExp.pfnReleaseCommandExp; - - if (nullptr == pfnReleaseCommandExp) - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; - - ur_command_buffer_release_command_exp_params_t params = {&hCommand}; - uint64_t instance = - getContext()->notify_begin(UR_FUNCTION_COMMAND_BUFFER_RELEASE_COMMAND_EXP, - "urCommandBufferReleaseCommandExp", ¶ms); - - auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferReleaseCommandExp\n"); - - ur_result_t result = pfnReleaseCommandExp(hCommand); - - getContext()->notify_end(UR_FUNCTION_COMMAND_BUFFER_RELEASE_COMMAND_EXP, - "urCommandBufferReleaseCommandExp", ¶ms, &result, - instance); - - if (logger.getLevel() <= logger::Level::INFO) { - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_RELEASE_COMMAND_EXP, ¶ms); - logger.info(" <--- urCommandBufferReleaseCommandExp({}) -> {};\n", - args_str.str(), result); - } - - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferUpdateKernelLaunchExp __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp( @@ -8419,53 +8347,6 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferGetInfoExp( return result; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferCommandGetInfoExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferCommandGetInfoExp( - /// [in] handle of the command-buffer command object - ur_exp_command_buffer_command_handle_t hCommand, - /// [in] the name of the command-buffer command property to query - ur_exp_command_buffer_command_info_t propName, - /// [in] size in bytes of the command-buffer command property value - size_t propSize, - /// [out][optional][typename(propName, propSize)] value of the - /// command-buffer command property - void *pPropValue, - /// [out][optional] bytes returned in command-buffer command property - size_t *pPropSizeRet) { - auto pfnCommandGetInfoExp = - getContext()->urDdiTable.CommandBufferExp.pfnCommandGetInfoExp; - - if (nullptr == pfnCommandGetInfoExp) - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; - - ur_command_buffer_command_get_info_exp_params_t params = { - &hCommand, &propName, &propSize, &pPropValue, &pPropSizeRet}; - uint64_t instance = getContext()->notify_begin( - UR_FUNCTION_COMMAND_BUFFER_COMMAND_GET_INFO_EXP, - "urCommandBufferCommandGetInfoExp", ¶ms); - - auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferCommandGetInfoExp\n"); - - ur_result_t result = pfnCommandGetInfoExp(hCommand, propName, propSize, - pPropValue, pPropSizeRet); - - getContext()->notify_end(UR_FUNCTION_COMMAND_BUFFER_COMMAND_GET_INFO_EXP, - "urCommandBufferCommandGetInfoExp", ¶ms, &result, - instance); - - if (logger.getLevel() <= logger::Level::INFO) { - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_COMMAND_GET_INFO_EXP, ¶ms); - logger.info(" <--- urCommandBufferCommandGetInfoExp({}) -> {};\n", - args_str.str(), result); - } - - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueCooperativeKernelLaunchExp __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( @@ -9440,14 +9321,6 @@ __urdlllocal ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( dditable.pfnEnqueueExp = pDdiTable->pfnEnqueueExp; pDdiTable->pfnEnqueueExp = ur_tracing_layer::urCommandBufferEnqueueExp; - dditable.pfnRetainCommandExp = pDdiTable->pfnRetainCommandExp; - pDdiTable->pfnRetainCommandExp = - ur_tracing_layer::urCommandBufferRetainCommandExp; - - dditable.pfnReleaseCommandExp = pDdiTable->pfnReleaseCommandExp; - pDdiTable->pfnReleaseCommandExp = - ur_tracing_layer::urCommandBufferReleaseCommandExp; - dditable.pfnUpdateKernelLaunchExp = pDdiTable->pfnUpdateKernelLaunchExp; pDdiTable->pfnUpdateKernelLaunchExp = ur_tracing_layer::urCommandBufferUpdateKernelLaunchExp; @@ -9463,10 +9336,6 @@ __urdlllocal ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( dditable.pfnGetInfoExp = pDdiTable->pfnGetInfoExp; pDdiTable->pfnGetInfoExp = ur_tracing_layer::urCommandBufferGetInfoExp; - dditable.pfnCommandGetInfoExp = pDdiTable->pfnCommandGetInfoExp; - pDdiTable->pfnCommandGetInfoExp = - ur_tracing_layer::urCommandBufferCommandGetInfoExp; - return result; } /////////////////////////////////////////////////////////////////////////////// diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index dbfd282b8a..60d3d66ef6 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -8830,50 +8830,6 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( return result; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferRetainCommandExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferRetainCommandExp( - /// [in][retain] Handle of the command-buffer command. - ur_exp_command_buffer_command_handle_t hCommand) { - auto pfnRetainCommandExp = - getContext()->urDdiTable.CommandBufferExp.pfnRetainCommandExp; - - if (nullptr == pfnRetainCommandExp) { - return UR_RESULT_ERROR_UNINITIALIZED; - } - - if (getContext()->enableParameterValidation) { - if (NULL == hCommand) - return UR_RESULT_ERROR_INVALID_NULL_HANDLE; - } - - ur_result_t result = pfnRetainCommandExp(hCommand); - - return result; -} - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferReleaseCommandExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseCommandExp( - /// [in][release] Handle of the command-buffer command. - ur_exp_command_buffer_command_handle_t hCommand) { - auto pfnReleaseCommandExp = - getContext()->urDdiTable.CommandBufferExp.pfnReleaseCommandExp; - - if (nullptr == pfnReleaseCommandExp) { - return UR_RESULT_ERROR_UNINITIALIZED; - } - - if (getContext()->enableParameterValidation) { - if (NULL == hCommand) - return UR_RESULT_ERROR_INVALID_NULL_HANDLE; - } - - ur_result_t result = pfnReleaseCommandExp(hCommand); - - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferUpdateKernelLaunchExp __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp( @@ -9019,50 +8975,6 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferGetInfoExp( return result; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferCommandGetInfoExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferCommandGetInfoExp( - /// [in] handle of the command-buffer command object - ur_exp_command_buffer_command_handle_t hCommand, - /// [in] the name of the command-buffer command property to query - ur_exp_command_buffer_command_info_t propName, - /// [in] size in bytes of the command-buffer command property value - size_t propSize, - /// [out][optional][typename(propName, propSize)] value of the - /// command-buffer command property - void *pPropValue, - /// [out][optional] bytes returned in command-buffer command property - size_t *pPropSizeRet) { - auto pfnCommandGetInfoExp = - getContext()->urDdiTable.CommandBufferExp.pfnCommandGetInfoExp; - - if (nullptr == pfnCommandGetInfoExp) { - return UR_RESULT_ERROR_UNINITIALIZED; - } - - if (getContext()->enableParameterValidation) { - if (NULL == hCommand) - return UR_RESULT_ERROR_INVALID_NULL_HANDLE; - - if (propSize != 0 && pPropValue == NULL) - return UR_RESULT_ERROR_INVALID_NULL_POINTER; - - if (pPropValue == NULL && pPropSizeRet == NULL) - return UR_RESULT_ERROR_INVALID_NULL_POINTER; - - if (UR_EXP_COMMAND_BUFFER_COMMAND_INFO_REFERENCE_COUNT < propName) - return UR_RESULT_ERROR_INVALID_ENUMERATION; - - if (propSize == 0 && pPropValue != NULL) - return UR_RESULT_ERROR_INVALID_SIZE; - } - - ur_result_t result = pfnCommandGetInfoExp(hCommand, propName, propSize, - pPropValue, pPropSizeRet); - - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueCooperativeKernelLaunchExp __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( @@ -10062,14 +9974,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( dditable.pfnEnqueueExp = pDdiTable->pfnEnqueueExp; pDdiTable->pfnEnqueueExp = ur_validation_layer::urCommandBufferEnqueueExp; - dditable.pfnRetainCommandExp = pDdiTable->pfnRetainCommandExp; - pDdiTable->pfnRetainCommandExp = - ur_validation_layer::urCommandBufferRetainCommandExp; - - dditable.pfnReleaseCommandExp = pDdiTable->pfnReleaseCommandExp; - pDdiTable->pfnReleaseCommandExp = - ur_validation_layer::urCommandBufferReleaseCommandExp; - dditable.pfnUpdateKernelLaunchExp = pDdiTable->pfnUpdateKernelLaunchExp; pDdiTable->pfnUpdateKernelLaunchExp = ur_validation_layer::urCommandBufferUpdateKernelLaunchExp; @@ -10085,10 +9989,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( dditable.pfnGetInfoExp = pDdiTable->pfnGetInfoExp; pDdiTable->pfnGetInfoExp = ur_validation_layer::urCommandBufferGetInfoExp; - dditable.pfnCommandGetInfoExp = pDdiTable->pfnCommandGetInfoExp; - pDdiTable->pfnCommandGetInfoExp = - ur_validation_layer::urCommandBufferCommandGetInfoExp; - return result; } diff --git a/source/loader/loader.def.in b/source/loader/loader.def.in index e7b6b5993d..1425c602d6 100644 --- a/source/loader/loader.def.in +++ b/source/loader/loader.def.in @@ -35,14 +35,11 @@ EXPORTS urCommandBufferAppendUSMFillExp urCommandBufferAppendUSMMemcpyExp urCommandBufferAppendUSMPrefetchExp - urCommandBufferCommandGetInfoExp urCommandBufferCreateExp urCommandBufferEnqueueExp urCommandBufferFinalizeExp urCommandBufferGetInfoExp - urCommandBufferReleaseCommandExp urCommandBufferReleaseExp - urCommandBufferRetainCommandExp urCommandBufferRetainExp urCommandBufferUpdateKernelLaunchExp urCommandBufferUpdateSignalEventExp @@ -216,14 +213,11 @@ EXPORTS urPrintCommandBufferAppendUsmFillExpParams urPrintCommandBufferAppendUsmMemcpyExpParams urPrintCommandBufferAppendUsmPrefetchExpParams - urPrintCommandBufferCommandGetInfoExpParams urPrintCommandBufferCreateExpParams urPrintCommandBufferEnqueueExpParams urPrintCommandBufferFinalizeExpParams urPrintCommandBufferGetInfoExpParams - urPrintCommandBufferReleaseCommandExpParams urPrintCommandBufferReleaseExpParams - urPrintCommandBufferRetainCommandExpParams urPrintCommandBufferRetainExpParams urPrintCommandBufferUpdateKernelLaunchExpParams urPrintCommandBufferUpdateSignalEventExpParams diff --git a/source/loader/loader.map.in b/source/loader/loader.map.in index e9017e01cf..ebb413c985 100644 --- a/source/loader/loader.map.in +++ b/source/loader/loader.map.in @@ -35,14 +35,11 @@ urCommandBufferAppendUSMFillExp; urCommandBufferAppendUSMMemcpyExp; urCommandBufferAppendUSMPrefetchExp; - urCommandBufferCommandGetInfoExp; urCommandBufferCreateExp; urCommandBufferEnqueueExp; urCommandBufferFinalizeExp; urCommandBufferGetInfoExp; - urCommandBufferReleaseCommandExp; urCommandBufferReleaseExp; - urCommandBufferRetainCommandExp; urCommandBufferRetainExp; urCommandBufferUpdateKernelLaunchExp; urCommandBufferUpdateSignalEventExp; @@ -216,14 +213,11 @@ urPrintCommandBufferAppendUsmFillExpParams; urPrintCommandBufferAppendUsmMemcpyExpParams; urPrintCommandBufferAppendUsmPrefetchExpParams; - urPrintCommandBufferCommandGetInfoExpParams; urPrintCommandBufferCreateExpParams; urPrintCommandBufferEnqueueExpParams; urPrintCommandBufferFinalizeExpParams; urPrintCommandBufferGetInfoExpParams; - urPrintCommandBufferReleaseCommandExpParams; urPrintCommandBufferReleaseExpParams; - urPrintCommandBufferRetainCommandExpParams; urPrintCommandBufferRetainExpParams; urPrintCommandBufferUpdateKernelLaunchExpParams; urPrintCommandBufferUpdateSignalEventExpParams; diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 450f5f9364..fc8585f9e4 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -8372,69 +8372,6 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( return result; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferRetainCommandExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferRetainCommandExp( - /// [in][retain] Handle of the command-buffer command. - ur_exp_command_buffer_command_handle_t hCommand) { - ur_result_t result = UR_RESULT_SUCCESS; - - [[maybe_unused]] auto context = getContext(); - - // extract platform's function pointer table - auto dditable = - reinterpret_cast(hCommand) - ->dditable; - auto pfnRetainCommandExp = dditable->ur.CommandBufferExp.pfnRetainCommandExp; - if (nullptr == pfnRetainCommandExp) - return UR_RESULT_ERROR_UNINITIALIZED; - - // convert loader handle to platform handle - hCommand = - reinterpret_cast(hCommand) - ->handle; - - // forward to device-platform - result = pfnRetainCommandExp(hCommand); - - // increment refcount of handle - context->factories.ur_exp_command_buffer_command_factory.retain(hCommand); - - return result; -} - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferReleaseCommandExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseCommandExp( - /// [in][release] Handle of the command-buffer command. - ur_exp_command_buffer_command_handle_t hCommand) { - ur_result_t result = UR_RESULT_SUCCESS; - - [[maybe_unused]] auto context = getContext(); - - // extract platform's function pointer table - auto dditable = - reinterpret_cast(hCommand) - ->dditable; - auto pfnReleaseCommandExp = - dditable->ur.CommandBufferExp.pfnReleaseCommandExp; - if (nullptr == pfnReleaseCommandExp) - return UR_RESULT_ERROR_UNINITIALIZED; - - // convert loader handle to platform handle - hCommand = - reinterpret_cast(hCommand) - ->handle; - - // forward to device-platform - result = pfnReleaseCommandExp(hCommand); - - // release loader handle - context->factories.ur_exp_command_buffer_command_factory.release(hCommand); - - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferUpdateKernelLaunchExp __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp( @@ -8619,45 +8556,6 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferGetInfoExp( return result; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferCommandGetInfoExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferCommandGetInfoExp( - /// [in] handle of the command-buffer command object - ur_exp_command_buffer_command_handle_t hCommand, - /// [in] the name of the command-buffer command property to query - ur_exp_command_buffer_command_info_t propName, - /// [in] size in bytes of the command-buffer command property value - size_t propSize, - /// [out][optional][typename(propName, propSize)] value of the - /// command-buffer command property - void *pPropValue, - /// [out][optional] bytes returned in command-buffer command property - size_t *pPropSizeRet) { - ur_result_t result = UR_RESULT_SUCCESS; - - [[maybe_unused]] auto context = getContext(); - - // extract platform's function pointer table - auto dditable = - reinterpret_cast(hCommand) - ->dditable; - auto pfnCommandGetInfoExp = - dditable->ur.CommandBufferExp.pfnCommandGetInfoExp; - if (nullptr == pfnCommandGetInfoExp) - return UR_RESULT_ERROR_UNINITIALIZED; - - // convert loader handle to platform handle - hCommand = - reinterpret_cast(hCommand) - ->handle; - - // forward to device-platform - result = pfnCommandGetInfoExp(hCommand, propName, propSize, pPropValue, - pPropSizeRet); - - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueCooperativeKernelLaunchExp __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( @@ -9585,10 +9483,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendUSMAdviseExp = ur_loader::urCommandBufferAppendUSMAdviseExp; pDdiTable->pfnEnqueueExp = ur_loader::urCommandBufferEnqueueExp; - pDdiTable->pfnRetainCommandExp = - ur_loader::urCommandBufferRetainCommandExp; - pDdiTable->pfnReleaseCommandExp = - ur_loader::urCommandBufferReleaseCommandExp; pDdiTable->pfnUpdateKernelLaunchExp = ur_loader::urCommandBufferUpdateKernelLaunchExp; pDdiTable->pfnUpdateSignalEventExp = @@ -9596,8 +9490,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnUpdateWaitEventsExp = ur_loader::urCommandBufferUpdateWaitEventsExp; pDdiTable->pfnGetInfoExp = ur_loader::urCommandBufferGetInfoExp; - pDdiTable->pfnCommandGetInfoExp = - ur_loader::urCommandBufferCommandGetInfoExp; } else { // return pointers directly to platform's DDIs *pDdiTable = ur_loader::getContext() diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 031b4f3989..8d4e9f4911 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -8740,59 +8740,6 @@ ur_result_t UR_APICALL urCommandBufferEnqueueExp( return exceptionToResult(std::current_exception()); } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Increment the command object's reference count. -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_DEVICE_LOST -/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `NULL == hCommand` -/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -ur_result_t UR_APICALL urCommandBufferRetainCommandExp( - /// [in][retain] Handle of the command-buffer command. - ur_exp_command_buffer_command_handle_t hCommand) try { - auto pfnRetainCommandExp = - ur_lib::getContext()->urDdiTable.CommandBufferExp.pfnRetainCommandExp; - if (nullptr == pfnRetainCommandExp) - return UR_RESULT_ERROR_UNINITIALIZED; - - return pfnRetainCommandExp(hCommand); -} catch (...) { - return exceptionToResult(std::current_exception()); -} - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Decrement the command object's reference count and delete the command -/// object if the reference count becomes zero. -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_DEVICE_LOST -/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `NULL == hCommand` -/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -ur_result_t UR_APICALL urCommandBufferReleaseCommandExp( - /// [in][release] Handle of the command-buffer command. - ur_exp_command_buffer_command_handle_t hCommand) try { - auto pfnReleaseCommandExp = - ur_lib::getContext()->urDdiTable.CommandBufferExp.pfnReleaseCommandExp; - if (nullptr == pfnReleaseCommandExp) - return UR_RESULT_ERROR_UNINITIALIZED; - - return pfnReleaseCommandExp(hCommand); -} catch (...) { - return exceptionToResult(std::current_exception()); -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Update a kernel launch command in a finalized command-buffer. /// @@ -9019,53 +8966,6 @@ ur_result_t UR_APICALL urCommandBufferGetInfoExp( return exceptionToResult(std::current_exception()); } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get command-buffer object information. -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_DEVICE_LOST -/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `NULL == hCommand` -/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_EXP_COMMAND_BUFFER_COMMAND_INFO_REFERENCE_COUNT < propName` -/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION -/// + If `propName` is not supported by the adapter. -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// + `propSize == 0 && pPropValue != NULL` -/// + If `propSize` is less than the real number of bytes needed to -/// return the info. -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `propSize != 0 && pPropValue == NULL` -/// + `pPropValue == NULL && pPropSizeRet == NULL` -/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -ur_result_t UR_APICALL urCommandBufferCommandGetInfoExp( - /// [in] handle of the command-buffer command object - ur_exp_command_buffer_command_handle_t hCommand, - /// [in] the name of the command-buffer command property to query - ur_exp_command_buffer_command_info_t propName, - /// [in] size in bytes of the command-buffer command property value - size_t propSize, - /// [out][optional][typename(propName, propSize)] value of the - /// command-buffer command property - void *pPropValue, - /// [out][optional] bytes returned in command-buffer command property - size_t *pPropSizeRet) try { - auto pfnCommandGetInfoExp = - ur_lib::getContext()->urDdiTable.CommandBufferExp.pfnCommandGetInfoExp; - if (nullptr == pfnCommandGetInfoExp) - return UR_RESULT_ERROR_UNINITIALIZED; - - return pfnCommandGetInfoExp(hCommand, propName, propSize, pPropValue, - pPropSizeRet); -} catch (...) { - return exceptionToResult(std::current_exception()); -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Enqueue a command to execute a cooperative kernel /// diff --git a/source/loader/ur_print.cpp b/source/loader/ur_print.cpp index 824a6a161a..d75272a1ae 100644 --- a/source/loader/ur_print.cpp +++ b/source/loader/ur_print.cpp @@ -1454,22 +1454,6 @@ ur_result_t urPrintCommandBufferEnqueueExpParams( return str_copy(&ss, buffer, buff_size, out_size); } -ur_result_t urPrintCommandBufferRetainCommandExpParams( - const struct ur_command_buffer_retain_command_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 urPrintCommandBufferReleaseCommandExpParams( - const struct ur_command_buffer_release_command_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 urPrintCommandBufferUpdateKernelLaunchExpParams( const struct ur_command_buffer_update_kernel_launch_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size) { @@ -1502,14 +1486,6 @@ ur_result_t urPrintCommandBufferGetInfoExpParams( return str_copy(&ss, buffer, buff_size, out_size); } -ur_result_t urPrintCommandBufferCommandGetInfoExpParams( - const struct ur_command_buffer_command_get_info_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 urPrintContextCreateParams(const struct ur_context_create_params_t *params, char *buffer, const size_t buff_size, diff --git a/source/ur_api.cpp b/source/ur_api.cpp index b9d0c3c390..340a01944c 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -7634,47 +7634,6 @@ ur_result_t UR_APICALL urCommandBufferEnqueueExp( return result; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Increment the command object's reference count. -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_DEVICE_LOST -/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `NULL == hCommand` -/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -ur_result_t UR_APICALL urCommandBufferRetainCommandExp( - /// [in][retain] Handle of the command-buffer command. - ur_exp_command_buffer_command_handle_t hCommand) { - ur_result_t result = UR_RESULT_SUCCESS; - return result; -} - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Decrement the command object's reference count and delete the command -/// object if the reference count becomes zero. -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_DEVICE_LOST -/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `NULL == hCommand` -/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -ur_result_t UR_APICALL urCommandBufferReleaseCommandExp( - /// [in][release] Handle of the command-buffer command. - ur_exp_command_buffer_command_handle_t hCommand) { - ur_result_t result = UR_RESULT_SUCCESS; - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Update a kernel launch command in a finalized command-buffer. /// @@ -7875,46 +7834,6 @@ ur_result_t UR_APICALL urCommandBufferGetInfoExp( return result; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get command-buffer object information. -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_DEVICE_LOST -/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `NULL == hCommand` -/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_EXP_COMMAND_BUFFER_COMMAND_INFO_REFERENCE_COUNT < propName` -/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION -/// + If `propName` is not supported by the adapter. -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// + `propSize == 0 && pPropValue != NULL` -/// + If `propSize` is less than the real number of bytes needed to -/// return the info. -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `propSize != 0 && pPropValue == NULL` -/// + `pPropValue == NULL && pPropSizeRet == NULL` -/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP -/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -ur_result_t UR_APICALL urCommandBufferCommandGetInfoExp( - /// [in] handle of the command-buffer command object - ur_exp_command_buffer_command_handle_t hCommand, - /// [in] the name of the command-buffer command property to query - ur_exp_command_buffer_command_info_t propName, - /// [in] size in bytes of the command-buffer command property value - size_t propSize, - /// [out][optional][typename(propName, propSize)] value of the - /// command-buffer command property - void *pPropValue, - /// [out][optional] bytes returned in command-buffer command property - size_t *pPropSizeRet) { - ur_result_t result = UR_RESULT_SUCCESS; - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Enqueue a command to execute a cooperative kernel /// diff --git a/test/conformance/exp_command_buffer/fixtures.h b/test/conformance/exp_command_buffer/fixtures.h index 7f35e3e4f2..0cd4d7a6b3 100644 --- a/test/conformance/exp_command_buffer/fixtures.h +++ b/test/conformance/exp_command_buffer/fixtures.h @@ -216,19 +216,6 @@ struct urCommandBufferCommandExpTest ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle)); } - void TearDown() override { - if (command_handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - } - - if (command_handle_2) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle_2)); - } - - UUR_RETURN_ON_FATAL_FAILURE( - urUpdatableCommandBufferExpExecutionTest::TearDown()); - } - static constexpr size_t local_size = 4; static constexpr size_t global_size = 32; static constexpr size_t global_offset = 0; @@ -421,12 +408,6 @@ struct urCommandEventSyncUpdateTest : urCommandEventSyncTest { } virtual void TearDown() override { - for (auto command_handle : command_handles) { - if (command_handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - } - } - if (updatable_cmd_buf_handle) { EXPECT_SUCCESS(urCommandBufferReleaseExp(updatable_cmd_buf_handle)); } diff --git a/test/conformance/exp_command_buffer/release.cpp b/test/conformance/exp_command_buffer/release.cpp index a8112dd5cb..f27a5f5dca 100644 --- a/test/conformance/exp_command_buffer/release.cpp +++ b/test/conformance/exp_command_buffer/release.cpp @@ -29,62 +29,3 @@ TEST_P(urCommandBufferReleaseExpTest, InvalidNullHandle) { EXPECT_EQ_RESULT(urCommandBufferReleaseExp(nullptr), UR_RESULT_ERROR_INVALID_NULL_HANDLE); } - -using urCommandBufferReleaseCommandExpTest = - uur::command_buffer::urCommandBufferCommandExpTest; - -UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urCommandBufferReleaseCommandExpTest); - -TEST_P(urCommandBufferReleaseCommandExpTest, Success) { - EXPECT_SUCCESS(urCommandBufferRetainCommandExp(command_handle)); - - uint32_t prev_ref_count = 0; - EXPECT_SUCCESS(uur::GetObjectReferenceCount(command_handle, prev_ref_count)); - - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - - uint32_t ref_count = 0; - EXPECT_SUCCESS(uur::GetObjectReferenceCount(command_handle, ref_count)); - - EXPECT_GT(prev_ref_count, ref_count); -} - -TEST_P(urCommandBufferReleaseCommandExpTest, ReleaseCmdBufBeforeHandle) { - EXPECT_SUCCESS(urCommandBufferReleaseExp(updatable_cmd_buf_handle)); - - // Ref count of `updatable_cmd_buf_handle` but shouldn't be destroyed - // until all handles as destroyed. - EXPECT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0, - nullptr, nullptr)); - EXPECT_SUCCESS(urQueueFinish(queue)); - updatable_cmd_buf_handle = nullptr; - - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - command_handle = nullptr; -} - -TEST_P(urCommandBufferReleaseCommandExpTest, ReleaseCmdBufMultipleHandles) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - command_handle = nullptr; - - // Ref count of `updatable_cmd_buf_handle` but should still be above zero - EXPECT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0, - nullptr, nullptr)); - EXPECT_SUCCESS(urQueueFinish(queue)); - - // Ref count of `updatable_cmd_buf_handle` but shouldn't be destroyed - // until all handles as destroyed. - EXPECT_SUCCESS(urCommandBufferReleaseExp(updatable_cmd_buf_handle)); - EXPECT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0, - nullptr, nullptr)); - EXPECT_SUCCESS(urQueueFinish(queue)); - updatable_cmd_buf_handle = nullptr; - - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle_2)); - command_handle_2 = nullptr; -} - -TEST_P(urCommandBufferReleaseCommandExpTest, InvalidNullHandle) { - EXPECT_EQ_RESULT(urCommandBufferReleaseCommandExp(nullptr), - UR_RESULT_ERROR_INVALID_NULL_HANDLE); -} diff --git a/test/conformance/exp_command_buffer/retain.cpp b/test/conformance/exp_command_buffer/retain.cpp index 65309f1c57..42d0479eae 100644 --- a/test/conformance/exp_command_buffer/retain.cpp +++ b/test/conformance/exp_command_buffer/retain.cpp @@ -29,27 +29,3 @@ TEST_P(urCommandBufferRetainExpTest, InvalidNullHandle) { EXPECT_EQ_RESULT(urCommandBufferRetainExp(nullptr), UR_RESULT_ERROR_INVALID_NULL_HANDLE); } - -using urCommandBufferRetainCommandExpTest = - uur::command_buffer::urCommandBufferCommandExpTest; - -UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urCommandBufferRetainCommandExpTest); - -TEST_P(urCommandBufferRetainCommandExpTest, Success) { - uint32_t prev_ref_count = 0; - EXPECT_SUCCESS(uur::GetObjectReferenceCount(command_handle, prev_ref_count)); - - EXPECT_SUCCESS(urCommandBufferRetainCommandExp(command_handle)); - - uint32_t ref_count = 0; - EXPECT_SUCCESS(uur::GetObjectReferenceCount(command_handle, ref_count)); - - EXPECT_LT(prev_ref_count, ref_count); - - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); -} - -TEST_P(urCommandBufferRetainCommandExpTest, InvalidNullHandle) { - EXPECT_EQ_RESULT(urCommandBufferRetainCommandExp(nullptr), - UR_RESULT_ERROR_INVALID_NULL_HANDLE); -} diff --git a/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp b/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp index bc5ea0c196..6f51f3b5c1 100644 --- a/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp +++ b/test/conformance/exp_command_buffer/update/buffer_fill_kernel_update.cpp @@ -61,10 +61,6 @@ struct BufferFillCommandTest EXPECT_SUCCESS(urMemRelease(new_buffer)); } - if (command_handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - } - UUR_RETURN_ON_FATAL_FAILURE( urUpdatableCommandBufferExpExecutionTest::TearDown()); } diff --git a/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp b/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp index 131c1c4769..3dbb099182 100644 --- a/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp +++ b/test/conformance/exp_command_buffer/update/buffer_saxpy_kernel_update.cpp @@ -116,10 +116,6 @@ struct BufferSaxpyKernelTest } } - if (command_handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - } - UUR_RETURN_ON_FATAL_FAILURE( urUpdatableCommandBufferExpExecutionTest::TearDown()); } diff --git a/test/conformance/exp_command_buffer/update/invalid_update.cpp b/test/conformance/exp_command_buffer/update/invalid_update.cpp index d76416363d..50fa6e92c2 100644 --- a/test/conformance/exp_command_buffer/update/invalid_update.cpp +++ b/test/conformance/exp_command_buffer/update/invalid_update.cpp @@ -53,10 +53,6 @@ struct InvalidUpdateTest EXPECT_SUCCESS(urUSMFree(context, shared_ptr)); } - if (command_handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - } - UUR_RETURN_ON_FATAL_FAILURE( urUpdatableCommandBufferExpExecutionTest::TearDown()); } @@ -165,9 +161,6 @@ TEST_P(InvalidUpdateTest, NotUpdatableCommandBuffer) { urCommandBufferUpdateKernelLaunchExp(test_command_handle, &update_desc); EXPECT_EQ(UR_RESULT_ERROR_INVALID_NULL_HANDLE, result); - if (test_command_handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(test_command_handle)); - } if (test_cmd_buf_handle) { EXPECT_SUCCESS(urCommandBufferReleaseExp(test_cmd_buf_handle)); } @@ -287,10 +280,6 @@ struct InvalidUpdateCommandBufferExpExecutionTest : uur::urKernelExecutionTest { EXPECT_SUCCESS(urUSMFree(context, shared_ptr)); } - if (command_handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - } - if (kernel_2) { ASSERT_SUCCESS(urKernelRelease(kernel_2)); } diff --git a/test/conformance/exp_command_buffer/update/kernel_event_sync.cpp b/test/conformance/exp_command_buffer/update/kernel_event_sync.cpp index 3b2a6168c6..a923e030b9 100644 --- a/test/conformance/exp_command_buffer/update/kernel_event_sync.cpp +++ b/test/conformance/exp_command_buffer/update/kernel_event_sync.cpp @@ -47,10 +47,6 @@ struct KernelCommandEventSyncUpdateTest } } - if (command_handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - } - UUR_RETURN_ON_FATAL_FAILURE( urUpdatableCommandBufferExpExecutionTest::TearDown()); } diff --git a/test/conformance/exp_command_buffer/update/kernel_handle_update.cpp b/test/conformance/exp_command_buffer/update/kernel_handle_update.cpp index c6db293063..f458096c1b 100644 --- a/test/conformance/exp_command_buffer/update/kernel_handle_update.cpp +++ b/test/conformance/exp_command_buffer/update/kernel_handle_update.cpp @@ -262,13 +262,13 @@ TEST_P(urCommandBufferKernelHandleUpdateTest, Success) { std::vector KernelAlternatives = { FillUSM2DKernel->Kernel}; - uur::raii::CommandBufferCommand CommandHandle; + ur_exp_command_buffer_command_handle_t CommandHandle; ASSERT_SUCCESS(urCommandBufferAppendKernelLaunchExp( updatable_cmd_buf_handle, SaxpyKernel->Kernel, SaxpyKernel->NDimensions, &(SaxpyKernel->GlobalOffset), &(SaxpyKernel->GlobalSize), &(SaxpyKernel->LocalSize), KernelAlternatives.size(), KernelAlternatives.data(), 0, nullptr, 0, nullptr, nullptr, nullptr, - CommandHandle.ptr())); + &CommandHandle)); ASSERT_NE(CommandHandle, nullptr); ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle)); @@ -292,13 +292,13 @@ TEST_P(urCommandBufferKernelHandleUpdateTest, UpdateAgain) { std::vector KernelAlternatives = { FillUSM2DKernel->Kernel}; - uur::raii::CommandBufferCommand CommandHandle; + ur_exp_command_buffer_command_handle_t CommandHandle; ASSERT_SUCCESS(urCommandBufferAppendKernelLaunchExp( updatable_cmd_buf_handle, SaxpyKernel->Kernel, SaxpyKernel->NDimensions, &(SaxpyKernel->GlobalOffset), &(SaxpyKernel->GlobalSize), &(SaxpyKernel->LocalSize), KernelAlternatives.size(), KernelAlternatives.data(), 0, nullptr, 0, nullptr, nullptr, nullptr, - CommandHandle.ptr())); + &CommandHandle)); ASSERT_NE(CommandHandle, nullptr); ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle)); @@ -331,13 +331,13 @@ TEST_P(urCommandBufferKernelHandleUpdateTest, RestoreOriginalKernel) { std::vector KernelAlternatives = { FillUSM2DKernel->Kernel}; - uur::raii::CommandBufferCommand CommandHandle; + ur_exp_command_buffer_command_handle_t CommandHandle; ASSERT_SUCCESS(urCommandBufferAppendKernelLaunchExp( updatable_cmd_buf_handle, SaxpyKernel->Kernel, SaxpyKernel->NDimensions, &(SaxpyKernel->GlobalOffset), &(SaxpyKernel->GlobalSize), &(SaxpyKernel->LocalSize), KernelAlternatives.size(), KernelAlternatives.data(), 0, nullptr, 0, nullptr, nullptr, nullptr, - CommandHandle.ptr())); + &CommandHandle)); ASSERT_NE(CommandHandle, nullptr); ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle)); @@ -364,13 +364,12 @@ TEST_P(urCommandBufferKernelHandleUpdateTest, RestoreOriginalKernel) { } TEST_P(urCommandBufferKernelHandleUpdateTest, KernelAlternativeNotRegistered) { - - uur::raii::CommandBufferCommand CommandHandle; + ur_exp_command_buffer_command_handle_t CommandHandle; ASSERT_SUCCESS(urCommandBufferAppendKernelLaunchExp( updatable_cmd_buf_handle, SaxpyKernel->Kernel, SaxpyKernel->NDimensions, &(SaxpyKernel->GlobalOffset), &(SaxpyKernel->GlobalSize), &(SaxpyKernel->LocalSize), 0, nullptr, 0, nullptr, 0, nullptr, nullptr, - nullptr, CommandHandle.ptr())); + nullptr, &CommandHandle)); ASSERT_NE(CommandHandle, nullptr); ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle)); @@ -407,12 +406,12 @@ UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urCommandBufferValidUpdateParametersTest); TEST_P(urCommandBufferValidUpdateParametersTest, UpdateDimensionsWithoutUpdatingKernel) { - uur::raii::CommandBufferCommand CommandHandle; + ur_exp_command_buffer_command_handle_t CommandHandle; ASSERT_SUCCESS(urCommandBufferAppendKernelLaunchExp( updatable_cmd_buf_handle, FillUSM2DKernel->Kernel, FillUSM2DKernel->NDimensions, FillUSM2DKernel->GlobalOffset.data(), FillUSM2DKernel->GlobalSize.data(), FillUSM2DKernel->LocalSize.data(), 0, - nullptr, 0, nullptr, 0, nullptr, nullptr, nullptr, CommandHandle.ptr())); + nullptr, 0, nullptr, 0, nullptr, nullptr, nullptr, &CommandHandle)); ASSERT_NE(CommandHandle, nullptr); ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle)); @@ -446,13 +445,13 @@ TEST_P(urCommandBufferValidUpdateParametersTest, UpdateOnlyLocalWorkSize) { std::vector KernelAlternatives = { FillUSM2DKernel->Kernel}; - uur::raii::CommandBufferCommand CommandHandle; + ur_exp_command_buffer_command_handle_t CommandHandle; ASSERT_SUCCESS(urCommandBufferAppendKernelLaunchExp( updatable_cmd_buf_handle, SaxpyKernel->Kernel, SaxpyKernel->NDimensions, &(SaxpyKernel->GlobalOffset), &(SaxpyKernel->GlobalSize), &(SaxpyKernel->LocalSize), KernelAlternatives.size(), KernelAlternatives.data(), 0, nullptr, 0, nullptr, nullptr, nullptr, - CommandHandle.ptr())); + &CommandHandle)); ASSERT_NE(CommandHandle, nullptr); ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle)); @@ -479,13 +478,13 @@ TEST_P(urCommandBufferValidUpdateParametersTest, SuccessNullptrHandle) { std::vector KernelAlternatives = { FillUSM2DKernel->Kernel}; - uur::raii::CommandBufferCommand CommandHandle; + ur_exp_command_buffer_command_handle_t CommandHandle; ASSERT_SUCCESS(urCommandBufferAppendKernelLaunchExp( updatable_cmd_buf_handle, SaxpyKernel->Kernel, SaxpyKernel->NDimensions, &(SaxpyKernel->GlobalOffset), &(SaxpyKernel->GlobalSize), &(SaxpyKernel->LocalSize), KernelAlternatives.size(), KernelAlternatives.data(), 0, nullptr, 0, nullptr, nullptr, nullptr, - CommandHandle.ptr())); + &CommandHandle)); ASSERT_NE(CommandHandle, nullptr); ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle)); diff --git a/test/conformance/exp_command_buffer/update/local_memory_update.cpp b/test/conformance/exp_command_buffer/update/local_memory_update.cpp index 5ed585b5a9..8775a3e956 100644 --- a/test/conformance/exp_command_buffer/update/local_memory_update.cpp +++ b/test/conformance/exp_command_buffer/update/local_memory_update.cpp @@ -136,14 +136,6 @@ struct LocalMemoryUpdateTest : LocalMemoryUpdateTestBase { ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle)); } - void TearDown() override { - if (command_handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - } - - UUR_RETURN_ON_FATAL_FAILURE(LocalMemoryUpdateTestBase::TearDown()); - } - ur_exp_command_buffer_command_handle_t command_handle = nullptr; }; @@ -888,15 +880,6 @@ struct LocalMemoryMultiUpdateTest : LocalMemoryUpdateTestBase { ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle)); } - void TearDown() override { - for (auto &handle : command_handles) { - if (handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(handle)); - } - } - UUR_RETURN_ON_FATAL_FAILURE(LocalMemoryUpdateTestBase::TearDown()); - } - static constexpr size_t nodes = 1024; static constexpr uint32_t A = 42; std::array command_handles{}; @@ -1197,15 +1180,6 @@ struct LocalMemoryUpdateTestOutOfOrder : LocalMemoryUpdateTestBaseOutOfOrder { ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle)); } - void TearDown() override { - if (command_handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - } - - UUR_RETURN_ON_FATAL_FAILURE( - LocalMemoryUpdateTestBaseOutOfOrder::TearDown()); - } - ur_exp_command_buffer_command_handle_t command_handle = nullptr; }; diff --git a/test/conformance/exp_command_buffer/update/ndrange_update.cpp b/test/conformance/exp_command_buffer/update/ndrange_update.cpp index 10adc7ad52..82e7bf59b7 100644 --- a/test/conformance/exp_command_buffer/update/ndrange_update.cpp +++ b/test/conformance/exp_command_buffer/update/ndrange_update.cpp @@ -85,10 +85,6 @@ struct NDRangeUpdateTest EXPECT_SUCCESS(urUSMFree(context, shared_ptr)); } - if (command_handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - } - UUR_RETURN_ON_FATAL_FAILURE( urUpdatableCommandBufferExpExecutionTest::TearDown()); } diff --git a/test/conformance/exp_command_buffer/update/usm_fill_kernel_update.cpp b/test/conformance/exp_command_buffer/update/usm_fill_kernel_update.cpp index bc7fd8044e..3916823efc 100644 --- a/test/conformance/exp_command_buffer/update/usm_fill_kernel_update.cpp +++ b/test/conformance/exp_command_buffer/update/usm_fill_kernel_update.cpp @@ -60,10 +60,6 @@ struct USMFillCommandTest EXPECT_SUCCESS(urUSMFree(context, new_shared_ptr)); } - if (command_handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - } - UUR_RETURN_ON_FATAL_FAILURE( urUpdatableCommandBufferExpExecutionTest::TearDown()); } diff --git a/test/conformance/exp_command_buffer/update/usm_saxpy_kernel_update.cpp b/test/conformance/exp_command_buffer/update/usm_saxpy_kernel_update.cpp index 57913a7259..cfc2f6c95f 100644 --- a/test/conformance/exp_command_buffer/update/usm_saxpy_kernel_update.cpp +++ b/test/conformance/exp_command_buffer/update/usm_saxpy_kernel_update.cpp @@ -87,14 +87,6 @@ struct USMSaxpyKernelTest : USMSaxpyKernelTestBase { ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle)); } - void TearDown() override { - if (command_handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(command_handle)); - } - - UUR_RETURN_ON_FATAL_FAILURE(USMSaxpyKernelTestBase::TearDown()); - } - ur_exp_command_buffer_command_handle_t command_handle = nullptr; }; @@ -190,15 +182,6 @@ struct USMMultiSaxpyKernelTest : USMSaxpyKernelTestBase { ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle)); } - void TearDown() override { - for (auto &handle : command_handles) { - if (handle) { - EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(handle)); - } - } - UUR_RETURN_ON_FATAL_FAILURE(USMSaxpyKernelTestBase::TearDown()); - } - static constexpr size_t nodes = 1024; static constexpr uint32_t A = 42; std::array command_handles{}; diff --git a/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp b/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp index 2281e7aed1..ac05627804 100644 --- a/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp +++ b/test/conformance/program/urMultiDeviceProgramCreateWithBinary.cpp @@ -347,11 +347,11 @@ TEST_P(urMultiDeviceCommandBufferExpTest, Update) { urCommandBufferCreateExp(context, device, &desc, cmd_buf_handle.ptr())); // Append kernel command to command-buffer and close command-buffer - uur::raii::CommandBufferCommand command; + ur_exp_command_buffer_command_handle_t command; ASSERT_SUCCESS(urCommandBufferAppendKernelLaunchExp( cmd_buf_handle, kernel, n_dimensions, &global_offset, &global_size, &local_size, 0, nullptr, 0, nullptr, 0, nullptr, nullptr, nullptr, - command.ptr())); + &command)); ASSERT_SUCCESS(urCommandBufferFinalizeExp(cmd_buf_handle)); // Verify execution succeeds diff --git a/test/conformance/testing/include/uur/raii.h b/test/conformance/testing/include/uur/raii.h index 6aeb799d0e..cfbf36e357 100644 --- a/test/conformance/testing/include/uur/raii.h +++ b/test/conformance/testing/include/uur/raii.h @@ -112,9 +112,6 @@ using Event = Wrapper; using CommandBuffer = Wrapper; -using CommandBufferCommand = - Wrapper; } // namespace raii } // namespace uur diff --git a/test/conformance/testing/include/uur/utils.h b/test/conformance/testing/include/uur/utils.h index bb0b79a404..c94ff56dbd 100644 --- a/test/conformance/testing/include/uur/utils.h +++ b/test/conformance/testing/include/uur/utils.h @@ -123,14 +123,6 @@ auto GetCommandBufferInfo = [](ur_exp_command_buffer_handle_t cmd_buf, return GetInfo(cmd_buf, info, urCommandBufferGetInfoExp, out_value); }; -template -auto GetCommandBufferCommandInfo = - [](ur_exp_command_buffer_command_handle_t command, - ur_exp_command_buffer_command_info_t info, T &out_value) { - return GetInfo(command, info, urCommandBufferCommandGetInfoExp, - out_value); - }; - template ur_result_t GetObjectReferenceCount(T object, uint32_t &out_ref_count) { if constexpr (std::is_same_v) { @@ -169,12 +161,6 @@ ur_result_t GetObjectReferenceCount(T object, uint32_t &out_ref_count) { return GetCommandBufferInfo( object, UR_EXP_COMMAND_BUFFER_INFO_REFERENCE_COUNT, out_ref_count); } - if constexpr (std::is_same_v) { - return GetCommandBufferCommandInfo( - object, UR_EXP_COMMAND_BUFFER_COMMAND_INFO_REFERENCE_COUNT, - out_ref_count); - } - return UR_RESULT_ERROR_INVALID_VALUE; }