From 1cccb506c10cecb486b514ede42e8a85553df923 Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Fri, 22 Sep 2023 17:22:39 +0100 Subject: [PATCH 1/7] [EXP][CMDBUF] Add Prefetch and Advise commands to cmd buffer experimental feature Adds USM Prefetch and Advise append commands Update feature spec for new commands --- include/ur.py | 20 ++++ include/ur_api.h | 95 ++++++++++++++++ include/ur_ddi.h | 22 ++++ scripts/core/EXP-COMMAND-BUFFER.rst | 9 ++ scripts/core/exp-command-buffer.yml | 69 ++++++++++++ scripts/core/registry.yml | 6 + source/adapters/null/ur_nullddi.cpp | 67 +++++++++++ source/common/ur_params.hpp | 88 +++++++++++++++ source/loader/layers/tracing/ur_trcddi.cpp | 87 +++++++++++++++ source/loader/layers/validation/ur_valddi.cpp | 105 ++++++++++++++++++ source/loader/ur_ldrddi.cpp | 79 +++++++++++++ source/loader/ur_libapi.cpp | 94 ++++++++++++++++ source/ur_api.cpp | 77 +++++++++++++ 13 files changed, 818 insertions(+) diff --git a/include/ur.py b/include/ur.py index 2da7631697..95582d636c 100644 --- a/include/ur.py +++ b/include/ur.py @@ -200,6 +200,8 @@ class ur_function_v(IntEnum): COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 192 ## Enumerator for ::urCommandBufferAppendMemBufferFillExp ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP = 193 ## Enumerator for ::urEnqueueCooperativeKernelLaunchExp KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP = 194## Enumerator for ::urKernelSuggestMaxCooperativeGroupCountExp + COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP = 195 ## Enumerator for ::urCommandBufferAppendUSMPrefetchExp + COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 196 ## Enumerator for ::urCommandBufferAppendUSMAdviseExp class ur_function_t(c_int): def __str__(self): @@ -3616,6 +3618,20 @@ class ur_usm_exp_dditable_t(Structure): else: _urCommandBufferAppendMemBufferFillExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_void_p, c_size_t, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) +############################################################################### +## @brief Function-pointer for urCommandBufferAppendUSMPrefetchExp +if __use_win_types: + _urCommandBufferAppendUSMPrefetchExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_migration_flags_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) +else: + _urCommandBufferAppendUSMPrefetchExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_migration_flags_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + +############################################################################### +## @brief Function-pointer for urCommandBufferAppendUSMAdviseExp +if __use_win_types: + _urCommandBufferAppendUSMAdviseExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, POINTER(ur_exp_command_buffer_sync_point_t) ) +else: + _urCommandBufferAppendUSMAdviseExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, POINTER(ur_exp_command_buffer_sync_point_t) ) + ############################################################################### ## @brief Function-pointer for urCommandBufferEnqueueExp if __use_win_types: @@ -3642,6 +3658,8 @@ class ur_command_buffer_exp_dditable_t(Structure): ("pfnAppendMemBufferWriteRectExp", c_void_p), ## _urCommandBufferAppendMemBufferWriteRectExp_t ("pfnAppendMemBufferReadRectExp", c_void_p), ## _urCommandBufferAppendMemBufferReadRectExp_t ("pfnAppendMemBufferFillExp", c_void_p), ## _urCommandBufferAppendMemBufferFillExp_t + ("pfnAppendUSMPrefetchExp", c_void_p), ## _urCommandBufferAppendUSMPrefetchExp_t + ("pfnAppendUSMAdviseExp", c_void_p), ## _urCommandBufferAppendUSMAdviseExp_t ("pfnEnqueueExp", c_void_p) ## _urCommandBufferEnqueueExp_t ] @@ -4162,6 +4180,8 @@ def __init__(self, version : ur_api_version_t): self.urCommandBufferAppendMemBufferWriteRectExp = _urCommandBufferAppendMemBufferWriteRectExp_t(self.__dditable.CommandBufferExp.pfnAppendMemBufferWriteRectExp) self.urCommandBufferAppendMemBufferReadRectExp = _urCommandBufferAppendMemBufferReadRectExp_t(self.__dditable.CommandBufferExp.pfnAppendMemBufferReadRectExp) self.urCommandBufferAppendMemBufferFillExp = _urCommandBufferAppendMemBufferFillExp_t(self.__dditable.CommandBufferExp.pfnAppendMemBufferFillExp) + self.urCommandBufferAppendUSMPrefetchExp = _urCommandBufferAppendUSMPrefetchExp_t(self.__dditable.CommandBufferExp.pfnAppendUSMPrefetchExp) + self.urCommandBufferAppendUSMAdviseExp = _urCommandBufferAppendUSMAdviseExp_t(self.__dditable.CommandBufferExp.pfnAppendUSMAdviseExp) self.urCommandBufferEnqueueExp = _urCommandBufferEnqueueExp_t(self.__dditable.CommandBufferExp.pfnEnqueueExp) # call driver to get function pointers diff --git a/include/ur_api.h b/include/ur_api.h index 233fbc51f7..d9a65f4683 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -209,6 +209,8 @@ typedef enum ur_function_t { UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 192, ///< Enumerator for ::urCommandBufferAppendMemBufferFillExp UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP = 193, ///< Enumerator for ::urEnqueueCooperativeKernelLaunchExp UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP = 194, ///< Enumerator for ::urKernelSuggestMaxCooperativeGroupCountExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP = 195, ///< Enumerator for ::urCommandBufferAppendUSMPrefetchExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 196, ///< Enumerator for ::urCommandBufferAppendUSMAdviseExp /// @cond UR_FUNCTION_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -8159,6 +8161,73 @@ urCommandBufferAppendMemBufferFillExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command. ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM Prefetch command to a command-buffer object +/// +/// @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 == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_MIGRATION_FLAGS_MASK & flags` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMemory` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferAppendUSMPrefetchExp( + ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + 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. + ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command. +); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM Advise command to a command-buffer object +/// +/// @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 == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_ADVICE_FLAGS_MASK & advice` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMemory` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferAppendUSMAdviseExp( + ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command. +); + /////////////////////////////////////////////////////////////////////////////// /// @brief Submit a command-buffer for execution on a queue. /// @@ -10332,6 +10401,32 @@ typedef struct ur_command_buffer_append_mem_buffer_fill_exp_params_t { ur_exp_command_buffer_sync_point_t **ppSyncPoint; } ur_command_buffer_append_mem_buffer_fill_exp_params_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendUSMPrefetchExp +/// @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_append_usm_prefetch_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + void **ppMemory; + size_t *psize; + ur_usm_migration_flags_t *pflags; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; +} ur_command_buffer_append_usm_prefetch_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendUSMAdviseExp +/// @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_append_usm_advise_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + void **ppMemory; + size_t *psize; + ur_usm_advice_flags_t *padvice; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; +} 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; diff --git a/include/ur_ddi.h b/include/ur_ddi.h index ae5edf6371..bd8878aab9 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -1923,6 +1923,26 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferFillExp_t)( const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendUSMPrefetchExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMPrefetchExp_t)( + ur_exp_command_buffer_handle_t, + void *, + size_t, + ur_usm_migration_flags_t, + uint32_t, + const ur_exp_command_buffer_sync_point_t *, + ur_exp_command_buffer_sync_point_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendUSMAdviseExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMAdviseExp_t)( + ur_exp_command_buffer_handle_t, + void *, + size_t, + ur_usm_advice_flags_t, + ur_exp_command_buffer_sync_point_t *); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urCommandBufferEnqueueExp typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferEnqueueExp_t)( @@ -1949,6 +1969,8 @@ typedef struct ur_command_buffer_exp_dditable_t { ur_pfnCommandBufferAppendMemBufferWriteRectExp_t pfnAppendMemBufferWriteRectExp; ur_pfnCommandBufferAppendMemBufferReadRectExp_t pfnAppendMemBufferReadRectExp; ur_pfnCommandBufferAppendMemBufferFillExp_t pfnAppendMemBufferFillExp; + ur_pfnCommandBufferAppendUSMPrefetchExp_t pfnAppendUSMPrefetchExp; + ur_pfnCommandBufferAppendUSMAdviseExp_t pfnAppendUSMAdviseExp; ur_pfnCommandBufferEnqueueExp_t pfnEnqueueExp; } ur_command_buffer_exp_dditable_t; diff --git a/scripts/core/EXP-COMMAND-BUFFER.rst b/scripts/core/EXP-COMMAND-BUFFER.rst index 9617044432..d7c7f6cd13 100644 --- a/scripts/core/EXP-COMMAND-BUFFER.rst +++ b/scripts/core/EXP-COMMAND-BUFFER.rst @@ -101,6 +101,8 @@ Currently only the following commands are supported: * ${x}CommandBufferAppendMemBufferWriteExp * ${x}CommandBufferAppendMemBufferWriteRectExp * ${x}CommandBufferAppendMemBufferFillExp +* ${x}CommandBufferAppendUSMPrefetchExp +* ${x}CommandBufferAppendUSMAdviseExp It is planned to eventually support any command type from the Core API which can actually be appended to the equiavalent adapter native constructs. @@ -178,6 +180,8 @@ Enums * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP @@ -204,6 +208,8 @@ Functions * ${x}CommandBufferAppendMemBufferWriteExp * ${x}CommandBufferAppendMemBufferWriteRectExp * ${x}CommandBufferAppendMemBufferFillExp +* ${x}CommandBufferAppendUSMPrefetchExp +* ${x}CommandBufferAppendUSMAdviseExp * ${x}CommandBufferEnqueueExp Changelog @@ -218,6 +224,9 @@ Changelog +-----------+-------------------------------------------------------+ | 1.2 | Add function definitions for fill commands | +-----------+-------------------------------------------------------+ +| 1.2 | Add function definitions for Prefetch and Advise | +| | commands | ++-----------+-------------------------------------------------------+ Contributors -------------------------------------------------------------------------------- diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index 691bf56b86..553adcd9ce 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -588,6 +588,75 @@ returns: - $X_RESULT_ERROR_OUT_OF_RESOURCES --- #-------------------------------------------------------------------------- type: function +desc: "Append a USM Prefetch command to a command-buffer object" +class: $xCommandBuffer +name: AppendUSMPrefetchExp +params: + - type: $x_exp_command_buffer_handle_t + name: hCommandBuffer + desc: "[in] handle of the command-buffer object." + - type: "void*" + name: pMemory + desc: "[in] pointer to USM allocated memory to prefetch." + - type: "size_t" + name: size + desc: "[in] size in bytes to be fetched." + - type: $x_usm_migration_flags_t + name: flags + desc: "[in] USM prefetch flags" + - type: uint32_t + name: numSyncPointsInWaitList + desc: "[in] The number of sync points in the provided dependency list." + - type: "const $x_exp_command_buffer_sync_point_t*" + name: pSyncPointWaitList + desc: "[in][optional] A list of sync points that this command depends on." + - type: "$x_exp_command_buffer_sync_point_t*" + name: pSyncPoint + desc: "[out][optional] sync point associated with this command." +returns: + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP: + - "`pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0`" + - "`pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0`" + - $X_RESULT_ERROR_INVALID_MEM_OBJECT + - $X_RESULT_ERROR_INVALID_SIZE: + - "`size == 0`" + - "If `size` is higher than the allocation size of `pMemory`" + - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY + - $X_RESULT_ERROR_OUT_OF_RESOURCES +--- #-------------------------------------------------------------------------- +type: function +desc: "Append a USM Advise command to a command-buffer object" +class: $xCommandBuffer +name: AppendUSMAdviseExp +params: + - type: $x_exp_command_buffer_handle_t + name: hCommandBuffer + desc: "[in] handle of the command-buffer object." + - type: "void*" + name: pMemory + desc: "[in] pointer to the USM memory object." + - type: "size_t" + name: size + desc: "[in] size in bytes to be advised." + - type: $x_usm_advice_flags_t + name: advice + desc: "[in] USM memory advice" + - type: "$x_exp_command_buffer_sync_point_t*" + name: pSyncPoint + desc: "[out][optional] sync point associated with this command." +returns: + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP + - $X_RESULT_ERROR_INVALID_MEM_OBJECT + - $X_RESULT_ERROR_INVALID_SIZE: + - "`size == 0`" + - "If `size` is higher than the allocation size of `pMemory`" + - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY + - $X_RESULT_ERROR_OUT_OF_RESOURCES +--- #-------------------------------------------------------------------------- +type: function desc: "Submit a command-buffer for execution on a queue." class: $xCommandBuffer name: EnqueueExp diff --git a/scripts/core/registry.yml b/scripts/core/registry.yml index 4924e3e947..7952b145f5 100644 --- a/scripts/core/registry.yml +++ b/scripts/core/registry.yml @@ -541,6 +541,12 @@ etors: - name: KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP desc: Enumerator for $xKernelSuggestMaxCooperativeGroupCountExp value: '194' +- name: COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP + desc: Enumerator for $xCommandBufferAppendUSMPrefetchExp + value: '195' +- name: COMMAND_BUFFER_APPEND_USM_ADVISE_EXP + desc: Enumerator for $xCommandBufferAppendUSMAdviseExp + value: '196' --- type: enum desc: Defines structure types diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index ed0f00de41..8f668fa12c 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -4893,6 +4893,67 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + 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. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. + ) try { + ur_result_t result = UR_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnAppendUSMPrefetchExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendUSMPrefetchExp; + if (nullptr != pfnAppendUSMPrefetchExp) { + result = pfnAppendUSMPrefetchExp(hCommandBuffer, pMemory, size, flags, + numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMAdviseExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. + ) try { + ur_result_t result = UR_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnAppendUSMAdviseExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendUSMAdviseExp; + if (nullptr != pfnAppendUSMAdviseExp) { + result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice, + pSyncPoint); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -5302,6 +5363,12 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendMemBufferFillExp = driver::urCommandBufferAppendMemBufferFillExp; + pDdiTable->pfnAppendUSMPrefetchExp = + driver::urCommandBufferAppendUSMPrefetchExp; + + pDdiTable->pfnAppendUSMAdviseExp = + driver::urCommandBufferAppendUSMAdviseExp; + pDdiTable->pfnEnqueueExp = driver::urCommandBufferEnqueueExp; return result; diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 06c14ac835..8bf5293f61 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -1194,6 +1194,14 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP: os << "UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP"; break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP"; + break; default: os << "unknown enumerator"; break; @@ -11352,6 +11360,78 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct return os; } +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_usm_prefetch_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur_params::serializePtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".pMemory = "; + + ur_params::serializePtr(os, *(params->ppMemory)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".flags = "; + + ur_params::serializeFlag(os, *(params->pflags)); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".pSyncPoint = "; + + ur_params::serializePtr(os, *(params->ppSyncPoint)); + + return os; +} + +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_usm_advise_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur_params::serializePtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".pMemory = "; + + ur_params::serializePtr(os, *(params->ppMemory)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".advice = "; + + ur_params::serializeFlag(os, *(params->padvice)); + + os << ", "; + os << ".pSyncPoint = "; + + ur_params::serializePtr(os, *(params->ppSyncPoint)); + + return os; +} + inline std::ostream & operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_enqueue_exp_params_t @@ -15843,6 +15923,14 @@ inline int serializeFunctionParams(std::ostream &os, uint32_t function, os << (const struct ur_command_buffer_append_mem_buffer_fill_exp_params_t *)params; } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP: { + os << (const struct ur_command_buffer_append_usm_prefetch_exp_params_t + *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP: { + 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; diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index a79ef3cd10..c3c8a638d9 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -5656,6 +5656,85 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + 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. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendUSMPrefetchExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMPrefetchExp; + + if (nullptr == pfnAppendUSMPrefetchExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_command_buffer_append_usm_prefetch_exp_params_t params = { + &hCommandBuffer, + &pMemory, + &size, + &flags, + &numSyncPointsInWaitList, + &pSyncPointWaitList, + &pSyncPoint}; + uint64_t instance = + context.notify_begin(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP, + "urCommandBufferAppendUSMPrefetchExp", ¶ms); + + ur_result_t result = pfnAppendUSMPrefetchExp( + hCommandBuffer, pMemory, size, flags, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP, + "urCommandBufferAppendUSMPrefetchExp", ¶ms, &result, + instance); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMAdviseExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendUSMAdviseExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMAdviseExp; + + if (nullptr == pfnAppendUSMAdviseExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_command_buffer_append_usm_advise_exp_params_t params = { + &hCommandBuffer, &pMemory, &size, &advice, &pSyncPoint}; + uint64_t instance = + context.notify_begin(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP, + "urCommandBufferAppendUSMAdviseExp", ¶ms); + + ur_result_t result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, + advice, pSyncPoint); + + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP, + "urCommandBufferAppendUSMAdviseExp", ¶ms, &result, + instance); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -6168,6 +6247,14 @@ __urdlllocal ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendMemBufferFillExp = ur_tracing_layer::urCommandBufferAppendMemBufferFillExp; + dditable.pfnAppendUSMPrefetchExp = pDdiTable->pfnAppendUSMPrefetchExp; + pDdiTable->pfnAppendUSMPrefetchExp = + ur_tracing_layer::urCommandBufferAppendUSMPrefetchExp; + + dditable.pfnAppendUSMAdviseExp = pDdiTable->pfnAppendUSMAdviseExp; + pDdiTable->pfnAppendUSMAdviseExp = + ur_tracing_layer::urCommandBufferAppendUSMAdviseExp; + dditable.pfnEnqueueExp = pDdiTable->pfnEnqueueExp; pDdiTable->pfnEnqueueExp = ur_tracing_layer::urCommandBufferEnqueueExp; diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index aa708197b6..7d3a185efc 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -7099,6 +7099,103 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + 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. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendUSMPrefetchExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMPrefetchExp; + + if (nullptr == pfnAppendUSMPrefetchExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (context.enableParameterValidation) { + if (NULL == hCommandBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == pMemory) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (UR_USM_MIGRATION_FLAGS_MASK & flags) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + + if (pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0) { + return UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP; + } + + if (pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0) { + return UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP; + } + + if (size == 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + } + + ur_result_t result = pfnAppendUSMPrefetchExp( + hCommandBuffer, pMemory, size, flags, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMAdviseExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendUSMAdviseExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMAdviseExp; + + if (nullptr == pfnAppendUSMAdviseExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (context.enableParameterValidation) { + if (NULL == hCommandBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == pMemory) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (UR_USM_ADVICE_FLAGS_MASK & advice) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + + if (size == 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + } + + ur_result_t result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, + advice, pSyncPoint); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -7656,6 +7753,14 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendMemBufferFillExp = ur_validation_layer::urCommandBufferAppendMemBufferFillExp; + dditable.pfnAppendUSMPrefetchExp = pDdiTable->pfnAppendUSMPrefetchExp; + pDdiTable->pfnAppendUSMPrefetchExp = + ur_validation_layer::urCommandBufferAppendUSMPrefetchExp; + + dditable.pfnAppendUSMAdviseExp = pDdiTable->pfnAppendUSMAdviseExp; + pDdiTable->pfnAppendUSMAdviseExp = + ur_validation_layer::urCommandBufferAppendUSMAdviseExp; + dditable.pfnEnqueueExp = pDdiTable->pfnEnqueueExp; pDdiTable->pfnEnqueueExp = ur_validation_layer::urCommandBufferEnqueueExp; diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 06923cc062..da10512d08 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -6783,6 +6783,81 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + 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. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + ur_result_t result = UR_RESULT_SUCCESS; + + // extract platform's function pointer table + auto dditable = + reinterpret_cast(hCommandBuffer) + ->dditable; + auto pfnAppendUSMPrefetchExp = + dditable->ur.CommandBufferExp.pfnAppendUSMPrefetchExp; + if (nullptr == pfnAppendUSMPrefetchExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hCommandBuffer = + reinterpret_cast(hCommandBuffer) + ->handle; + + // forward to device-platform + result = pfnAppendUSMPrefetchExp(hCommandBuffer, pMemory, size, flags, + numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMAdviseExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + ur_result_t result = UR_RESULT_SUCCESS; + + // extract platform's function pointer table + auto dditable = + reinterpret_cast(hCommandBuffer) + ->dditable; + auto pfnAppendUSMAdviseExp = + dditable->ur.CommandBufferExp.pfnAppendUSMAdviseExp; + if (nullptr == pfnAppendUSMAdviseExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hCommandBuffer = + reinterpret_cast(hCommandBuffer) + ->handle; + + // forward to device-platform + result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice, + pSyncPoint); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -7326,6 +7401,10 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( ur_loader::urCommandBufferAppendMemBufferReadRectExp; pDdiTable->pfnAppendMemBufferFillExp = ur_loader::urCommandBufferAppendMemBufferFillExp; + pDdiTable->pfnAppendUSMPrefetchExp = + ur_loader::urCommandBufferAppendUSMPrefetchExp; + pDdiTable->pfnAppendUSMAdviseExp = + ur_loader::urCommandBufferAppendUSMAdviseExp; pDdiTable->pfnEnqueueExp = ur_loader::urCommandBufferEnqueueExp; } else { // return pointers directly to platform's DDIs diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index ee9135dd59..9775a3283d 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -7611,6 +7611,100 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM Prefetch command to a command-buffer object +/// +/// @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 == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_MIGRATION_FLAGS_MASK & flags` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMemory` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + 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. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. + ) try { + auto pfnAppendUSMPrefetchExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendUSMPrefetchExp; + if (nullptr == pfnAppendUSMPrefetchExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnAppendUSMPrefetchExp(hCommandBuffer, pMemory, size, flags, + numSyncPointsInWaitList, pSyncPointWaitList, + pSyncPoint); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM Advise command to a command-buffer object +/// +/// @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 == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_ADVICE_FLAGS_MASK & advice` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMemory` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. + ) try { + auto pfnAppendUSMAdviseExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendUSMAdviseExp; + if (nullptr == pfnAppendUSMAdviseExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice, + pSyncPoint); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Submit a command-buffer for execution on a queue. /// diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 7ecf3596db..4272c259ff 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -6424,6 +6424,83 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM Prefetch command to a command-buffer object +/// +/// @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 == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_MIGRATION_FLAGS_MASK & flags` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMemory` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + 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. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM Advise command to a command-buffer object +/// +/// @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 == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_ADVICE_FLAGS_MASK & advice` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMemory` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Submit a command-buffer for execution on a queue. /// From 57b452cf55d72c54aded750c83e87ecb8588882d Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 25 Sep 2023 09:22:19 +0100 Subject: [PATCH 2/7] Update scripts/core/EXP-COMMAND-BUFFER.rst Co-authored-by: Ewan Crawford --- scripts/core/EXP-COMMAND-BUFFER.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/core/EXP-COMMAND-BUFFER.rst b/scripts/core/EXP-COMMAND-BUFFER.rst index d7c7f6cd13..a6a32a66a1 100644 --- a/scripts/core/EXP-COMMAND-BUFFER.rst +++ b/scripts/core/EXP-COMMAND-BUFFER.rst @@ -224,7 +224,7 @@ Changelog +-----------+-------------------------------------------------------+ | 1.2 | Add function definitions for fill commands | +-----------+-------------------------------------------------------+ -| 1.2 | Add function definitions for Prefetch and Advise | +| 1.3 | Add function definitions for Prefetch and Advise | | | commands | +-----------+-------------------------------------------------------+ From 043b4d2705b2ca9a353c335ef5f47caeeda01bbf Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 25 Sep 2023 09:23:30 +0100 Subject: [PATCH 3/7] Update scripts/core/exp-command-buffer.yml Co-authored-by: Ewan Crawford --- scripts/core/exp-command-buffer.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index 553adcd9ce..cda58a1818 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -630,6 +630,9 @@ type: function desc: "Append a USM Advise command to a command-buffer object" class: $xCommandBuffer name: AppendUSMAdviseExp +details: + - "Not all memory advice hints may be supported for all devices or allocation types. + If a memory advice hint is not supported, it will be ignored." params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer From 267c89f4bcb974d70fa2648d0d1025e00a36e0c6 Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 25 Sep 2023 09:35:37 +0100 Subject: [PATCH 4/7] [SYCL][Graph] Adds a detail section in the comment of bith functions --- include/ur_api.h | 10 ++++++++++ scripts/core/exp-command-buffer.yml | 3 +++ source/loader/ur_libapi.cpp | 10 ++++++++++ source/ur_api.cpp | 10 ++++++++++ 4 files changed, 33 insertions(+) diff --git a/include/ur_api.h b/include/ur_api.h index d9a65f4683..26b96576c1 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -8164,6 +8164,11 @@ urCommandBufferAppendMemBufferFillExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Append a USM Prefetch command to a command-buffer object /// +/// @details +/// - Prefetching may not be supported for all devices or allocation types. +/// If memory prefetching is not supported, the prefetch hint will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED @@ -8200,6 +8205,11 @@ urCommandBufferAppendUSMPrefetchExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Append a USM Advise command to a command-buffer object /// +/// @details +/// - Not all memory advice hints may be supported for all devices or +/// allocation types. If a memory advice hint is not supported, it will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index cda58a1818..821ba88a61 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -591,6 +591,9 @@ type: function desc: "Append a USM Prefetch command to a command-buffer object" class: $xCommandBuffer name: AppendUSMPrefetchExp +details: + - "Prefetching may not be supported for all devices or allocation types. If memory prefetching + is not supported, the prefetch hint will be ignored." params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 9775a3283d..03542befdf 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -7614,6 +7614,11 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Append a USM Prefetch command to a command-buffer object /// +/// @details +/// - Prefetching may not be supported for all devices or allocation types. +/// If memory prefetching is not supported, the prefetch hint will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED @@ -7665,6 +7670,11 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Append a USM Advise command to a command-buffer object /// +/// @details +/// - Not all memory advice hints may be supported for all devices or +/// allocation types. If a memory advice hint is not supported, it will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 4272c259ff..ac284c24cc 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -6427,6 +6427,11 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Append a USM Prefetch command to a command-buffer object /// +/// @details +/// - Prefetching may not be supported for all devices or allocation types. +/// If memory prefetching is not supported, the prefetch hint will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED @@ -6469,6 +6474,11 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Append a USM Advise command to a command-buffer object /// +/// @details +/// - Not all memory advice hints may be supported for all devices or +/// allocation types. If a memory advice hint is not supported, it will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED From b12b606c35bb7469c1dfdf932e2917238635f02d Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 25 Sep 2023 11:42:18 +0100 Subject: [PATCH 5/7] [SYCL][Graph] Adds dependencies to the Advise function --- include/ur.py | 4 ++-- include/ur_api.h | 14 +++++++++----- include/ur_ddi.h | 2 ++ scripts/core/exp-command-buffer.yml | 6 ++++++ source/adapters/null/ur_nullddi.cpp | 7 ++++++- source/common/ur_params.hpp | 10 ++++++++++ source/loader/layers/tracing/ur_trcddi.cpp | 15 +++++++++++++-- source/loader/layers/validation/ur_valddi.cpp | 7 ++++++- source/loader/ur_ldrddi.cpp | 5 +++++ source/loader/ur_libapi.cpp | 5 +++++ source/ur_api.cpp | 4 ++++ 11 files changed, 68 insertions(+), 11 deletions(-) diff --git a/include/ur.py b/include/ur.py index 95582d636c..c3cb845e12 100644 --- a/include/ur.py +++ b/include/ur.py @@ -3628,9 +3628,9 @@ class ur_usm_exp_dditable_t(Structure): ############################################################################### ## @brief Function-pointer for urCommandBufferAppendUSMAdviseExp if __use_win_types: - _urCommandBufferAppendUSMAdviseExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendUSMAdviseExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) else: - _urCommandBufferAppendUSMAdviseExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendUSMAdviseExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) ############################################################################### ## @brief Function-pointer for urCommandBufferEnqueueExp diff --git a/include/ur_api.h b/include/ur_api.h index 26b96576c1..4b56a41dd3 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -8231,11 +8231,13 @@ urCommandBufferAppendUSMPrefetchExp( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( - ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. - size_t size, ///< [in] size in bytes to be advised. - ur_usm_advice_flags_t advice, ///< [in] USM memory advice - ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command. + ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + 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. + ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command. ); /////////////////////////////////////////////////////////////////////////////// @@ -10434,6 +10436,8 @@ typedef struct ur_command_buffer_append_usm_advise_exp_params_t { void **ppMemory; size_t *psize; ur_usm_advice_flags_t *padvice; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; ur_exp_command_buffer_sync_point_t **ppSyncPoint; } ur_command_buffer_append_usm_advise_exp_params_t; diff --git a/include/ur_ddi.h b/include/ur_ddi.h index bd8878aab9..5638ad48cc 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -1941,6 +1941,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMAdviseExp_t)( void *, size_t, ur_usm_advice_flags_t, + uint32_t, + const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index 821ba88a61..150656ca8a 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -649,6 +649,12 @@ params: - type: $x_usm_advice_flags_t name: advice desc: "[in] USM memory advice" + - type: uint32_t + name: numSyncPointsInWaitList + desc: "[in] The number of sync points in the provided dependency list." + - type: "const $x_exp_command_buffer_sync_point_t*" + name: pSyncPointWaitList + desc: "[in][optional] A list of sync points that this command depends on." - type: "$x_exp_command_buffer_sync_point_t*" name: pSyncPoint desc: "[out][optional] sync point associated with this command." diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index 8f668fa12c..0b95f49e08 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -4934,6 +4934,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( void *pMemory, ///< [in] pointer to the USM memory object. 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. ur_exp_command_buffer_sync_point_t * pSyncPoint ///< [out][optional] sync point associated with this command. ) try { @@ -4944,7 +4948,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( d_context.urDdiTable.CommandBufferExp.pfnAppendUSMAdviseExp; if (nullptr != pfnAppendUSMAdviseExp) { result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice, - pSyncPoint); + numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); } else { // generic implementation } diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 8bf5293f61..572922693d 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -11424,6 +11424,16 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct ur_params::serializeFlag(os, *(params->padvice)); + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + os << ", "; os << ".pSyncPoint = "; diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index c3c8a638d9..d5d7ab7c73 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -5709,6 +5709,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( void *pMemory, ///< [in] pointer to the USM memory object. 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. ur_exp_command_buffer_sync_point_t * pSyncPoint ///< [out][optional] sync point associated with this command. ) { @@ -5720,13 +5724,20 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( } ur_command_buffer_append_usm_advise_exp_params_t params = { - &hCommandBuffer, &pMemory, &size, &advice, &pSyncPoint}; + &hCommandBuffer, + &pMemory, + &size, + &advice, + &numSyncPointsInWaitList, + &pSyncPointWaitList, + &pSyncPoint}; uint64_t instance = context.notify_begin(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP, "urCommandBufferAppendUSMAdviseExp", ¶ms); ur_result_t result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, - advice, pSyncPoint); + advice, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP, "urCommandBufferAppendUSMAdviseExp", ¶ms, &result, diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 7d3a185efc..c0e41121f7 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -7162,6 +7162,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( void *pMemory, ///< [in] pointer to the USM memory object. 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. ur_exp_command_buffer_sync_point_t * pSyncPoint ///< [out][optional] sync point associated with this command. ) { @@ -7191,7 +7195,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( } ur_result_t result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, - advice, pSyncPoint); + advice, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); return result; } diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index da10512d08..34d02e66ee 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -6831,6 +6831,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( void *pMemory, ///< [in] pointer to the USM memory object. 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. ur_exp_command_buffer_sync_point_t * pSyncPoint ///< [out][optional] sync point associated with this command. ) { @@ -6853,6 +6857,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( // forward to device-platform result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); return result; diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 03542befdf..665b0410de 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -7700,6 +7700,10 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( void *pMemory, ///< [in] pointer to the USM memory object. 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. ur_exp_command_buffer_sync_point_t * pSyncPoint ///< [out][optional] sync point associated with this command. ) try { @@ -7710,6 +7714,7 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( } return pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } catch (...) { return exceptionToResult(std::current_exception()); diff --git a/source/ur_api.cpp b/source/ur_api.cpp index ac284c24cc..0a63ded4dd 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -6504,6 +6504,10 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( void *pMemory, ///< [in] pointer to the USM memory object. 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. ur_exp_command_buffer_sync_point_t * pSyncPoint ///< [out][optional] sync point associated with this command. ) { From 78639a22e5ad40e32ec1444313fc03b4d1b6f675 Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 25 Sep 2023 12:48:56 +0100 Subject: [PATCH 6/7] [SYCL][Graph] Defines dest mem pointer as a const pointer --- include/ur_api.h | 8 ++++---- include/ur_ddi.h | 4 ++-- scripts/core/exp-command-buffer.yml | 4 ++-- source/adapters/null/ur_nullddi.cpp | 8 ++++---- source/loader/layers/tracing/ur_trcddi.cpp | 8 ++++---- source/loader/layers/validation/ur_valddi.cpp | 8 ++++---- source/loader/ur_ldrddi.cpp | 8 ++++---- source/loader/ur_libapi.cpp | 8 ++++---- source/ur_api.cpp | 8 ++++---- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/include/ur_api.h b/include/ur_api.h index 4b56a41dd3..736d102237 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -8194,7 +8194,7 @@ urCommandBufferAppendMemBufferFillExp( UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + const void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. 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. @@ -8232,7 +8232,7 @@ urCommandBufferAppendUSMPrefetchExp( UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. + const void *pMemory, ///< [in] pointer to the USM memory object. 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. @@ -10419,7 +10419,7 @@ typedef struct ur_command_buffer_append_mem_buffer_fill_exp_params_t { /// allowing the callback the ability to modify the parameter's value typedef struct ur_command_buffer_append_usm_prefetch_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; - void **ppMemory; + const void **ppMemory; size_t *psize; ur_usm_migration_flags_t *pflags; uint32_t *pnumSyncPointsInWaitList; @@ -10433,7 +10433,7 @@ typedef struct ur_command_buffer_append_usm_prefetch_exp_params_t { /// allowing the callback the ability to modify the parameter's value typedef struct ur_command_buffer_append_usm_advise_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; - void **ppMemory; + const void **ppMemory; size_t *psize; ur_usm_advice_flags_t *padvice; uint32_t *pnumSyncPointsInWaitList; diff --git a/include/ur_ddi.h b/include/ur_ddi.h index 5638ad48cc..246ffc200d 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -1927,7 +1927,7 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferFillExp_t)( /// @brief Function-pointer for urCommandBufferAppendUSMPrefetchExp typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMPrefetchExp_t)( ur_exp_command_buffer_handle_t, - void *, + const void *, size_t, ur_usm_migration_flags_t, uint32_t, @@ -1938,7 +1938,7 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMPrefetchExp_t)( /// @brief Function-pointer for urCommandBufferAppendUSMAdviseExp typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMAdviseExp_t)( ur_exp_command_buffer_handle_t, - void *, + const void *, size_t, ur_usm_advice_flags_t, uint32_t, diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index 150656ca8a..50d6dd6bd3 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -598,7 +598,7 @@ params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer desc: "[in] handle of the command-buffer object." - - type: "void*" + - type: "const void*" name: pMemory desc: "[in] pointer to USM allocated memory to prefetch." - type: "size_t" @@ -640,7 +640,7 @@ params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer desc: "[in] handle of the command-buffer object." - - type: "void*" + - type: "const void*" name: pMemory desc: "[in] pointer to the USM memory object." - type: "size_t" diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index 0b95f49e08..a8a4883aa1 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -4897,9 +4897,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_exp_command_buffer_handle_t - hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. - size_t size, ///< [in] size in bytes to be fetched. + hCommandBuffer, ///< [in] handle of the command-buffer object. + const void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + 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. @@ -4931,7 +4931,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. + const void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice uint32_t diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index d5d7ab7c73..018d245da3 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -5660,9 +5660,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_exp_command_buffer_handle_t - hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. - size_t size, ///< [in] size in bytes to be fetched. + hCommandBuffer, ///< [in] handle of the command-buffer object. + const void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + 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. @@ -5706,7 +5706,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. + const void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice uint32_t diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index c0e41121f7..cc898a5fe5 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -7103,9 +7103,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_exp_command_buffer_handle_t - hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. - size_t size, ///< [in] size in bytes to be fetched. + hCommandBuffer, ///< [in] handle of the command-buffer object. + const void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + 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. @@ -7159,7 +7159,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. + const void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice uint32_t diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 34d02e66ee..54c8f9b4c1 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -6787,9 +6787,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_exp_command_buffer_handle_t - hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. - size_t size, ///< [in] size in bytes to be fetched. + hCommandBuffer, ///< [in] handle of the command-buffer object. + const void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + 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. @@ -6828,7 +6828,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. + const void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice uint32_t diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 665b0410de..4e434aac18 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -7643,9 +7643,9 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_exp_command_buffer_handle_t - hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. - size_t size, ///< [in] size in bytes to be fetched. + hCommandBuffer, ///< [in] handle of the command-buffer object. + const void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + 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. @@ -7697,7 +7697,7 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. + const void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice uint32_t diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 0a63ded4dd..bf9a65ac30 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -6456,9 +6456,9 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_exp_command_buffer_handle_t - hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. - size_t size, ///< [in] size in bytes to be fetched. + hCommandBuffer, ///< [in] handle of the command-buffer object. + const void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + 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. @@ -6501,7 +6501,7 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. + const void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice uint32_t From 12b734169ad2b306abed605c9433ba3e941787de Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 25 Sep 2023 18:09:38 +0100 Subject: [PATCH 7/7] Updates error conditions for USM advise --- include/ur_api.h | 3 +++ scripts/core/exp-command-buffer.yml | 3 +++ source/loader/layers/validation/ur_valddi.cpp | 8 ++++++++ source/loader/ur_libapi.cpp | 3 +++ source/ur_api.cpp | 3 +++ 5 files changed, 20 insertions(+) diff --git a/include/ur_api.h b/include/ur_api.h index 736d102237..81884a7680 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -8223,6 +8223,9 @@ urCommandBufferAppendUSMPrefetchExp( /// + `::UR_USM_ADVICE_FLAGS_MASK & advice` /// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP /// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `size == 0` diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index 50d6dd6bd3..7d1b686aab 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -661,6 +661,9 @@ params: returns: - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP: + - "`pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0`" + - "`pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0`" - $X_RESULT_ERROR_INVALID_MEM_OBJECT - $X_RESULT_ERROR_INVALID_SIZE: - "`size == 0`" diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index cc898a5fe5..43b6902832 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -7189,6 +7189,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( return UR_RESULT_ERROR_INVALID_ENUMERATION; } + if (pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0) { + return UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP; + } + + if (pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0) { + return UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP; + } + if (size == 0) { return UR_RESULT_ERROR_INVALID_SIZE; } diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 4e434aac18..d86d9606fa 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -7688,6 +7688,9 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( /// + `::UR_USM_ADVICE_FLAGS_MASK & advice` /// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP /// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `size == 0` diff --git a/source/ur_api.cpp b/source/ur_api.cpp index bf9a65ac30..6f3d0c74a7 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -6492,6 +6492,9 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( /// + `::UR_USM_ADVICE_FLAGS_MASK & advice` /// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP /// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `size == 0`