Skip to content

Commit

Permalink
Rename urCommandBufferEnqueueExp to urEnqueueCommandBufferExp
Browse files Browse the repository at this point in the history
The API to enqueue a closed command-buffer to a queue is defined
in the YAML as a part of the command-buffer class, but it should be
part of the enqueue class like other enqueue API extensions.

This PR updates the YAML and regenerates UR code, making the associated
changes to adapters and CTS.

Closes #2600
  • Loading branch information
EwanC committed Jan 29, 2025
1 parent 4643d1c commit f4234a7
Show file tree
Hide file tree
Showing 50 changed files with 379 additions and 354 deletions.
40 changes: 20 additions & 20 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,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 @@ -435,6 +433,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 @@ -7037,8 +7037,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 @@ -10992,8 +10992,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 @@ -11003,11 +11003,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 @@ -13558,6 +13558,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 @@ -14237,18 +14249,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 urCommandBufferRetainCommandExp
/// @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(urCommandBufferRetainCommandExp)
_UR_API(urCommandBufferReleaseCommandExp)
_UR_API(urCommandBufferUpdateKernelLaunchExp)
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 urCommandBufferRetainCommandExp
typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferRetainCommandExp_t)(
Expand Down Expand Up @@ -1655,7 +1656,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_pfnCommandBufferRetainCommandExp_t pfnRetainCommandExp;
ur_pfnCommandBufferReleaseCommandExp_t pfnReleaseCommandExp;
ur_pfnCommandBufferUpdateKernelLaunchExp_t pfnUpdateKernelLaunchExp;
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_retain_command_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 @@ -1168,9 +1168,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 @@ -1186,6 +1183,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 @@ -9843,8 +9843,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 @@ -16135,6 +16135,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 @@ -18565,53 +18612,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_retain_command_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_RETAIN_COMMAND_EXP: {
os << (const struct ur_command_buffer_retain_command_exp_params_t *)params;
} break;
Expand Down
Loading

0 comments on commit f4234a7

Please sign in to comment.