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

[EXP][Command-Buffer] Optimize L0 command buffer submission #1442

Merged
merged 1 commit into from
Apr 26, 2024
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
39 changes: 27 additions & 12 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -7979,6 +7979,9 @@ typedef struct ur_exp_command_buffer_desc_t {
///< ::UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC
const void *pNext; ///< [in][optional] pointer to extension-specific structure
ur_bool_t isUpdatable; ///< [in] Commands in a finalized command-buffer can be updated.
ur_bool_t isInOrder; ///< [in] Commands in a command-buffer may be executed in-order without
///< explicit dependencies.
ur_bool_t enableProfiling; ///< [in] Command-buffer profiling is enabled.

} ur_exp_command_buffer_desc_t;

Expand Down Expand Up @@ -8183,7 +8186,8 @@ urCommandBufferAppendKernelLaunchExp(
const size_t *pGlobalWorkSize, ///< [in] Global work size to use when executing kernel.
const size_t *pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel.
uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. May
///< be ignored if command-buffer is in-order.
ur_exp_command_buffer_sync_point_t *pSyncPoint, ///< [out][optional] Sync point associated with this command.
ur_exp_command_buffer_command_handle_t *phCommand ///< [out][optional] Handle to this command.
);
Expand Down Expand Up @@ -8219,7 +8223,8 @@ urCommandBufferAppendUSMMemcpyExp(
const void *pSrc, ///< [in] The data to be copied.
size_t size, ///< [in] The number of bytes to copy.
uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. May
///< be ignored if command-buffer is in-order.
ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] Sync point associated with this command.
);

Expand Down Expand Up @@ -8258,7 +8263,8 @@ urCommandBufferAppendUSMFillExp(
size_t patternSize, ///< [in] size in bytes of the pattern.
size_t size, ///< [in] fill size in bytes, must be a multiple of patternSize.
uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. May
///< be ignored if command-buffer is in-order.
ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command.
);

Expand Down Expand Up @@ -8291,7 +8297,8 @@ urCommandBufferAppendMemBufferCopyExp(
size_t dstOffset, ///< [in] Offset into the destination memory
size_t size, ///< [in] The number of bytes to be copied.
uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. May
///< be ignored if command-buffer is in-order.
ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] Sync point associated with this command.
);

Expand Down Expand Up @@ -8324,7 +8331,8 @@ urCommandBufferAppendMemBufferWriteExp(
size_t size, ///< [in] Size in bytes of data being written.
const void *pSrc, ///< [in] Pointer to host memory where data is to be written from.
uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. May
///< be ignored if command-buffer is in-order.
ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] Sync point associated with this command.
);

Expand Down Expand Up @@ -8357,7 +8365,8 @@ urCommandBufferAppendMemBufferReadExp(
size_t size, ///< [in] Size in bytes of data being written.
void *pDst, ///< [in] Pointer to host memory where data is to be written to.
uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. May
///< be ignored if command-buffer is in-order.
ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] Sync point associated with this command.
);

Expand Down Expand Up @@ -8394,7 +8403,8 @@ urCommandBufferAppendMemBufferCopyRectExp(
size_t dstRowPitch, ///< [in] Row pitch of the destination memory.
size_t dstSlicePitch, ///< [in] Slice pitch of the destination memory.
uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. May
///< be ignored if command-buffer is in-order.
ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] Sync point associated with this command.
);

Expand Down Expand Up @@ -8435,7 +8445,8 @@ urCommandBufferAppendMemBufferWriteRectExp(
///< pointed to by pSrc.
void *pSrc, ///< [in] Pointer to host memory where data is to be written from.
uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. May
///< be ignored if command-buffer is in-order.
ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] Sync point associated with this command.
);

Expand Down Expand Up @@ -8475,7 +8486,8 @@ urCommandBufferAppendMemBufferReadRectExp(
///< pointed to by pDst.
void *pDst, ///< [in] Pointer to host memory where data is to be read into.
uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. May
///< be ignored if command-buffer is in-order.
ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] Sync point associated with this command.
);

Expand Down Expand Up @@ -8511,7 +8523,8 @@ urCommandBufferAppendMemBufferFillExp(
size_t offset, ///< [in] offset into the buffer.
size_t size, ///< [in] fill size in bytes, must be a multiple of patternSize.
uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. May
///< be ignored if command-buffer is in-order.
ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command.
);

Expand Down Expand Up @@ -8552,7 +8565,8 @@ urCommandBufferAppendUSMPrefetchExp(
size_t size, ///< [in] size in bytes to be fetched.
ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags
uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. May
///< be ignored if command-buffer is in-order.
ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command.
);

Expand Down Expand Up @@ -8593,7 +8607,8 @@ urCommandBufferAppendUSMAdviseExp(
size_t size, ///< [in] size in bytes to be advised.
ur_usm_advice_flags_t advice, ///< [in] USM memory advice
uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. May
///< be ignored if command-buffer is in-order.
ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command.
);

Expand Down
10 changes: 10 additions & 0 deletions include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9496,6 +9496,16 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_command_bu

os << (params.isUpdatable);

os << ", ";
os << ".isInOrder = ";

os << (params.isInOrder);

os << ", ";
os << ".enableProfiling = ";

os << (params.enableProfiling);

os << "}";
return os;
}
Expand Down
11 changes: 8 additions & 3 deletions scripts/core/EXP-COMMAND-BUFFER.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ Command-Buffer Creation
Command-Buffers are tied to a specific ${x}_context_handle_t and
${x}_device_handle_t. ${x}CommandBufferCreateExp optionally takes a descriptor
to provide additional properties for how the command-buffer should be
constructed. The only unique member defined in ${x}_exp_command_buffer_desc_t
is ``isUpdatable``, which should be set to ``true`` to support :ref:`updating
constructed. The members defined in ${x}_exp_command_buffer_desc_t are:
* ``isUpdatable``, which should be set to ``true`` to support :ref:`updating
command-buffer commands`.
* ``isInOrder``, which should be set to ``true`` to enable commands enqueued to
a command-buffer to be executed in an in-order fashion where possible.
* ``enableProfiling``, which should be set to ``true`` to enable profiling of
the command-buffer.

Command-buffers are reference counted and can be retained and released by
calling ${x}CommandBufferRetainExp and ${x}CommandBufferReleaseExp respectively.
Expand Down Expand Up @@ -123,7 +127,8 @@ Sync-Points
A sync-point is a value which represents a command inside of a command-buffer
which is returned from command-buffer append function calls. These can be
optionally passed to these functions to define execution dependencies on other
commands within the command-buffer.
commands within the command-buffer. Sync-points passed to functions may be
ignored if the command-buffer was created in-order.

Sync-points are unique and valid for use only within the command-buffer they
were obtained from.
Expand Down
Loading