From 90190185ee30c45f972c601149ddeafe983f16f2 Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Tue, 20 Jun 2023 14:41:25 +0100 Subject: [PATCH] [EXP][CMD-BUFFER] Command-buffer additional function definitions for buffer read and write --- include/ur.py | 40 +++ include/ur_api.h | 224 +++++++++++++++ include/ur_ddi.h | 62 ++++ scripts/core/EXP-COMMAND-BUFFER.rst | 27 +- scripts/core/exp-command-buffer.yml | 186 ++++++++++++ scripts/core/registry.yml | 12 + source/adapters/null/ur_nullddi.cpp | 177 ++++++++++++ source/common/ur_params.hpp | 271 ++++++++++++++++++ source/loader/layers/tracing/ur_trcddi.cpp | 247 ++++++++++++++++ source/loader/layers/validation/ur_valddi.cpp | 255 ++++++++++++++++ source/loader/ur_ldrddi.cpp | 213 ++++++++++++++ source/loader/ur_libapi.cpp | 226 +++++++++++++++ source/ur_api.cpp | 186 ++++++++++++ 13 files changed, 2120 insertions(+), 6 deletions(-) diff --git a/include/ur.py b/include/ur.py index fcee6474e2..229cd870af 100644 --- a/include/ur.py +++ b/include/ur.py @@ -1981,6 +1981,10 @@ class ur_function_v(IntEnum): USM_P2P_ENABLE_PEER_ACCESS_EXP = 165 ## Enumerator for ::urUsmP2PEnablePeerAccessExp USM_P2P_DISABLE_PEER_ACCESS_EXP = 166 ## Enumerator for ::urUsmP2PDisablePeerAccessExp USM_P2P_PEER_ACCESS_GET_INFO_EXP = 167 ## Enumerator for ::urUsmP2PPeerAccessGetInfoExp + COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP = 168 ## Enumerator for ::urCommandBufferAppendMembufferWriteExp + COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP = 169 ## Enumerator for ::urCommandBufferAppendMembufferReadExp + COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP = 170## Enumerator for ::urCommandBufferAppendMembufferWriteRectExp + COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP = 171 ## Enumerator for ::urCommandBufferAppendMembufferReadRectExp class ur_function_t(c_int): def __str__(self): @@ -3289,6 +3293,20 @@ class ur_usm_exp_dditable_t(Structure): else: _urCommandBufferAppendMembufferCopyExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, 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 urCommandBufferAppendMembufferWriteExp +if __use_win_types: + _urCommandBufferAppendMembufferWriteExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) +else: + _urCommandBufferAppendMembufferWriteExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + +############################################################################### +## @brief Function-pointer for urCommandBufferAppendMembufferReadExp +if __use_win_types: + _urCommandBufferAppendMembufferReadExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) +else: + _urCommandBufferAppendMembufferReadExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + ############################################################################### ## @brief Function-pointer for urCommandBufferAppendMembufferCopyRectExp if __use_win_types: @@ -3296,6 +3314,20 @@ class ur_usm_exp_dditable_t(Structure): else: _urCommandBufferAppendMembufferCopyRectExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, 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 urCommandBufferAppendMembufferWriteRectExp +if __use_win_types: + _urCommandBufferAppendMembufferWriteRectExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) +else: + _urCommandBufferAppendMembufferWriteRectExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + +############################################################################### +## @brief Function-pointer for urCommandBufferAppendMembufferReadRectExp +if __use_win_types: + _urCommandBufferAppendMembufferReadRectExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) +else: + _urCommandBufferAppendMembufferReadRectExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + ############################################################################### ## @brief Function-pointer for urCommandBufferEnqueueExp if __use_win_types: @@ -3315,7 +3347,11 @@ class ur_command_buffer_exp_dditable_t(Structure): ("pfnAppendKernelLaunchExp", c_void_p), ## _urCommandBufferAppendKernelLaunchExp_t ("pfnAppendMemcpyUSMExp", c_void_p), ## _urCommandBufferAppendMemcpyUSMExp_t ("pfnAppendMembufferCopyExp", c_void_p), ## _urCommandBufferAppendMembufferCopyExp_t + ("pfnAppendMembufferWriteExp", c_void_p), ## _urCommandBufferAppendMembufferWriteExp_t + ("pfnAppendMembufferReadExp", c_void_p), ## _urCommandBufferAppendMembufferReadExp_t ("pfnAppendMembufferCopyRectExp", c_void_p), ## _urCommandBufferAppendMembufferCopyRectExp_t + ("pfnAppendMembufferWriteRectExp", c_void_p), ## _urCommandBufferAppendMembufferWriteRectExp_t + ("pfnAppendMembufferReadRectExp", c_void_p), ## _urCommandBufferAppendMembufferReadRectExp_t ("pfnEnqueueExp", c_void_p) ## _urCommandBufferEnqueueExp_t ] @@ -3817,7 +3853,11 @@ def __init__(self, version : ur_api_version_t): self.urCommandBufferAppendKernelLaunchExp = _urCommandBufferAppendKernelLaunchExp_t(self.__dditable.CommandBufferExp.pfnAppendKernelLaunchExp) self.urCommandBufferAppendMemcpyUSMExp = _urCommandBufferAppendMemcpyUSMExp_t(self.__dditable.CommandBufferExp.pfnAppendMemcpyUSMExp) self.urCommandBufferAppendMembufferCopyExp = _urCommandBufferAppendMembufferCopyExp_t(self.__dditable.CommandBufferExp.pfnAppendMembufferCopyExp) + self.urCommandBufferAppendMembufferWriteExp = _urCommandBufferAppendMembufferWriteExp_t(self.__dditable.CommandBufferExp.pfnAppendMembufferWriteExp) + self.urCommandBufferAppendMembufferReadExp = _urCommandBufferAppendMembufferReadExp_t(self.__dditable.CommandBufferExp.pfnAppendMembufferReadExp) self.urCommandBufferAppendMembufferCopyRectExp = _urCommandBufferAppendMembufferCopyRectExp_t(self.__dditable.CommandBufferExp.pfnAppendMembufferCopyRectExp) + self.urCommandBufferAppendMembufferWriteRectExp = _urCommandBufferAppendMembufferWriteRectExp_t(self.__dditable.CommandBufferExp.pfnAppendMembufferWriteRectExp) + self.urCommandBufferAppendMembufferReadRectExp = _urCommandBufferAppendMembufferReadRectExp_t(self.__dditable.CommandBufferExp.pfnAppendMembufferReadRectExp) 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 309a309627..cb47830b47 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -5277,6 +5277,10 @@ typedef enum ur_function_t { UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP = 165, ///< Enumerator for ::urUsmP2PEnablePeerAccessExp UR_FUNCTION_USM_P2P_DISABLE_PEER_ACCESS_EXP = 166, ///< Enumerator for ::urUsmP2PDisablePeerAccessExp UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP = 167, ///< Enumerator for ::urUsmP2PPeerAccessGetInfoExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP = 168, ///< Enumerator for ::urCommandBufferAppendMembufferWriteExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP = 169, ///< Enumerator for ::urCommandBufferAppendMembufferReadExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP = 170, ///< Enumerator for ::urCommandBufferAppendMembufferWriteRectExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP = 171, ///< Enumerator for ::urCommandBufferAppendMembufferReadRectExp /// @cond UR_FUNCTION_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -7322,6 +7326,72 @@ urCommandBufferAppendMembufferCopyExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory write 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` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pSrc` +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferAppendMembufferWriteExp( + ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + size_t offset, ///< [in] offset in bytes in the buffer object. + 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. + ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command +); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory read 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` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDst` +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferAppendMembufferReadExp( + ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + size_t offset, ///< [in] offset in bytes in the buffer object. + 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. + ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command +); + /////////////////////////////////////////////////////////////////////////////// /// @brief Append a rectangular memory copy command to a command-buffer object /// @@ -7359,6 +7429,87 @@ urCommandBufferAppendMembufferCopyRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a rectangular memory write 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` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pSrc` +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferAppendMembufferWriteRectExp( + ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. + ur_rect_offset_t hostOffset, ///< [in] 3D offset in the host region. + ur_rect_region_t region, ///< [in] 3D rectangular region descriptor: width, height, depth. + size_t bufferRowPitch, ///< [in] length of each row in bytes in the buffer object. + size_t bufferSlicePitch, ///< [in] length of each 2D slice in bytes in the buffer object being + ///< written. + size_t hostRowPitch, ///< [in] length of each row in bytes in the host memory region pointed to + ///< by pSrc. + size_t hostSlicePitch, ///< [in] length of each 2D slice in bytes in the host memory region + ///< 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. + ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command +); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a rectangular memory read 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` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDst` +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferAppendMembufferReadRectExp( + ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. + ur_rect_offset_t hostOffset, ///< [in] 3D offset in the host region. + ur_rect_region_t region, ///< [in] 3D rectangular region descriptor: width, height, depth. + size_t bufferRowPitch, ///< [in] length of each row in bytes in the buffer object. + size_t bufferSlicePitch, ///< [in] length of each 2D slice in bytes in the buffer object being read. + size_t hostRowPitch, ///< [in] length of each row in bytes in the host memory region pointed to + ///< by pDst. + size_t hostSlicePitch, ///< [in] length of each 2D slice in bytes in the host memory region + ///< 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. + 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. /// @@ -7494,6 +7645,7 @@ typedef enum ur_exp_peer_info_t { /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED /// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == commandDevice` /// + `NULL == peerDevice` @@ -7535,6 +7687,7 @@ urUsmP2PEnablePeerAccessExp( /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED /// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == commandDevice` /// + `NULL == peerDevice` @@ -7561,6 +7714,7 @@ urUsmP2PDisablePeerAccessExp( /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED /// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == commandDevice` /// + `NULL == peerDevice` @@ -9192,6 +9346,36 @@ typedef struct ur_command_buffer_append_membuffer_copy_exp_params_t { ur_exp_command_buffer_sync_point_t **ppSyncPoint; } ur_command_buffer_append_membuffer_copy_exp_params_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendMembufferWriteExp +/// @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_membuffer_write_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_mem_handle_t *phBuffer; + size_t *poffset; + size_t *psize; + const void **ppSrc; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; +} ur_command_buffer_append_membuffer_write_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendMembufferReadExp +/// @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_membuffer_read_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_mem_handle_t *phBuffer; + size_t *poffset; + size_t *psize; + void **ppDst; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; +} ur_command_buffer_append_membuffer_read_exp_params_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urCommandBufferAppendMembufferCopyRectExp /// @details Each entry is a pointer to the parameter passed to the function; @@ -9212,6 +9396,46 @@ typedef struct ur_command_buffer_append_membuffer_copy_rect_exp_params_t { ur_exp_command_buffer_sync_point_t **ppSyncPoint; } ur_command_buffer_append_membuffer_copy_rect_exp_params_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendMembufferWriteRectExp +/// @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_membuffer_write_rect_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_mem_handle_t *phBuffer; + ur_rect_offset_t *pbufferOffset; + ur_rect_offset_t *phostOffset; + ur_rect_region_t *pregion; + size_t *pbufferRowPitch; + size_t *pbufferSlicePitch; + size_t *phostRowPitch; + size_t *phostSlicePitch; + void **ppSrc; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; +} ur_command_buffer_append_membuffer_write_rect_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendMembufferReadRectExp +/// @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_membuffer_read_rect_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_mem_handle_t *phBuffer; + ur_rect_offset_t *pbufferOffset; + ur_rect_offset_t *phostOffset; + ur_rect_region_t *pregion; + size_t *pbufferRowPitch; + size_t *pbufferSlicePitch; + size_t *phostRowPitch; + size_t *phostSlicePitch; + void **ppDst; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; +} ur_command_buffer_append_membuffer_read_rect_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 795edc605b..6ba809041e 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -1670,6 +1670,30 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferCopyExp_t)( const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMembufferWriteExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferWriteExp_t)( + ur_exp_command_buffer_handle_t, + ur_mem_handle_t, + size_t, + size_t, + const void *, + uint32_t, + const ur_exp_command_buffer_sync_point_t *, + ur_exp_command_buffer_sync_point_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMembufferReadExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferReadExp_t)( + ur_exp_command_buffer_handle_t, + ur_mem_handle_t, + size_t, + size_t, + void *, + uint32_t, + const ur_exp_command_buffer_sync_point_t *, + ur_exp_command_buffer_sync_point_t *); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urCommandBufferAppendMembufferCopyRectExp typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferCopyRectExp_t)( @@ -1687,6 +1711,40 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferCopyRectExp_t) const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMembufferWriteRectExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferWriteRectExp_t)( + ur_exp_command_buffer_handle_t, + ur_mem_handle_t, + ur_rect_offset_t, + ur_rect_offset_t, + ur_rect_region_t, + size_t, + size_t, + size_t, + size_t, + void *, + uint32_t, + const ur_exp_command_buffer_sync_point_t *, + ur_exp_command_buffer_sync_point_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMembufferReadRectExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferReadRectExp_t)( + ur_exp_command_buffer_handle_t, + ur_mem_handle_t, + ur_rect_offset_t, + ur_rect_offset_t, + ur_rect_region_t, + size_t, + size_t, + size_t, + size_t, + void *, + uint32_t, + const ur_exp_command_buffer_sync_point_t *, + ur_exp_command_buffer_sync_point_t *); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urCommandBufferEnqueueExp typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferEnqueueExp_t)( @@ -1706,7 +1764,11 @@ typedef struct ur_command_buffer_exp_dditable_t { ur_pfnCommandBufferAppendKernelLaunchExp_t pfnAppendKernelLaunchExp; ur_pfnCommandBufferAppendMemcpyUSMExp_t pfnAppendMemcpyUSMExp; ur_pfnCommandBufferAppendMembufferCopyExp_t pfnAppendMembufferCopyExp; + ur_pfnCommandBufferAppendMembufferWriteExp_t pfnAppendMembufferWriteExp; + ur_pfnCommandBufferAppendMembufferReadExp_t pfnAppendMembufferReadExp; ur_pfnCommandBufferAppendMembufferCopyRectExp_t pfnAppendMembufferCopyRectExp; + ur_pfnCommandBufferAppendMembufferWriteRectExp_t pfnAppendMembufferWriteRectExp; + ur_pfnCommandBufferAppendMembufferReadRectExp_t pfnAppendMembufferReadRectExp; 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 2f61388339..46aa160630 100644 --- a/scripts/core/EXP-COMMAND-BUFFER.rst +++ b/scripts/core/EXP-COMMAND-BUFFER.rst @@ -94,7 +94,11 @@ Currently only the following commands are supported: * ${x}CommandBufferAppendMemcpyUSMExp * ${x}CommandBufferAppendMembufferCopyExp * ${x}CommandBufferAppendMembufferCopyRectExp - +* ${x}CommandBufferAppendMembufferReadExp +* ${x}CommandBufferAppendMembufferReadRectExp +* ${x}CommandBufferAppendMembufferWriteExp +* ${x}CommandBufferAppendMembufferWriteRectExp + It is planned to eventually support any command type from the Core API which can actually be appended to the equiavalent adapter native constructs. @@ -161,6 +165,11 @@ Enums * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP + Types @@ -180,19 +189,25 @@ Functions * ${x}CommandBufferAppendMemcpyUSMExp * ${x}CommandBufferAppendMembufferCopyExp * ${x}CommandBufferAppendMembufferCopyRectExp +* ${x}CommandBufferAppendMembufferReadExp +* ${x}CommandBufferAppendMembufferReadRectExp +* ${x}CommandBufferAppendMembufferWriteExp +* ${x}CommandBufferAppendMembufferWriteRectExp * ${x}CommandBufferEnqueueExp Changelog -------------------------------------------------------------------------------- -+-----------+------------------------+ -| Revision | Changes | -+===========+========================+ -| 1.0 | Initial Draft | -+-----------+------------------------+ ++-----------+-------------------------------------------------------+ +| Revision | Changes | ++===========+=======================================================+ +| 1.0 | Initial Draft | +| 1.1 | add function definitions for buffer read and write | ++-----------+-------------------------------------------------------+ Contributors -------------------------------------------------------------------------------- * Ben Tracy `ben.tracy@codeplay.com `_ * Ewan Crawford `ewan@codeplay.com `_ +* Maxime France-Pillois `maxime.francepillois@codeplay.com `_ diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index 0ad073bfcc..e8c5417831 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -259,6 +259,84 @@ returns: - $X_RESULT_ERROR_OUT_OF_RESOURCES --- #-------------------------------------------------------------------------- type: function +desc: "Append a memory write command to a command-buffer object" +class: $xCommandBuffer +name: AppendMembufferWriteExp +params: + - type: $x_exp_command_buffer_handle_t + name: hCommandBuffer + desc: "[in] handle of the command-buffer object." + - type: $x_mem_handle_t + name: hBuffer + desc: "[in] handle of the buffer object." + - type: "size_t" + name: offset + desc: "[in] offset in bytes in the buffer object." + - type: "size_t" + name: size + desc: "[in] size in bytes of data being written." + - type: "const void*" + name: pSrc + desc: "[in] pointer to host memory where data is to be written from." + - 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_OUT_OF_HOST_MEMORY + - $X_RESULT_ERROR_OUT_OF_RESOURCES +--- #-------------------------------------------------------------------------- +type: function +desc: "Append a memory read command to a command-buffer object" +class: $xCommandBuffer +name: AppendMembufferReadExp +params: + - type: $x_exp_command_buffer_handle_t + name: hCommandBuffer + desc: "[in] handle of the command-buffer object." + - type: $x_mem_handle_t + name: hBuffer + desc: "[in] handle of the buffer object." + - type: "size_t" + name: offset + desc: "[in] offset in bytes in the buffer object." + - type: "size_t" + name: size + desc: "[in] size in bytes of data being written." + - type: "void*" + name: pDst + desc: "[in] pointer to host memory where data is to be written to." + - 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_OUT_OF_HOST_MEMORY + - $X_RESULT_ERROR_OUT_OF_RESOURCES +--- #-------------------------------------------------------------------------- +type: function desc: "Append a rectangular memory copy command to a command-buffer object" class: $xCommandBuffer name: AppendMembufferCopyRectExp @@ -313,6 +391,114 @@ returns: - $X_RESULT_ERROR_OUT_OF_RESOURCES --- #-------------------------------------------------------------------------- type: function +desc: "Append a rectangular memory write command to a command-buffer object" +class: $xCommandBuffer +name: AppendMembufferWriteRectExp +params: + - type: $x_exp_command_buffer_handle_t + name: hCommandBuffer + desc: "[in] handle of the command-buffer object." + - type: $x_mem_handle_t + name: hBuffer + desc: "[in] handle of the buffer object." + - type: $x_rect_offset_t + name: bufferOffset + desc: "[in] 3D offset in the buffer." + - type: $x_rect_offset_t + name: hostOffset + desc: "[in] 3D offset in the host region." + - type: $x_rect_region_t + name: region + desc: "[in] 3D rectangular region descriptor: width, height, depth." + - type: "size_t" + name: bufferRowPitch + desc: "[in] length of each row in bytes in the buffer object." + - type: "size_t" + name: bufferSlicePitch + desc: "[in] length of each 2D slice in bytes in the buffer object being written." + - type: "size_t" + name: hostRowPitch + desc: "[in] length of each row in bytes in the host memory region pointed to by pSrc." + - type: "size_t" + name: hostSlicePitch + desc: "[in] length of each 2D slice in bytes in the host memory region pointed to by pSrc." + - type: "void*" + name: pSrc + desc: "[in] pointer to host memory where data is to be written from." + - 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_OUT_OF_HOST_MEMORY + - $X_RESULT_ERROR_OUT_OF_RESOURCES +--- #-------------------------------------------------------------------------- +type: function +desc: "Append a rectangular memory read command to a command-buffer object" +class: $xCommandBuffer +name: AppendMembufferReadRectExp +params: + - type: $x_exp_command_buffer_handle_t + name: hCommandBuffer + desc: "[in] handle of the command-buffer object." + - type: $x_mem_handle_t + name: hBuffer + desc: "[in] handle of the buffer object." + - type: $x_rect_offset_t + name: bufferOffset + desc: "[in] 3D offset in the buffer." + - type: $x_rect_offset_t + name: hostOffset + desc: "[in] 3D offset in the host region." + - type: $x_rect_region_t + name: region + desc: "[in] 3D rectangular region descriptor: width, height, depth." + - type: "size_t" + name: bufferRowPitch + desc: "[in] length of each row in bytes in the buffer object." + - type: "size_t" + name: bufferSlicePitch + desc: "[in] length of each 2D slice in bytes in the buffer object being read." + - type: "size_t" + name: hostRowPitch + desc: "[in] length of each row in bytes in the host memory region pointed to by pDst." + - type: "size_t" + name: hostSlicePitch + desc: "[in] length of each 2D slice in bytes in the host memory region pointed to by pDst." + - type: "void*" + name: pDst + desc: "[in] pointer to host memory where data is to be read into." + - 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_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 0aa2703187..e29203afdc 100644 --- a/scripts/core/registry.yml +++ b/scripts/core/registry.yml @@ -490,3 +490,15 @@ etors: - name: USM_P2P_PEER_ACCESS_GET_INFO_EXP desc: Enumerator for $xUsmP2PPeerAccessGetInfoExp value: '167' +- name: COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP + desc: Enumerator for $xCommandBufferAppendMembufferWriteExp + value: '168' +- name: COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP + desc: Enumerator for $xCommandBufferAppendMembufferReadExp + value: '169' +- name: COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP + desc: Enumerator for $xCommandBufferAppendMembufferWriteRectExp + value: '170' +- name: COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP + desc: Enumerator for $xCommandBufferAppendMembufferReadRectExp + value: '171' diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index a029e4ff1e..9b3dddd191 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -4493,6 +4493,75 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferWriteExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + size_t offset, ///< [in] offset in bytes in the buffer object. + 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. + 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 pfnAppendMembufferWriteExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteExp; + if (nullptr != pfnAppendMembufferWriteExp) { + result = pfnAppendMembufferWriteExp(hCommandBuffer, hBuffer, offset, + size, pSrc, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferReadExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + size_t offset, ///< [in] offset in bytes in the buffer object. + 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. + 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 pfnAppendMembufferReadExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadExp; + if (nullptr != pfnAppendMembufferReadExp) { + result = pfnAppendMembufferReadExp(hCommandBuffer, hBuffer, offset, + size, pDst, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferAppendMembufferCopyRectExp __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( @@ -4536,6 +4605,102 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferWriteRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. + ur_rect_offset_t hostOffset, ///< [in] 3D offset in the host region. + ur_rect_region_t + region, ///< [in] 3D rectangular region descriptor: width, height, depth. + size_t + bufferRowPitch, ///< [in] length of each row in bytes in the buffer object. + size_t + bufferSlicePitch, ///< [in] length of each 2D slice in bytes in the buffer object being + ///< written. + size_t + hostRowPitch, ///< [in] length of each row in bytes in the host memory region pointed to + ///< by pSrc. + size_t + hostSlicePitch, ///< [in] length of each 2D slice in bytes in the host memory region + ///< 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. + 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 pfnAppendMembufferWriteRectExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteRectExp; + if (nullptr != pfnAppendMembufferWriteRectExp) { + result = pfnAppendMembufferWriteRectExp( + hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, + bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, + pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferReadRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. + ur_rect_offset_t hostOffset, ///< [in] 3D offset in the host region. + ur_rect_region_t + region, ///< [in] 3D rectangular region descriptor: width, height, depth. + size_t + bufferRowPitch, ///< [in] length of each row in bytes in the buffer object. + size_t + bufferSlicePitch, ///< [in] length of each 2D slice in bytes in the buffer object being read. + size_t + hostRowPitch, ///< [in] length of each row in bytes in the host memory region pointed to + ///< by pDst. + size_t + hostSlicePitch, ///< [in] length of each 2D slice in bytes in the host memory region + ///< 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. + 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 pfnAppendMembufferReadRectExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadRectExp; + if (nullptr != pfnAppendMembufferReadRectExp) { + result = pfnAppendMembufferReadRectExp( + hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, + bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, + pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -4845,9 +5010,21 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendMembufferCopyExp = driver::urCommandBufferAppendMembufferCopyExp; + pDdiTable->pfnAppendMembufferWriteExp = + driver::urCommandBufferAppendMembufferWriteExp; + + pDdiTable->pfnAppendMembufferReadExp = + driver::urCommandBufferAppendMembufferReadExp; + pDdiTable->pfnAppendMembufferCopyRectExp = driver::urCommandBufferAppendMembufferCopyRectExp; + pDdiTable->pfnAppendMembufferWriteRectExp = + driver::urCommandBufferAppendMembufferWriteRectExp; + + pDdiTable->pfnAppendMembufferReadRectExp = + driver::urCommandBufferAppendMembufferReadRectExp; + pDdiTable->pfnEnqueueExp = driver::urCommandBufferEnqueueExp; return result; diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 27ecf34a62..ffb78e36e3 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -9072,6 +9072,22 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP: os << "UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP"; break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP"; + break; default: os << "unknown enumerator"; break; @@ -10067,6 +10083,99 @@ inline std::ostream &operator<<( return os; } +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_command_buffer_append_membuffer_write_exp_params_t + *params) { + + os << ".hCommandBuffer = "; + + ur_params::serializePtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hBuffer = "; + + ur_params::serializePtr(os, *(params->phBuffer)); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".pSrc = "; + + ur_params::serializePtr(os, *(params->ppSrc)); + + 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, + const struct ur_command_buffer_append_membuffer_read_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur_params::serializePtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hBuffer = "; + + ur_params::serializePtr(os, *(params->phBuffer)); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".pDst = "; + + ur_params::serializePtr(os, *(params->ppDst)); + + 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, const struct ur_command_buffer_append_membuffer_copy_rect_exp_params_t @@ -10139,6 +10248,150 @@ inline std::ostream &operator<<( return os; } +inline std::ostream &operator<<( + std::ostream &os, + const struct ur_command_buffer_append_membuffer_write_rect_exp_params_t + *params) { + + os << ".hCommandBuffer = "; + + ur_params::serializePtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hBuffer = "; + + ur_params::serializePtr(os, *(params->phBuffer)); + + os << ", "; + os << ".bufferOffset = "; + + os << *(params->pbufferOffset); + + os << ", "; + os << ".hostOffset = "; + + os << *(params->phostOffset); + + os << ", "; + os << ".region = "; + + os << *(params->pregion); + + os << ", "; + os << ".bufferRowPitch = "; + + os << *(params->pbufferRowPitch); + + os << ", "; + os << ".bufferSlicePitch = "; + + os << *(params->pbufferSlicePitch); + + os << ", "; + os << ".hostRowPitch = "; + + os << *(params->phostRowPitch); + + os << ", "; + os << ".hostSlicePitch = "; + + os << *(params->phostSlicePitch); + + os << ", "; + os << ".pSrc = "; + + ur_params::serializePtr(os, *(params->ppSrc)); + + 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, + const struct ur_command_buffer_append_membuffer_read_rect_exp_params_t + *params) { + + os << ".hCommandBuffer = "; + + ur_params::serializePtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hBuffer = "; + + ur_params::serializePtr(os, *(params->phBuffer)); + + os << ", "; + os << ".bufferOffset = "; + + os << *(params->pbufferOffset); + + os << ", "; + os << ".hostOffset = "; + + os << *(params->phostOffset); + + os << ", "; + os << ".region = "; + + os << *(params->pregion); + + os << ", "; + os << ".bufferRowPitch = "; + + os << *(params->pbufferRowPitch); + + os << ", "; + os << ".bufferSlicePitch = "; + + os << *(params->pbufferSlicePitch); + + os << ", "; + os << ".hostRowPitch = "; + + os << *(params->phostRowPitch); + + os << ", "; + os << ".hostSlicePitch = "; + + os << *(params->phostSlicePitch); + + os << ", "; + os << ".pDst = "; + + ur_params::serializePtr(os, *(params->ppDst)); + + 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, const struct ur_command_buffer_enqueue_exp_params_t *params) { @@ -14321,11 +14574,29 @@ inline int serializeFunctionParams(std::ostream &os, uint32_t function, os << (const struct ur_command_buffer_append_membuffer_copy_exp_params_t *)params; } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP: { + os << (const struct + ur_command_buffer_append_membuffer_write_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP: { + os << (const struct ur_command_buffer_append_membuffer_read_exp_params_t + *)params; + } break; case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP: { os << (const struct ur_command_buffer_append_membuffer_copy_rect_exp_params_t *) params; } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP: { + os << (const struct + ur_command_buffer_append_membuffer_write_rect_exp_params_t *) + params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP: { + os << (const struct + ur_command_buffer_append_membuffer_read_rect_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 a7d43afe5e..4f380b4f50 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -5140,6 +5140,101 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferWriteExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + size_t offset, ///< [in] offset in bytes in the buffer object. + 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. + ur_exp_command_buffer_sync_point_t + *pSyncPoint ///< [out][optional] sync point associated with this command +) { + auto pfnAppendMembufferWriteExp = + context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteExp; + + if (nullptr == pfnAppendMembufferWriteExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_command_buffer_append_membuffer_write_exp_params_t params = { + &hCommandBuffer, + &hBuffer, + &offset, + &size, + &pSrc, + &numSyncPointsInWaitList, + &pSyncPointWaitList, + &pSyncPoint}; + uint64_t instance = context.notify_begin( + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP, + "urCommandBufferAppendMembufferWriteExp", ¶ms); + + ur_result_t result = pfnAppendMembufferWriteExp( + hCommandBuffer, hBuffer, offset, size, pSrc, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP, + "urCommandBufferAppendMembufferWriteExp", ¶ms, + &result, instance); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferReadExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + size_t offset, ///< [in] offset in bytes in the buffer object. + 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. + ur_exp_command_buffer_sync_point_t + *pSyncPoint ///< [out][optional] sync point associated with this command +) { + auto pfnAppendMembufferReadExp = + context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadExp; + + if (nullptr == pfnAppendMembufferReadExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_command_buffer_append_membuffer_read_exp_params_t params = { + &hCommandBuffer, + &hBuffer, + &offset, + &size, + &pDst, + &numSyncPointsInWaitList, + &pSyncPointWaitList, + &pSyncPoint}; + uint64_t instance = context.notify_begin( + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP, + "urCommandBufferAppendMembufferReadExp", ¶ms); + + ur_result_t result = pfnAppendMembufferReadExp( + hCommandBuffer, hBuffer, offset, size, pDst, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP, + "urCommandBufferAppendMembufferReadExp", ¶ms, + &result, instance); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferAppendMembufferCopyRectExp __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( @@ -5202,6 +5297,140 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferWriteRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. + ur_rect_offset_t hostOffset, ///< [in] 3D offset in the host region. + ur_rect_region_t + region, ///< [in] 3D rectangular region descriptor: width, height, depth. + size_t + bufferRowPitch, ///< [in] length of each row in bytes in the buffer object. + size_t + bufferSlicePitch, ///< [in] length of each 2D slice in bytes in the buffer object being + ///< written. + size_t + hostRowPitch, ///< [in] length of each row in bytes in the host memory region pointed to + ///< by pSrc. + size_t + hostSlicePitch, ///< [in] length of each 2D slice in bytes in the host memory region + ///< 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. + ur_exp_command_buffer_sync_point_t + *pSyncPoint ///< [out][optional] sync point associated with this command +) { + auto pfnAppendMembufferWriteRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteRectExp; + + if (nullptr == pfnAppendMembufferWriteRectExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_command_buffer_append_membuffer_write_rect_exp_params_t params = { + &hCommandBuffer, + &hBuffer, + &bufferOffset, + &hostOffset, + ®ion, + &bufferRowPitch, + &bufferSlicePitch, + &hostRowPitch, + &hostSlicePitch, + &pSrc, + &numSyncPointsInWaitList, + &pSyncPointWaitList, + &pSyncPoint}; + uint64_t instance = context.notify_begin( + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP, + "urCommandBufferAppendMembufferWriteRectExp", ¶ms); + + ur_result_t result = pfnAppendMembufferWriteRectExp( + hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, + bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pSrc, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + context.notify_end( + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP, + "urCommandBufferAppendMembufferWriteRectExp", ¶ms, &result, + instance); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferReadRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. + ur_rect_offset_t hostOffset, ///< [in] 3D offset in the host region. + ur_rect_region_t + region, ///< [in] 3D rectangular region descriptor: width, height, depth. + size_t + bufferRowPitch, ///< [in] length of each row in bytes in the buffer object. + size_t + bufferSlicePitch, ///< [in] length of each 2D slice in bytes in the buffer object being read. + size_t + hostRowPitch, ///< [in] length of each row in bytes in the host memory region pointed to + ///< by pDst. + size_t + hostSlicePitch, ///< [in] length of each 2D slice in bytes in the host memory region + ///< 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. + ur_exp_command_buffer_sync_point_t + *pSyncPoint ///< [out][optional] sync point associated with this command +) { + auto pfnAppendMembufferReadRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadRectExp; + + if (nullptr == pfnAppendMembufferReadRectExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_command_buffer_append_membuffer_read_rect_exp_params_t params = { + &hCommandBuffer, + &hBuffer, + &bufferOffset, + &hostOffset, + ®ion, + &bufferRowPitch, + &bufferSlicePitch, + &hostRowPitch, + &hostSlicePitch, + &pDst, + &numSyncPointsInWaitList, + &pSyncPointWaitList, + &pSyncPoint}; + uint64_t instance = context.notify_begin( + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP, + "urCommandBufferAppendMembufferReadRectExp", ¶ms); + + ur_result_t result = pfnAppendMembufferReadRectExp( + hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, + bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pDst, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + context.notify_end( + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP, + "urCommandBufferAppendMembufferReadRectExp", ¶ms, &result, + instance); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -5581,11 +5810,29 @@ __urdlllocal ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendMembufferCopyExp = ur_tracing_layer::urCommandBufferAppendMembufferCopyExp; + dditable.pfnAppendMembufferWriteExp = pDdiTable->pfnAppendMembufferWriteExp; + pDdiTable->pfnAppendMembufferWriteExp = + ur_tracing_layer::urCommandBufferAppendMembufferWriteExp; + + dditable.pfnAppendMembufferReadExp = pDdiTable->pfnAppendMembufferReadExp; + pDdiTable->pfnAppendMembufferReadExp = + ur_tracing_layer::urCommandBufferAppendMembufferReadExp; + dditable.pfnAppendMembufferCopyRectExp = pDdiTable->pfnAppendMembufferCopyRectExp; pDdiTable->pfnAppendMembufferCopyRectExp = ur_tracing_layer::urCommandBufferAppendMembufferCopyRectExp; + dditable.pfnAppendMembufferWriteRectExp = + pDdiTable->pfnAppendMembufferWriteRectExp; + pDdiTable->pfnAppendMembufferWriteRectExp = + ur_tracing_layer::urCommandBufferAppendMembufferWriteRectExp; + + dditable.pfnAppendMembufferReadRectExp = + pDdiTable->pfnAppendMembufferReadRectExp; + pDdiTable->pfnAppendMembufferReadRectExp = + ur_tracing_layer::urCommandBufferAppendMembufferReadRectExp; + 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 6084954b58..1f9ecdf443 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -6401,6 +6401,111 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferWriteExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + size_t offset, ///< [in] offset in bytes in the buffer object. + 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. + ur_exp_command_buffer_sync_point_t + *pSyncPoint ///< [out][optional] sync point associated with this command +) { + auto pfnAppendMembufferWriteExp = + context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteExp; + + if (nullptr == pfnAppendMembufferWriteExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + if (context.enableParameterValidation) { + if (NULL == hCommandBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == hBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == pSrc) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + 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; + } + } + + ur_result_t result = pfnAppendMembufferWriteExp( + hCommandBuffer, hBuffer, offset, size, pSrc, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferReadExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + size_t offset, ///< [in] offset in bytes in the buffer object. + 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. + ur_exp_command_buffer_sync_point_t + *pSyncPoint ///< [out][optional] sync point associated with this command +) { + auto pfnAppendMembufferReadExp = + context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadExp; + + if (nullptr == pfnAppendMembufferReadExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + if (context.enableParameterValidation) { + if (NULL == hCommandBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == hBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == pDst) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + 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; + } + } + + ur_result_t result = pfnAppendMembufferReadExp( + hCommandBuffer, hBuffer, offset, size, pDst, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferAppendMembufferCopyRectExp __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( @@ -6462,6 +6567,138 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferWriteRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. + ur_rect_offset_t hostOffset, ///< [in] 3D offset in the host region. + ur_rect_region_t + region, ///< [in] 3D rectangular region descriptor: width, height, depth. + size_t + bufferRowPitch, ///< [in] length of each row in bytes in the buffer object. + size_t + bufferSlicePitch, ///< [in] length of each 2D slice in bytes in the buffer object being + ///< written. + size_t + hostRowPitch, ///< [in] length of each row in bytes in the host memory region pointed to + ///< by pSrc. + size_t + hostSlicePitch, ///< [in] length of each 2D slice in bytes in the host memory region + ///< 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. + ur_exp_command_buffer_sync_point_t + *pSyncPoint ///< [out][optional] sync point associated with this command +) { + auto pfnAppendMembufferWriteRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteRectExp; + + if (nullptr == pfnAppendMembufferWriteRectExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + if (context.enableParameterValidation) { + if (NULL == hCommandBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == hBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == pSrc) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + 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; + } + } + + ur_result_t result = pfnAppendMembufferWriteRectExp( + hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, + bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pSrc, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferReadRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. + ur_rect_offset_t hostOffset, ///< [in] 3D offset in the host region. + ur_rect_region_t + region, ///< [in] 3D rectangular region descriptor: width, height, depth. + size_t + bufferRowPitch, ///< [in] length of each row in bytes in the buffer object. + size_t + bufferSlicePitch, ///< [in] length of each 2D slice in bytes in the buffer object being read. + size_t + hostRowPitch, ///< [in] length of each row in bytes in the host memory region pointed to + ///< by pDst. + size_t + hostSlicePitch, ///< [in] length of each 2D slice in bytes in the host memory region + ///< 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. + ur_exp_command_buffer_sync_point_t + *pSyncPoint ///< [out][optional] sync point associated with this command +) { + auto pfnAppendMembufferReadRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadRectExp; + + if (nullptr == pfnAppendMembufferReadRectExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + if (context.enableParameterValidation) { + if (NULL == hCommandBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == hBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == pDst) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + 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; + } + } + + ur_result_t result = pfnAppendMembufferReadRectExp( + hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, + bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pDst, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -6878,11 +7115,29 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendMembufferCopyExp = ur_validation_layer::urCommandBufferAppendMembufferCopyExp; + dditable.pfnAppendMembufferWriteExp = pDdiTable->pfnAppendMembufferWriteExp; + pDdiTable->pfnAppendMembufferWriteExp = + ur_validation_layer::urCommandBufferAppendMembufferWriteExp; + + dditable.pfnAppendMembufferReadExp = pDdiTable->pfnAppendMembufferReadExp; + pDdiTable->pfnAppendMembufferReadExp = + ur_validation_layer::urCommandBufferAppendMembufferReadExp; + dditable.pfnAppendMembufferCopyRectExp = pDdiTable->pfnAppendMembufferCopyRectExp; pDdiTable->pfnAppendMembufferCopyRectExp = ur_validation_layer::urCommandBufferAppendMembufferCopyRectExp; + dditable.pfnAppendMembufferWriteRectExp = + pDdiTable->pfnAppendMembufferWriteRectExp; + pDdiTable->pfnAppendMembufferWriteRectExp = + ur_validation_layer::urCommandBufferAppendMembufferWriteRectExp; + + dditable.pfnAppendMembufferReadRectExp = + pDdiTable->pfnAppendMembufferReadRectExp; + pDdiTable->pfnAppendMembufferReadRectExp = + ur_validation_layer::urCommandBufferAppendMembufferReadRectExp; + 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 144d812382..3cb1885039 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -6249,6 +6249,95 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferWriteExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + size_t offset, ///< [in] offset in bytes in the buffer object. + 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. + 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 pfnAppendMembufferWriteExp = + dditable->ur.CommandBufferExp.pfnAppendMembufferWriteExp; + if (nullptr == pfnAppendMembufferWriteExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hCommandBuffer = + reinterpret_cast(hCommandBuffer) + ->handle; + + // convert loader handle to platform handle + hBuffer = reinterpret_cast(hBuffer)->handle; + + // forward to device-platform + result = pfnAppendMembufferWriteExp(hCommandBuffer, hBuffer, offset, size, + pSrc, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferReadExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + size_t offset, ///< [in] offset in bytes in the buffer object. + 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. + 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 pfnAppendMembufferReadExp = + dditable->ur.CommandBufferExp.pfnAppendMembufferReadExp; + if (nullptr == pfnAppendMembufferReadExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hCommandBuffer = + reinterpret_cast(hCommandBuffer) + ->handle; + + // convert loader handle to platform handle + hBuffer = reinterpret_cast(hBuffer)->handle; + + // forward to device-platform + result = pfnAppendMembufferReadExp(hCommandBuffer, hBuffer, offset, size, + pDst, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferAppendMembufferCopyRectExp __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( @@ -6305,6 +6394,122 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferWriteRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. + ur_rect_offset_t hostOffset, ///< [in] 3D offset in the host region. + ur_rect_region_t + region, ///< [in] 3D rectangular region descriptor: width, height, depth. + size_t + bufferRowPitch, ///< [in] length of each row in bytes in the buffer object. + size_t + bufferSlicePitch, ///< [in] length of each 2D slice in bytes in the buffer object being + ///< written. + size_t + hostRowPitch, ///< [in] length of each row in bytes in the host memory region pointed to + ///< by pSrc. + size_t + hostSlicePitch, ///< [in] length of each 2D slice in bytes in the host memory region + ///< 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. + 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 pfnAppendMembufferWriteRectExp = + dditable->ur.CommandBufferExp.pfnAppendMembufferWriteRectExp; + if (nullptr == pfnAppendMembufferWriteRectExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hCommandBuffer = + reinterpret_cast(hCommandBuffer) + ->handle; + + // convert loader handle to platform handle + hBuffer = reinterpret_cast(hBuffer)->handle; + + // forward to device-platform + result = pfnAppendMembufferWriteRectExp( + hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, + bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pSrc, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMembufferReadRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. + ur_rect_offset_t hostOffset, ///< [in] 3D offset in the host region. + ur_rect_region_t + region, ///< [in] 3D rectangular region descriptor: width, height, depth. + size_t + bufferRowPitch, ///< [in] length of each row in bytes in the buffer object. + size_t + bufferSlicePitch, ///< [in] length of each 2D slice in bytes in the buffer object being read. + size_t + hostRowPitch, ///< [in] length of each row in bytes in the host memory region pointed to + ///< by pDst. + size_t + hostSlicePitch, ///< [in] length of each 2D slice in bytes in the host memory region + ///< 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. + 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 pfnAppendMembufferReadRectExp = + dditable->ur.CommandBufferExp.pfnAppendMembufferReadRectExp; + if (nullptr == pfnAppendMembufferReadRectExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hCommandBuffer = + reinterpret_cast(hCommandBuffer) + ->handle; + + // convert loader handle to platform handle + hBuffer = reinterpret_cast(hBuffer)->handle; + + // forward to device-platform + result = pfnAppendMembufferReadRectExp( + hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, + bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pDst, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -6727,8 +6932,16 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( ur_loader::urCommandBufferAppendMemcpyUSMExp; pDdiTable->pfnAppendMembufferCopyExp = ur_loader::urCommandBufferAppendMembufferCopyExp; + pDdiTable->pfnAppendMembufferWriteExp = + ur_loader::urCommandBufferAppendMembufferWriteExp; + pDdiTable->pfnAppendMembufferReadExp = + ur_loader::urCommandBufferAppendMembufferReadExp; pDdiTable->pfnAppendMembufferCopyRectExp = ur_loader::urCommandBufferAppendMembufferCopyRectExp; + pDdiTable->pfnAppendMembufferWriteRectExp = + ur_loader::urCommandBufferAppendMembufferWriteRectExp; + pDdiTable->pfnAppendMembufferReadRectExp = + ur_loader::urCommandBufferAppendMembufferReadRectExp; 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 664e7e3d1a..e5beb86b87 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -6779,6 +6779,103 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory write 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` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pSrc` +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + size_t offset, ///< [in] offset in bytes in the buffer object. + 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. + ur_exp_command_buffer_sync_point_t + *pSyncPoint ///< [out][optional] sync point associated with this command + ) try { + auto pfnAppendMembufferWriteExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMembufferWriteExp; + if (nullptr == pfnAppendMembufferWriteExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnAppendMembufferWriteExp(hCommandBuffer, hBuffer, offset, size, + pSrc, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory read 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` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDst` +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + size_t offset, ///< [in] offset in bytes in the buffer object. + 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. + ur_exp_command_buffer_sync_point_t + *pSyncPoint ///< [out][optional] sync point associated with this command + ) try { + auto pfnAppendMembufferReadExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMembufferReadExp; + if (nullptr == pfnAppendMembufferReadExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnAppendMembufferReadExp(hCommandBuffer, hBuffer, offset, size, + pDst, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Append a rectangular memory copy command to a command-buffer object /// @@ -6836,6 +6933,132 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a rectangular memory write 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` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pSrc` +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. + ur_rect_offset_t hostOffset, ///< [in] 3D offset in the host region. + ur_rect_region_t + region, ///< [in] 3D rectangular region descriptor: width, height, depth. + size_t + bufferRowPitch, ///< [in] length of each row in bytes in the buffer object. + size_t + bufferSlicePitch, ///< [in] length of each 2D slice in bytes in the buffer object being + ///< written. + size_t + hostRowPitch, ///< [in] length of each row in bytes in the host memory region pointed to + ///< by pSrc. + size_t + hostSlicePitch, ///< [in] length of each 2D slice in bytes in the host memory region + ///< 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. + ur_exp_command_buffer_sync_point_t + *pSyncPoint ///< [out][optional] sync point associated with this command + ) try { + auto pfnAppendMembufferWriteRectExp = + ur_lib::context->urDdiTable.CommandBufferExp + .pfnAppendMembufferWriteRectExp; + if (nullptr == pfnAppendMembufferWriteRectExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnAppendMembufferWriteRectExp( + hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, + bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pSrc, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a rectangular memory read 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` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDst` +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. + ur_rect_offset_t hostOffset, ///< [in] 3D offset in the host region. + ur_rect_region_t + region, ///< [in] 3D rectangular region descriptor: width, height, depth. + size_t + bufferRowPitch, ///< [in] length of each row in bytes in the buffer object. + size_t + bufferSlicePitch, ///< [in] length of each 2D slice in bytes in the buffer object being read. + size_t + hostRowPitch, ///< [in] length of each row in bytes in the host memory region pointed to + ///< by pDst. + size_t + hostSlicePitch, ///< [in] length of each 2D slice in bytes in the host memory region + ///< 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. + ur_exp_command_buffer_sync_point_t + *pSyncPoint ///< [out][optional] sync point associated with this command + ) try { + auto pfnAppendMembufferReadRectExp = + ur_lib::context->urDdiTable.CommandBufferExp + .pfnAppendMembufferReadRectExp; + if (nullptr == pfnAppendMembufferReadRectExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnAppendMembufferReadRectExp( + hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, + bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pDst, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Submit a command-buffer for execution on a queue. /// @@ -6974,6 +7197,7 @@ ur_result_t UR_APICALL urUSMReleaseExp( /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED /// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == commandDevice` /// + `NULL == peerDevice` @@ -7025,6 +7249,7 @@ ur_result_t UR_APICALL urUsmP2PEnablePeerAccessExp( /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED /// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == commandDevice` /// + `NULL == peerDevice` @@ -7061,6 +7286,7 @@ ur_result_t UR_APICALL urUsmP2PDisablePeerAccessExp( /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED /// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == commandDevice` /// + `NULL == peerDevice` diff --git a/source/ur_api.cpp b/source/ur_api.cpp index b44a830b3c..ae93fd7f94 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -5691,6 +5691,85 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory write 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` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pSrc` +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + size_t offset, ///< [in] offset in bytes in the buffer object. + 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. + 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 memory read 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` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDst` +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + size_t offset, ///< [in] offset in bytes in the buffer object. + 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. + 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 rectangular memory copy command to a command-buffer object /// @@ -5737,6 +5816,110 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a rectangular memory write 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` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pSrc` +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. + ur_rect_offset_t hostOffset, ///< [in] 3D offset in the host region. + ur_rect_region_t + region, ///< [in] 3D rectangular region descriptor: width, height, depth. + size_t + bufferRowPitch, ///< [in] length of each row in bytes in the buffer object. + size_t + bufferSlicePitch, ///< [in] length of each 2D slice in bytes in the buffer object being + ///< written. + size_t + hostRowPitch, ///< [in] length of each row in bytes in the host memory region pointed to + ///< by pSrc. + size_t + hostSlicePitch, ///< [in] length of each 2D slice in bytes in the host memory region + ///< 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. + 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 rectangular memory read 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` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDst` +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. + ur_rect_offset_t hostOffset, ///< [in] 3D offset in the host region. + ur_rect_region_t + region, ///< [in] 3D rectangular region descriptor: width, height, depth. + size_t + bufferRowPitch, ///< [in] length of each row in bytes in the buffer object. + size_t + bufferSlicePitch, ///< [in] length of each 2D slice in bytes in the buffer object being read. + size_t + hostRowPitch, ///< [in] length of each row in bytes in the host memory region pointed to + ///< by pDst. + size_t + hostSlicePitch, ///< [in] length of each 2D slice in bytes in the host memory region + ///< 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. + 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. /// @@ -5855,6 +6038,7 @@ ur_result_t UR_APICALL urUSMReleaseExp( /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED /// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == commandDevice` /// + `NULL == peerDevice` @@ -5899,6 +6083,7 @@ ur_result_t UR_APICALL urUsmP2PEnablePeerAccessExp( /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED /// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == commandDevice` /// + `NULL == peerDevice` @@ -5928,6 +6113,7 @@ ur_result_t UR_APICALL urUsmP2PDisablePeerAccessExp( /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED /// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == commandDevice` /// + `NULL == peerDevice`