Skip to content

Commit

Permalink
Merge pull request #2606 from Bensuo/cmd-buf_enqueue_refactor
Browse files Browse the repository at this point in the history
Rename urCommandBufferEnqueueExp to urEnqueueCommandBufferExp
  • Loading branch information
kbenzie authored Feb 6, 2025
2 parents 0c11a74 + ec5a3bd commit cc60d08
Show file tree
Hide file tree
Showing 51 changed files with 376 additions and 376 deletions.
40 changes: 20 additions & 20 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,6 @@ typedef enum ur_function_t {
UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP = 240,
/// Enumerator for ::urCommandBufferAppendUSMAdviseExp
UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 241,
/// Enumerator for ::urCommandBufferEnqueueExp
UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP = 242,
/// Enumerator for ::urCommandBufferUpdateSignalEventExp
UR_FUNCTION_COMMAND_BUFFER_UPDATE_SIGNAL_EVENT_EXP = 243,
/// Enumerator for ::urCommandBufferUpdateWaitEventsExp
Expand All @@ -429,6 +427,8 @@ typedef enum ur_function_t {
UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER_EXT = 246,
/// Enumerator for ::urPhysicalMemGetInfo
UR_FUNCTION_PHYSICAL_MEM_GET_INFO = 249,
/// Enumerator for ::urEnqueueCommandBufferExp
UR_FUNCTION_ENQUEUE_COMMAND_BUFFER_EXP = 250,
/// @cond
UR_FUNCTION_FORCE_UINT32 = 0x7fffffff
/// @endcond
Expand Down Expand Up @@ -7044,8 +7044,8 @@ typedef enum ur_command_t {
UR_COMMAND_READ_HOST_PIPE = 25,
/// Event created by ::urEnqueueWriteHostPipe
UR_COMMAND_WRITE_HOST_PIPE = 26,
/// Event created by ::urCommandBufferEnqueueExp
UR_COMMAND_COMMAND_BUFFER_ENQUEUE_EXP = 0x1000,
/// Event created by ::urEnqueueCommandBufferExp
UR_COMMAND_ENQUEUE_COMMAND_BUFFER_EXP = 0x1000,
/// Event created by ::urBindlessImagesWaitExternalSemaphoreExp
UR_COMMAND_EXTERNAL_SEMAPHORE_WAIT_EXP = 0x2000,
/// Event created by ::urBindlessImagesSignalExternalSemaphoreExp
Expand Down Expand Up @@ -11001,8 +11001,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
/// - ::UR_RESULT_ERROR_DEVICE_LOST
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hCommandBuffer`
/// + `NULL == hQueue`
/// + `NULL == hCommandBuffer`
/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP
/// - ::UR_RESULT_ERROR_INVALID_QUEUE
/// - ::UR_RESULT_ERROR_INVALID_EVENT
Expand All @@ -11012,11 +11012,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
/// + If event objects in phEventWaitList are not valid events.
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp(
/// [in] Handle of the command-buffer object.
ur_exp_command_buffer_handle_t hCommandBuffer,
UR_APIEXPORT ur_result_t UR_APICALL urEnqueueCommandBufferExp(
/// [in] The queue to submit this command-buffer for execution.
ur_queue_handle_t hQueue,
/// [in] Handle of the command-buffer object.
ur_exp_command_buffer_handle_t hCommandBuffer,
/// [in] Size of the event wait list.
uint32_t numEventsInWaitList,
/// [in][optional][range(0, numEventsInWaitList)] pointer to a list of
Expand Down Expand Up @@ -13495,6 +13495,18 @@ typedef struct ur_enqueue_events_wait_with_barrier_ext_params_t {
ur_event_handle_t **pphEvent;
} ur_enqueue_events_wait_with_barrier_ext_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Function parameters for urEnqueueCommandBufferExp
/// @details Each entry is a pointer to the parameter passed to the function;
/// allowing the callback the ability to modify the parameter's value
typedef struct ur_enqueue_command_buffer_exp_params_t {
ur_queue_handle_t *phQueue;
ur_exp_command_buffer_handle_t *phCommandBuffer;
uint32_t *pnumEventsInWaitList;
const ur_event_handle_t **pphEventWaitList;
ur_event_handle_t **pphEvent;
} ur_enqueue_command_buffer_exp_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Function parameters for urEnqueueCooperativeKernelLaunchExp
/// @details Each entry is a pointer to the parameter passed to the function;
Expand Down Expand Up @@ -14174,18 +14186,6 @@ typedef struct ur_command_buffer_append_usm_advise_exp_params_t {
ur_exp_command_buffer_command_handle_t **pphCommand;
} ur_command_buffer_append_usm_advise_exp_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Function parameters for urCommandBufferEnqueueExp
/// @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_enqueue_exp_params_t {
ur_exp_command_buffer_handle_t *phCommandBuffer;
ur_queue_handle_t *phQueue;
uint32_t *pnumEventsInWaitList;
const ur_event_handle_t **pphEventWaitList;
ur_event_handle_t **pphEvent;
} ur_command_buffer_enqueue_exp_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Function parameters for urCommandBufferUpdateKernelLaunchExp
/// @details Each entry is a pointer to the parameter passed to the function;
Expand Down
2 changes: 1 addition & 1 deletion include/ur_api_funcs.def
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ _UR_API(urEnqueueReadHostPipe)
_UR_API(urEnqueueWriteHostPipe)
_UR_API(urEnqueueEventsWaitWithBarrierExt)
_UR_API(urEnqueueKernelLaunchCustomExp)
_UR_API(urEnqueueCommandBufferExp)
_UR_API(urEnqueueCooperativeKernelLaunchExp)
_UR_API(urEnqueueTimestampRecordingExp)
_UR_API(urEnqueueNativeCommandExp)
Expand Down Expand Up @@ -181,7 +182,6 @@ _UR_API(urCommandBufferAppendMemBufferReadRectExp)
_UR_API(urCommandBufferAppendMemBufferFillExp)
_UR_API(urCommandBufferAppendUSMPrefetchExp)
_UR_API(urCommandBufferAppendUSMAdviseExp)
_UR_API(urCommandBufferEnqueueExp)
_UR_API(urCommandBufferUpdateKernelLaunchExp)
_UR_API(urCommandBufferUpdateSignalEventExp)
_UR_API(urCommandBufferUpdateWaitEventsExp)
Expand Down
14 changes: 7 additions & 7 deletions include/ur_ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,12 @@ typedef ur_result_t(UR_APICALL *ur_pfnEnqueueKernelLaunchCustomExp_t)(
const size_t *, const size_t *, uint32_t, const ur_exp_launch_property_t *,
uint32_t, const ur_event_handle_t *, ur_event_handle_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urEnqueueCommandBufferExp
typedef ur_result_t(UR_APICALL *ur_pfnEnqueueCommandBufferExp_t)(
ur_queue_handle_t, ur_exp_command_buffer_handle_t, uint32_t,
const ur_event_handle_t *, ur_event_handle_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urEnqueueCooperativeKernelLaunchExp
typedef ur_result_t(UR_APICALL *ur_pfnEnqueueCooperativeKernelLaunchExp_t)(
Expand All @@ -1142,6 +1148,7 @@ typedef ur_result_t(UR_APICALL *ur_pfnEnqueueNativeCommandExp_t)(
/// @brief Table of EnqueueExp functions pointers
typedef struct ur_enqueue_exp_dditable_t {
ur_pfnEnqueueKernelLaunchCustomExp_t pfnKernelLaunchCustomExp;
ur_pfnEnqueueCommandBufferExp_t pfnCommandBufferExp;
ur_pfnEnqueueCooperativeKernelLaunchExp_t pfnCooperativeKernelLaunchExp;
ur_pfnEnqueueTimestampRecordingExp_t pfnTimestampRecordingExp;
ur_pfnEnqueueNativeCommandExp_t pfnNativeCommandExp;
Expand Down Expand Up @@ -1590,12 +1597,6 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMAdviseExp_t)(
const ur_event_handle_t *, ur_exp_command_buffer_sync_point_t *,
ur_event_handle_t *, ur_exp_command_buffer_command_handle_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urCommandBufferEnqueueExp
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 urCommandBufferUpdateKernelLaunchExp
typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateKernelLaunchExp_t)(
Expand Down Expand Up @@ -1639,7 +1640,6 @@ typedef struct ur_command_buffer_exp_dditable_t {
ur_pfnCommandBufferAppendMemBufferFillExp_t pfnAppendMemBufferFillExp;
ur_pfnCommandBufferAppendUSMPrefetchExp_t pfnAppendUSMPrefetchExp;
ur_pfnCommandBufferAppendUSMAdviseExp_t pfnAppendUSMAdviseExp;
ur_pfnCommandBufferEnqueueExp_t pfnEnqueueExp;
ur_pfnCommandBufferUpdateKernelLaunchExp_t pfnUpdateKernelLaunchExp;
ur_pfnCommandBufferUpdateSignalEventExp_t pfnUpdateSignalEventExp;
ur_pfnCommandBufferUpdateWaitEventsExp_t pfnUpdateWaitEventsExp;
Expand Down
20 changes: 10 additions & 10 deletions include/ur_print.h
Original file line number Diff line number Diff line change
Expand Up @@ -2626,6 +2626,16 @@ urPrintEnqueueEventsWaitWithBarrierExtParams(
const struct ur_enqueue_events_wait_with_barrier_ext_params_t *params,
char *buffer, const size_t buff_size, size_t *out_size);

///////////////////////////////////////////////////////////////////////////////
/// @brief Print ur_enqueue_command_buffer_exp_params_t struct
/// @returns
/// - ::UR_RESULT_SUCCESS
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// - `buff_size < out_size`
UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueCommandBufferExpParams(
const struct ur_enqueue_command_buffer_exp_params_t *params, char *buffer,
const size_t buff_size, size_t *out_size);

///////////////////////////////////////////////////////////////////////////////
/// @brief Print ur_enqueue_cooperative_kernel_launch_exp_params_t struct
/// @returns
Expand Down Expand Up @@ -3161,16 +3171,6 @@ urPrintCommandBufferAppendUsmAdviseExpParams(
const struct ur_command_buffer_append_usm_advise_exp_params_t *params,
char *buffer, const size_t buff_size, size_t *out_size);

///////////////////////////////////////////////////////////////////////////////
/// @brief Print ur_command_buffer_enqueue_exp_params_t struct
/// @returns
/// - ::UR_RESULT_SUCCESS
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// - `buff_size < out_size`
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_update_kernel_launch_exp_params_t struct
/// @returns
Expand Down
110 changes: 55 additions & 55 deletions include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,9 +1159,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) {
case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP:
os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP";
break;
case UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP:
os << "UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP";
break;
case UR_FUNCTION_COMMAND_BUFFER_UPDATE_SIGNAL_EVENT_EXP:
os << "UR_FUNCTION_COMMAND_BUFFER_UPDATE_SIGNAL_EVENT_EXP";
break;
Expand All @@ -1177,6 +1174,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) {
case UR_FUNCTION_PHYSICAL_MEM_GET_INFO:
os << "UR_FUNCTION_PHYSICAL_MEM_GET_INFO";
break;
case UR_FUNCTION_ENQUEUE_COMMAND_BUFFER_EXP:
os << "UR_FUNCTION_ENQUEUE_COMMAND_BUFFER_EXP";
break;
default:
os << "unknown enumerator";
break;
Expand Down Expand Up @@ -9899,8 +9899,8 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_command_t value) {
case UR_COMMAND_WRITE_HOST_PIPE:
os << "UR_COMMAND_WRITE_HOST_PIPE";
break;
case UR_COMMAND_COMMAND_BUFFER_ENQUEUE_EXP:
os << "UR_COMMAND_COMMAND_BUFFER_ENQUEUE_EXP";
case UR_COMMAND_ENQUEUE_COMMAND_BUFFER_EXP:
os << "UR_COMMAND_ENQUEUE_COMMAND_BUFFER_EXP";
break;
case UR_COMMAND_EXTERNAL_SEMAPHORE_WAIT_EXP:
os << "UR_COMMAND_EXTERNAL_SEMAPHORE_WAIT_EXP";
Expand Down Expand Up @@ -16205,6 +16205,53 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct
return os;
}

///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the ur_enqueue_command_buffer_exp_params_t type
/// @returns
/// std::ostream &
inline std::ostream &
operator<<(std::ostream &os,
[[maybe_unused]] const struct ur_enqueue_command_buffer_exp_params_t
*params) {

os << ".hQueue = ";

ur::details::printPtr(os, *(params->phQueue));

os << ", ";
os << ".hCommandBuffer = ";

ur::details::printPtr(os, *(params->phCommandBuffer));

os << ", ";
os << ".numEventsInWaitList = ";

os << *(params->pnumEventsInWaitList);

os << ", ";
os << ".phEventWaitList = ";
ur::details::printPtr(
os, reinterpret_cast<const void *>(*(params->pphEventWaitList)));
if (*(params->pphEventWaitList) != NULL) {
os << " {";
for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) {
if (i != 0) {
os << ", ";
}

ur::details::printPtr(os, (*(params->pphEventWaitList))[i]);
}
os << "}";
}

os << ", ";
os << ".phEvent = ";

ur::details::printPtr(os, *(params->pphEvent));

return os;
}

///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the
/// ur_enqueue_cooperative_kernel_launch_exp_params_t type
Expand Down Expand Up @@ -18635,53 +18682,6 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct
return os;
}

///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the ur_command_buffer_enqueue_exp_params_t type
/// @returns
/// std::ostream &
inline std::ostream &
operator<<(std::ostream &os,
[[maybe_unused]] const struct ur_command_buffer_enqueue_exp_params_t
*params) {

os << ".hCommandBuffer = ";

ur::details::printPtr(os, *(params->phCommandBuffer));

os << ", ";
os << ".hQueue = ";

ur::details::printPtr(os, *(params->phQueue));

os << ", ";
os << ".numEventsInWaitList = ";

os << *(params->pnumEventsInWaitList);

os << ", ";
os << ".phEventWaitList = ";
ur::details::printPtr(
os, reinterpret_cast<const void *>(*(params->pphEventWaitList)));
if (*(params->pphEventWaitList) != NULL) {
os << " {";
for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) {
if (i != 0) {
os << ", ";
}

ur::details::printPtr(os, (*(params->pphEventWaitList))[i]);
}
os << "}";
}

os << ", ";
os << ".phEvent = ";

ur::details::printPtr(os, *(params->pphEvent));

return os;
}

///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the
/// ur_command_buffer_update_kernel_launch_exp_params_t type
Expand Down Expand Up @@ -19890,6 +19890,9 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os,
os << (const struct ur_enqueue_events_wait_with_barrier_ext_params_t *)
params;
} break;
case UR_FUNCTION_ENQUEUE_COMMAND_BUFFER_EXP: {
os << (const struct ur_enqueue_command_buffer_exp_params_t *)params;
} break;
case UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP: {
os << (const struct ur_enqueue_cooperative_kernel_launch_exp_params_t *)
params;
Expand Down Expand Up @@ -20064,9 +20067,6 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os,
os << (const struct ur_command_buffer_append_usm_advise_exp_params_t *)
params;
} break;
case UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP: {
os << (const struct ur_command_buffer_enqueue_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 Down
Loading

0 comments on commit cc60d08

Please sign in to comment.