Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove command-buffer command handle ref counting #2578

Merged
merged 3 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 0 additions & 106 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
///
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions include/ur_api_funcs.def
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 0 additions & 19 deletions include/ur_ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)(
Expand All @@ -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 {
Expand All @@ -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;

///////////////////////////////////////////////////////////////////////////////
Expand Down
30 changes: 0 additions & 30 deletions include/ur_print.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
89 changes: 0 additions & 89 deletions include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions scripts/core/EXP-COMMAND-BUFFER.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------------------------------------------------------------------------
Expand All @@ -515,6 +512,8 @@ Changelog
+-----------+-------------------------------------------------------+
| 1.6 | Command level synchronization with event objects |
+-----------+-------------------------------------------------------+
| 1.7 | Remove command handle reference counting and querying |
+-----------+-------------------------------------------------------+

Contributors
--------------------------------------------------------------------------------
Expand Down
Loading
Loading