From 40a6846ec8c65f3ee3ee3fee97ea4c27859ef193 Mon Sep 17 00:00:00 2001 From: Ben Tracy Date: Mon, 21 Aug 2023 17:56:48 +0100 Subject: [PATCH] [CMDBUF] Add fill commands to cmd buffer exp feature - Adds USM and Buffer fill append commands - Update feature spec for new commands - Align naming conventions for Append* commands with core equivalents --- include/ur.py | 104 +++--- include/ur_api.h | 178 ++++++++-- include/ur_ddi.h | 69 ++-- scripts/core/EXP-COMMAND-BUFFER.rst | 54 ++-- scripts/core/exp-command-buffer.yml | 103 +++++- scripts/core/registry.yml | 48 +-- source/adapters/null/ur_nullddi.cpp | 188 +++++++---- source/common/ur_params.hpp | 222 ++++++++++--- source/loader/layers/tracing/ur_trcddi.cpp | 303 ++++++++++++------ source/loader/layers/validation/ur_valddi.cpp | 263 +++++++++++---- source/loader/ur_ldrddi.cpp | 204 ++++++++---- source/loader/ur_libapi.cpp | 177 ++++++++-- source/ur_api.cpp | 103 +++++- 13 files changed, 1493 insertions(+), 523 deletions(-) diff --git a/include/ur.py b/include/ur.py index 2f47142381..0a43f828ae 100644 --- a/include/ur.py +++ b/include/ur.py @@ -142,9 +142,6 @@ class ur_function_v(IntEnum): COMMAND_BUFFER_FINALIZE_EXP = 123 ## Enumerator for ::urCommandBufferFinalizeExp COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP = 125 ## Enumerator for ::urCommandBufferAppendKernelLaunchExp COMMAND_BUFFER_ENQUEUE_EXP = 128 ## Enumerator for ::urCommandBufferEnqueueExp - COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP = 129 ## Enumerator for ::urCommandBufferAppendMemcpyUSMExp - COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP = 130 ## Enumerator for ::urCommandBufferAppendMembufferCopyExp - COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP = 131 ## Enumerator for ::urCommandBufferAppendMembufferCopyRectExp USM_PITCHED_ALLOC_EXP = 132 ## Enumerator for ::urUSMPitchedAllocExp BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP = 133## Enumerator for ::urBindlessImagesUnsampledImageHandleDestroyExp BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP = 134 ## Enumerator for ::urBindlessImagesSampledImageHandleDestroyExp @@ -180,10 +177,6 @@ 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 LOADER_CONFIG_CREATE = 172 ## Enumerator for ::urLoaderConfigCreate LOADER_CONFIG_RELEASE = 173 ## Enumerator for ::urLoaderConfigRelease LOADER_CONFIG_RETAIN = 174 ## Enumerator for ::urLoaderConfigRetain @@ -196,6 +189,15 @@ class ur_function_v(IntEnum): ADAPTER_GET_INFO = 181 ## Enumerator for ::urAdapterGetInfo LOADER_INIT = 182 ## Enumerator for ::urLoaderInit LOADER_TEAR_DOWN = 183 ## Enumerator for ::urLoaderTearDown + COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP = 184 ## Enumerator for ::urCommandBufferAppendUSMMemcpyExp + COMMAND_BUFFER_APPEND_USM_FILL_EXP = 185 ## Enumerator for ::urCommandBufferAppendUSMFillExp + COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP = 186 ## Enumerator for ::urCommandBufferAppendMemBufferCopyExp + COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP = 187## Enumerator for ::urCommandBufferAppendMemBufferWriteExp + COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP = 188 ## Enumerator for ::urCommandBufferAppendMemBufferReadExp + COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP = 189## Enumerator for ::urCommandBufferAppendMemBufferCopyRectExp + COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP = 190 ## Enumerator for ::urCommandBufferAppendMemBufferWriteRectExp + COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP = 191## Enumerator for ::urCommandBufferAppendMemBufferReadRectExp + COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 192 ## Enumerator for ::urCommandBufferAppendMemBufferFillExp class ur_function_t(c_int): def __str__(self): @@ -3484,53 +3486,67 @@ class ur_usm_exp_dditable_t(Structure): _urCommandBufferAppendKernelLaunchExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_kernel_handle_t, c_ulong, POINTER(c_size_t), POINTER(c_size_t), POINTER(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 urCommandBufferAppendMemcpyUSMExp +## @brief Function-pointer for urCommandBufferAppendUSMMemcpyExp if __use_win_types: - _urCommandBufferAppendMemcpyUSMExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_void_p, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendUSMMemcpyExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_void_p, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) else: - _urCommandBufferAppendMemcpyUSMExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_void_p, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendUSMMemcpyExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_void_p, 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 urCommandBufferAppendMembufferCopyExp +## @brief Function-pointer for urCommandBufferAppendUSMFillExp if __use_win_types: - _urCommandBufferAppendMembufferCopyExp_t = WINFUNCTYPE( 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) ) + _urCommandBufferAppendUSMFillExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_void_p, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) 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) ) + _urCommandBufferAppendUSMFillExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_void_p, 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 +## @brief Function-pointer for urCommandBufferAppendMemBufferCopyExp 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) ) + _urCommandBufferAppendMemBufferCopyExp_t = WINFUNCTYPE( 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) ) 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) ) + _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 urCommandBufferAppendMembufferReadExp +## @brief Function-pointer for urCommandBufferAppendMemBufferWriteExp 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) ) + _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: - _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) ) + _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 urCommandBufferAppendMembufferCopyRectExp +## @brief Function-pointer for urCommandBufferAppendMemBufferReadExp if __use_win_types: - _urCommandBufferAppendMembufferCopyRectExp_t = WINFUNCTYPE( 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) ) + _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: - _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) ) + _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 urCommandBufferAppendMembufferWriteRectExp +## @brief Function-pointer for urCommandBufferAppendMemBufferCopyRectExp 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) ) + _urCommandBufferAppendMemBufferCopyRectExp_t = WINFUNCTYPE( 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) ) 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) ) + _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 urCommandBufferAppendMembufferReadRectExp +## @brief Function-pointer for urCommandBufferAppendMemBufferWriteRectExp 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) ) + _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: - _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) ) + _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 urCommandBufferAppendMemBufferFillExp +if __use_win_types: + _urCommandBufferAppendMemBufferFillExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_void_p, c_size_t, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) +else: + _urCommandBufferAppendMemBufferFillExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_void_p, c_size_t, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) ############################################################################### ## @brief Function-pointer for urCommandBufferEnqueueExp @@ -3549,13 +3565,15 @@ class ur_command_buffer_exp_dditable_t(Structure): ("pfnReleaseExp", c_void_p), ## _urCommandBufferReleaseExp_t ("pfnFinalizeExp", c_void_p), ## _urCommandBufferFinalizeExp_t ("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 + ("pfnAppendUSMMemcpyExp", c_void_p), ## _urCommandBufferAppendUSMMemcpyExp_t + ("pfnAppendUSMFillExp", c_void_p), ## _urCommandBufferAppendUSMFillExp_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 + ("pfnAppendMemBufferFillExp", c_void_p), ## _urCommandBufferAppendMemBufferFillExp_t ("pfnEnqueueExp", c_void_p) ## _urCommandBufferEnqueueExp_t ] @@ -4045,13 +4063,15 @@ def __init__(self, version : ur_api_version_t): self.urCommandBufferReleaseExp = _urCommandBufferReleaseExp_t(self.__dditable.CommandBufferExp.pfnReleaseExp) self.urCommandBufferFinalizeExp = _urCommandBufferFinalizeExp_t(self.__dditable.CommandBufferExp.pfnFinalizeExp) 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.urCommandBufferAppendUSMMemcpyExp = _urCommandBufferAppendUSMMemcpyExp_t(self.__dditable.CommandBufferExp.pfnAppendUSMMemcpyExp) + self.urCommandBufferAppendUSMFillExp = _urCommandBufferAppendUSMFillExp_t(self.__dditable.CommandBufferExp.pfnAppendUSMFillExp) + 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.urCommandBufferAppendMemBufferFillExp = _urCommandBufferAppendMemBufferFillExp_t(self.__dditable.CommandBufferExp.pfnAppendMemBufferFillExp) 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 30696c2932..1508dcf86b 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -151,9 +151,6 @@ typedef enum ur_function_t { UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP = 123, ///< Enumerator for ::urCommandBufferFinalizeExp UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP = 125, ///< Enumerator for ::urCommandBufferAppendKernelLaunchExp UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP = 128, ///< Enumerator for ::urCommandBufferEnqueueExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP = 129, ///< Enumerator for ::urCommandBufferAppendMemcpyUSMExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP = 130, ///< Enumerator for ::urCommandBufferAppendMembufferCopyExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP = 131, ///< Enumerator for ::urCommandBufferAppendMembufferCopyRectExp UR_FUNCTION_USM_PITCHED_ALLOC_EXP = 132, ///< Enumerator for ::urUSMPitchedAllocExp UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP = 133, ///< Enumerator for ::urBindlessImagesUnsampledImageHandleDestroyExp UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP = 134, ///< Enumerator for ::urBindlessImagesSampledImageHandleDestroyExp @@ -189,10 +186,6 @@ 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 UR_FUNCTION_LOADER_CONFIG_CREATE = 172, ///< Enumerator for ::urLoaderConfigCreate UR_FUNCTION_LOADER_CONFIG_RELEASE = 173, ///< Enumerator for ::urLoaderConfigRelease UR_FUNCTION_LOADER_CONFIG_RETAIN = 174, ///< Enumerator for ::urLoaderConfigRetain @@ -205,6 +198,15 @@ typedef enum ur_function_t { UR_FUNCTION_ADAPTER_GET_INFO = 181, ///< Enumerator for ::urAdapterGetInfo UR_FUNCTION_LOADER_INIT = 182, ///< Enumerator for ::urLoaderInit UR_FUNCTION_LOADER_TEAR_DOWN = 183, ///< Enumerator for ::urLoaderTearDown + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP = 184, ///< Enumerator for ::urCommandBufferAppendUSMMemcpyExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP = 185, ///< Enumerator for ::urCommandBufferAppendUSMFillExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP = 186, ///< Enumerator for ::urCommandBufferAppendMemBufferCopyExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP = 187, ///< Enumerator for ::urCommandBufferAppendMemBufferWriteExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP = 188, ///< Enumerator for ::urCommandBufferAppendMemBufferReadExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP = 189, ///< Enumerator for ::urCommandBufferAppendMemBufferCopyRectExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP = 190, ///< Enumerator for ::urCommandBufferAppendMemBufferWriteRectExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP = 191, ///< Enumerator for ::urCommandBufferAppendMemBufferReadRectExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 192, ///< Enumerator for ::urCommandBufferAppendMemBufferFillExp /// @cond UR_FUNCTION_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -7777,7 +7779,7 @@ urCommandBufferAppendKernelLaunchExp( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferAppendMemcpyUSMExp( +urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. void *pDst, ///< [in] Location the data will be copied to. const void *pSrc, ///< [in] The data to be copied. @@ -7787,6 +7789,45 @@ urCommandBufferAppendMemcpyUSMExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM fill command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// + `NULL == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `patternSize == 0 || size == 0` +/// + `patternSize > size` +/// + `(patternSize & (patternSize - 1)) != 0` +/// + `size % patternSize != 0` +/// + If `size` is higher than the allocation size of `ptr` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferAppendUSMFillExp( + ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to fill. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command. +); + /////////////////////////////////////////////////////////////////////////////// /// @brief Append a memory copy command to a command-buffer object /// @@ -7808,7 +7849,7 @@ urCommandBufferAppendMemcpyUSMExp( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferAppendMembufferCopyExp( +urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. ur_mem_handle_t hDstMem, ///< [in] The location the data will be copied to. @@ -7842,7 +7883,7 @@ urCommandBufferAppendMembufferCopyExp( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferAppendMembufferWriteExp( +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. @@ -7875,7 +7916,7 @@ urCommandBufferAppendMembufferWriteExp( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferAppendMembufferReadExp( +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. @@ -7907,7 +7948,7 @@ urCommandBufferAppendMembufferReadExp( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferAppendMembufferCopyRectExp( +urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. ur_mem_handle_t hDstMem, ///< [in] The location the data will be copied to. @@ -7945,7 +7986,7 @@ urCommandBufferAppendMembufferCopyRectExp( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferAppendMembufferWriteRectExp( +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. @@ -7986,7 +8027,7 @@ urCommandBufferAppendMembufferWriteRectExp( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferAppendMembufferReadRectExp( +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. @@ -8004,6 +8045,42 @@ urCommandBufferAppendMembufferReadRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory fill 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 == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + If `offset + size` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferAppendMemBufferFillExp( + 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. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t offset, ///< [in] offset into the buffer. + size_t size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + 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. /// @@ -9918,10 +9995,10 @@ typedef struct ur_command_buffer_append_kernel_launch_exp_params_t { } ur_command_buffer_append_kernel_launch_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferAppendMemcpyUSMExp +/// @brief Function parameters for urCommandBufferAppendUSMMemcpyExp /// @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_memcpy_usm_exp_params_t { +typedef struct ur_command_buffer_append_usm_memcpy_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; void **ppDst; const void **ppSrc; @@ -9929,13 +10006,28 @@ typedef struct ur_command_buffer_append_memcpy_usm_exp_params_t { uint32_t *pnumSyncPointsInWaitList; const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; ur_exp_command_buffer_sync_point_t **ppSyncPoint; -} ur_command_buffer_append_memcpy_usm_exp_params_t; +} ur_command_buffer_append_usm_memcpy_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendUSMFillExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_usm_fill_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + void **ppMemory; + const void **ppPattern; + size_t *ppatternSize; + size_t *psize; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; +} ur_command_buffer_append_usm_fill_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferAppendMembufferCopyExp +/// @brief Function parameters for urCommandBufferAppendMemBufferCopyExp /// @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_copy_exp_params_t { +typedef struct ur_command_buffer_append_mem_buffer_copy_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; ur_mem_handle_t *phSrcMem; ur_mem_handle_t *phDstMem; @@ -9945,13 +10037,13 @@ typedef struct ur_command_buffer_append_membuffer_copy_exp_params_t { 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_copy_exp_params_t; +} ur_command_buffer_append_mem_buffer_copy_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferAppendMembufferWriteExp +/// @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 { +typedef struct ur_command_buffer_append_mem_buffer_write_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; ur_mem_handle_t *phBuffer; size_t *poffset; @@ -9960,13 +10052,13 @@ typedef struct ur_command_buffer_append_membuffer_write_exp_params_t { 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; +} ur_command_buffer_append_mem_buffer_write_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferAppendMembufferReadExp +/// @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 { +typedef struct ur_command_buffer_append_mem_buffer_read_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; ur_mem_handle_t *phBuffer; size_t *poffset; @@ -9975,13 +10067,13 @@ typedef struct ur_command_buffer_append_membuffer_read_exp_params_t { 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; +} ur_command_buffer_append_mem_buffer_read_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferAppendMembufferCopyRectExp +/// @brief Function parameters for urCommandBufferAppendMemBufferCopyRectExp /// @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_copy_rect_exp_params_t { +typedef struct ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; ur_mem_handle_t *phSrcMem; ur_mem_handle_t *phDstMem; @@ -9995,13 +10087,13 @@ typedef struct ur_command_buffer_append_membuffer_copy_rect_exp_params_t { 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_copy_rect_exp_params_t; +} ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferAppendMembufferWriteRectExp +/// @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 { +typedef struct ur_command_buffer_append_mem_buffer_write_rect_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; ur_mem_handle_t *phBuffer; ur_rect_offset_t *pbufferOffset; @@ -10015,13 +10107,13 @@ typedef struct ur_command_buffer_append_membuffer_write_rect_exp_params_t { 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; +} ur_command_buffer_append_mem_buffer_write_rect_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferAppendMembufferReadRectExp +/// @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 { +typedef struct ur_command_buffer_append_mem_buffer_read_rect_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; ur_mem_handle_t *phBuffer; ur_rect_offset_t *pbufferOffset; @@ -10035,7 +10127,23 @@ typedef struct ur_command_buffer_append_membuffer_read_rect_exp_params_t { 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; +} ur_command_buffer_append_mem_buffer_read_rect_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendMemBufferFillExp +/// @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_mem_buffer_fill_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_mem_handle_t *phBuffer; + const void **ppPattern; + size_t *ppatternSize; + size_t *poffset; + size_t *psize; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; +} ur_command_buffer_append_mem_buffer_fill_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urCommandBufferEnqueueExp diff --git a/include/ur_ddi.h b/include/ur_ddi.h index cd6e9f77d9..ff3bfca155 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -1727,8 +1727,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendKernelLaunchExp_t)( ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferAppendMemcpyUSMExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemcpyUSMExp_t)( +/// @brief Function-pointer for urCommandBufferAppendUSMMemcpyExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMMemcpyExp_t)( ur_exp_command_buffer_handle_t, void *, const void *, @@ -1738,8 +1738,20 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemcpyUSMExp_t)( ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferAppendMembufferCopyExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferCopyExp_t)( +/// @brief Function-pointer for urCommandBufferAppendUSMFillExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMFillExp_t)( + ur_exp_command_buffer_handle_t, + void *, + const void *, + size_t, + size_t, + uint32_t, + const ur_exp_command_buffer_sync_point_t *, + ur_exp_command_buffer_sync_point_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMemBufferCopyExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferCopyExp_t)( ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, @@ -1751,8 +1763,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferCopyExp_t)( ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferAppendMembufferWriteExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferWriteExp_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, @@ -1763,8 +1775,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferWriteExp_t)( ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferAppendMembufferReadExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferReadExp_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, @@ -1775,8 +1787,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferReadExp_t)( ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferAppendMembufferCopyRectExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferCopyRectExp_t)( +/// @brief Function-pointer for urCommandBufferAppendMemBufferCopyRectExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferCopyRectExp_t)( ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, @@ -1792,8 +1804,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferCopyRectExp_t) ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferAppendMembufferWriteRectExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferWriteRectExp_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, @@ -1809,8 +1821,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferWriteRectExp_t ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferAppendMembufferReadRectExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferReadRectExp_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, @@ -1825,6 +1837,19 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferReadRectExp_t) const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMemBufferFillExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferFillExp_t)( + ur_exp_command_buffer_handle_t, + ur_mem_handle_t, + const void *, + size_t, + size_t, + size_t, + 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)( @@ -1842,13 +1867,15 @@ typedef struct ur_command_buffer_exp_dditable_t { ur_pfnCommandBufferReleaseExp_t pfnReleaseExp; ur_pfnCommandBufferFinalizeExp_t pfnFinalizeExp; 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_pfnCommandBufferAppendUSMMemcpyExp_t pfnAppendUSMMemcpyExp; + ur_pfnCommandBufferAppendUSMFillExp_t pfnAppendUSMFillExp; + 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_pfnCommandBufferAppendMemBufferFillExp_t pfnAppendMemBufferFillExp; 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 a169117022..9617044432 100644 --- a/scripts/core/EXP-COMMAND-BUFFER.rst +++ b/scripts/core/EXP-COMMAND-BUFFER.rst @@ -92,13 +92,15 @@ of event handles. Currently only the following commands are supported: * ${x}CommandBufferAppendKernelLaunchExp -* ${x}CommandBufferAppendMemcpyUSMExp -* ${x}CommandBufferAppendMembufferCopyExp -* ${x}CommandBufferAppendMembufferCopyRectExp -* ${x}CommandBufferAppendMembufferReadExp -* ${x}CommandBufferAppendMembufferReadRectExp -* ${x}CommandBufferAppendMembufferWriteExp -* ${x}CommandBufferAppendMembufferWriteRectExp +* ${x}CommandBufferAppendUSMMemcpyExp +* ${x}CommandBufferAppendUSMFillExp +* ${x}CommandBufferAppendMemBufferCopyExp +* ${x}CommandBufferAppendMemBufferCopyRectExp +* ${x}CommandBufferAppendMemBufferReadExp +* ${x}CommandBufferAppendMemBufferReadRectExp +* ${x}CommandBufferAppendMemBufferWriteExp +* ${x}CommandBufferAppendMemBufferWriteRectExp +* ${x}CommandBufferAppendMemBufferFillExp It is planned to eventually support any command type from the Core API which can actually be appended to the equiavalent adapter native constructs. @@ -118,7 +120,7 @@ were obtained from. // Append a memcpy with no sync-point dependencies ${x}_exp_command_buffer_sync_point_t syncPoint; - ${x}CommandBufferAppendMemcpyUSMExp(hCommandBuffer, pDst, pSrc, size, 0, + ${x}CommandBufferAppendUSMMemcpyExp(hCommandBuffer, pDst, pSrc, size, 0, nullptr, &syncPoint); // Append a kernel launch with syncPoint as a dependency, ignore returned @@ -167,13 +169,15 @@ Enums * ${X}_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP * ${X}_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP - * ${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 + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP @@ -191,13 +195,15 @@ Functions * ${x}CommandBufferReleaseExp * ${x}CommandBufferFinalizeExp * ${x}CommandBufferAppendKernelLaunchExp -* ${x}CommandBufferAppendMemcpyUSMExp -* ${x}CommandBufferAppendMembufferCopyExp -* ${x}CommandBufferAppendMembufferCopyRectExp -* ${x}CommandBufferAppendMembufferReadExp -* ${x}CommandBufferAppendMembufferReadRectExp -* ${x}CommandBufferAppendMembufferWriteExp -* ${x}CommandBufferAppendMembufferWriteRectExp +* ${x}CommandBufferAppendUSMMemcpyExp +* ${x}CommandBufferAppendUSMFillExp +* ${x}CommandBufferAppendMemBufferCopyExp +* ${x}CommandBufferAppendMemBufferCopyRectExp +* ${x}CommandBufferAppendMemBufferReadExp +* ${x}CommandBufferAppendMemBufferReadRectExp +* ${x}CommandBufferAppendMemBufferWriteExp +* ${x}CommandBufferAppendMemBufferWriteRectExp +* ${x}CommandBufferAppendMemBufferFillExp * ${x}CommandBufferEnqueueExp Changelog @@ -208,7 +214,9 @@ Changelog +===========+=======================================================+ | 1.0 | Initial Draft | +-----------+-------------------------------------------------------+ -| 1.1 | add function definitions for buffer read and write | +| 1.1 | Add function definitions for buffer read and write | ++-----------+-------------------------------------------------------+ +| 1.2 | Add function definitions for fill commands | +-----------+-------------------------------------------------------+ Contributors diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index e8c5417831..691bf56b86 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -180,7 +180,7 @@ returns: type: function desc: "Append a USM memcpy command to a command-buffer object" class: $xCommandBuffer -name: AppendMemcpyUSMExp +name: AppendUSMMemcpyExp params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer @@ -217,9 +217,54 @@ returns: - $X_RESULT_ERROR_OUT_OF_RESOURCES --- #-------------------------------------------------------------------------- type: function +desc: "Append a USM fill command to a command-buffer object" +class: $xCommandBuffer +name: AppendUSMFillExp +params: + - type: $x_exp_command_buffer_handle_t + name: hCommandBuffer + desc: "[in] handle of the command-buffer object." + - type: "void*" + name: pMemory + desc: "[in] pointer to USM allocated memory to fill." + - type: "const void*" + name: pPattern + desc: "[in] pointer to the fill pattern." + - type: "size_t" + name: patternSize + desc: "[in] size in bytes of the pattern." + - type: "size_t" + name: size + desc: "[in] fill size in bytes, must be a multiple of patternSize." + - 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_SIZE: + - "`patternSize == 0 || size == 0`" + - "`patternSize > size`" + - "`(patternSize & (patternSize - 1)) != 0`" + - "`size % patternSize != 0`" + - "If `size` is higher than the allocation size of `ptr`" + - $X_RESULT_ERROR_INVALID_MEM_OBJECT + - $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_OUT_OF_HOST_MEMORY + - $X_RESULT_ERROR_OUT_OF_RESOURCES +--- #-------------------------------------------------------------------------- +type: function desc: "Append a memory copy command to a command-buffer object" class: $xCommandBuffer -name: AppendMembufferCopyExp +name: AppendMemBufferCopyExp params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer @@ -261,7 +306,7 @@ returns: type: function desc: "Append a memory write command to a command-buffer object" class: $xCommandBuffer -name: AppendMembufferWriteExp +name: AppendMemBufferWriteExp params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer @@ -300,7 +345,7 @@ returns: type: function desc: "Append a memory read command to a command-buffer object" class: $xCommandBuffer -name: AppendMembufferReadExp +name: AppendMemBufferReadExp params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer @@ -339,7 +384,7 @@ returns: type: function desc: "Append a rectangular memory copy command to a command-buffer object" class: $xCommandBuffer -name: AppendMembufferCopyRectExp +name: AppendMemBufferCopyRectExp params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer @@ -393,7 +438,7 @@ returns: type: function desc: "Append a rectangular memory write command to a command-buffer object" class: $xCommandBuffer -name: AppendMembufferWriteRectExp +name: AppendMemBufferWriteRectExp params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer @@ -447,7 +492,7 @@ returns: type: function desc: "Append a rectangular memory read command to a command-buffer object" class: $xCommandBuffer -name: AppendMembufferReadRectExp +name: AppendMemBufferReadRectExp params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer @@ -499,6 +544,50 @@ returns: - $X_RESULT_ERROR_OUT_OF_RESOURCES --- #-------------------------------------------------------------------------- type: function +desc: "Append a memory fill command to a command-buffer object" +class: $xCommandBuffer +name: AppendMemBufferFillExp +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: "const void*" + name: pPattern + desc: "[in] pointer to the fill pattern." + - type: "size_t" + name: patternSize + desc: "[in] size in bytes of the pattern." + - type: "size_t" + name: offset + desc: "[in] offset into the buffer." + - type: "size_t" + name: size + desc: "[in] fill size in bytes, must be a multiple of patternSize." + - type: uint32_t + name: numSyncPointsInWaitList + desc: "[in] The number of sync points in the provided dependency list." + - type: "const $x_exp_command_buffer_sync_point_t*" + name: pSyncPointWaitList + desc: "[in][optional] A list of sync points that this command depends on." + - type: $x_exp_command_buffer_sync_point_t* + name: pSyncPoint + desc: "[out][optional] sync point associated with this command." +returns: + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP: + - "`pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0`" + - "`pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0`" + - $X_RESULT_ERROR_INVALID_MEM_OBJECT + - $X_RESULT_ERROR_INVALID_SIZE: + - "If `offset + size` results in an out-of-bounds access." + - $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 435e7d8eda..01b4b50334 100644 --- a/scripts/core/registry.yml +++ b/scripts/core/registry.yml @@ -367,15 +367,6 @@ etors: - name: COMMAND_BUFFER_ENQUEUE_EXP desc: Enumerator for $xCommandBufferEnqueueExp value: '128' -- name: COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP - desc: Enumerator for $xCommandBufferAppendMemcpyUSMExp - value: '129' -- name: COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP - desc: Enumerator for $xCommandBufferAppendMembufferCopyExp - value: '130' -- name: COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP - desc: Enumerator for $xCommandBufferAppendMembufferCopyRectExp - value: '131' - name: USM_PITCHED_ALLOC_EXP desc: Enumerator for $xUSMPitchedAllocExp value: '132' @@ -481,18 +472,6 @@ 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' - name: LOADER_CONFIG_CREATE desc: Enumerator for $xLoaderConfigCreate value: '172' @@ -529,6 +508,33 @@ etors: - name: LOADER_TEAR_DOWN desc: Enumerator for $xLoaderTearDown value: '183' +- name: COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP + desc: Enumerator for $xCommandBufferAppendUSMMemcpyExp + value: '184' +- name: COMMAND_BUFFER_APPEND_USM_FILL_EXP + desc: Enumerator for $xCommandBufferAppendUSMFillExp + value: '185' +- name: COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP + desc: Enumerator for $xCommandBufferAppendMemBufferCopyExp + value: '186' +- name: COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP + desc: Enumerator for $xCommandBufferAppendMemBufferWriteExp + value: '187' +- name: COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP + desc: Enumerator for $xCommandBufferAppendMemBufferReadExp + value: '188' +- name: COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP + desc: Enumerator for $xCommandBufferAppendMemBufferCopyRectExp + value: '189' +- name: COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP + desc: Enumerator for $xCommandBufferAppendMemBufferWriteRectExp + value: '190' +- name: COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP + desc: Enumerator for $xCommandBufferAppendMemBufferReadRectExp + value: '191' +- name: COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP + desc: Enumerator for $xCommandBufferAppendMemBufferFillExp + value: '192' --- type: enum desc: Defines structure types diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index e5efe2b49c..29d2faef98 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -4545,8 +4545,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMemcpyUSMExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +/// @brief Intercept function for urCommandBufferAppendUSMMemcpyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. void *pDst, ///< [in] Location the data will be copied to. @@ -4562,10 +4562,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( 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 pfnAppendMemcpyUSMExp = - d_context.urDdiTable.CommandBufferExp.pfnAppendMemcpyUSMExp; - if (nullptr != pfnAppendMemcpyUSMExp) { - result = pfnAppendMemcpyUSMExp(hCommandBuffer, pDst, pSrc, size, + auto pfnAppendUSMMemcpyExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendUSMMemcpyExp; + if (nullptr != pfnAppendUSMMemcpyExp) { + result = pfnAppendUSMMemcpyExp(hCommandBuffer, pDst, pSrc, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } else { @@ -4578,8 +4578,43 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +/// @brief Intercept function for urCommandBufferAppendUSMFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to fill. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + 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 pfnAppendUSMFillExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendUSMFillExp; + if (nullptr != pfnAppendUSMFillExp) { + result = pfnAppendUSMFillExp(hCommandBuffer, pMemory, pPattern, + patternSize, size, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -4597,10 +4632,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( 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 pfnAppendMembufferCopyExp = - d_context.urDdiTable.CommandBufferExp.pfnAppendMembufferCopyExp; - if (nullptr != pfnAppendMembufferCopyExp) { - result = pfnAppendMembufferCopyExp( + auto pfnAppendMemBufferCopyExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMemBufferCopyExp; + if (nullptr != pfnAppendMemBufferCopyExp) { + result = pfnAppendMemBufferCopyExp( hCommandBuffer, hSrcMem, hDstMem, srcOffset, dstOffset, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } else { @@ -4613,8 +4648,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +/// @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. @@ -4632,10 +4667,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( 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, + auto pfnAppendMemBufferWriteExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMemBufferWriteExp; + if (nullptr != pfnAppendMemBufferWriteExp) { + result = pfnAppendMemBufferWriteExp(hCommandBuffer, hBuffer, offset, size, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } else { @@ -4648,8 +4683,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +/// @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. @@ -4666,10 +4701,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( 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, + auto pfnAppendMemBufferReadExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMemBufferReadExp; + if (nullptr != pfnAppendMemBufferReadExp) { + result = pfnAppendMemBufferReadExp(hCommandBuffer, hBuffer, offset, size, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } else { @@ -4682,8 +4717,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -4708,10 +4743,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( 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 pfnAppendMembufferCopyRectExp = - d_context.urDdiTable.CommandBufferExp.pfnAppendMembufferCopyRectExp; - if (nullptr != pfnAppendMembufferCopyRectExp) { - result = pfnAppendMembufferCopyRectExp( + auto pfnAppendMemBufferCopyRectExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMemBufferCopyRectExp; + if (nullptr != pfnAppendMemBufferCopyRectExp) { + result = pfnAppendMemBufferCopyRectExp( hCommandBuffer, hSrcMem, hDstMem, srcOrigin, dstOrigin, region, srcRowPitch, srcSlicePitch, dstRowPitch, dstSlicePitch, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -4725,8 +4760,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +/// @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. @@ -4757,10 +4792,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( 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( + 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); @@ -4774,8 +4809,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +/// @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. @@ -4804,10 +4839,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( 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( + 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); @@ -4820,6 +4855,42 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( + 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. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t offset, ///< [in] offset into the buffer. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + 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 pfnAppendMemBufferFillExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMemBufferFillExp; + if (nullptr != pfnAppendMemBufferFillExp) { + result = pfnAppendMemBufferFillExp( + hCommandBuffer, hBuffer, pPattern, patternSize, offset, size, + 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( @@ -5129,26 +5200,31 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendKernelLaunchExp = driver::urCommandBufferAppendKernelLaunchExp; - pDdiTable->pfnAppendMemcpyUSMExp = - driver::urCommandBufferAppendMemcpyUSMExp; + pDdiTable->pfnAppendUSMMemcpyExp = + driver::urCommandBufferAppendUSMMemcpyExp; + + pDdiTable->pfnAppendUSMFillExp = driver::urCommandBufferAppendUSMFillExp; + + pDdiTable->pfnAppendMemBufferCopyExp = + driver::urCommandBufferAppendMemBufferCopyExp; - pDdiTable->pfnAppendMembufferCopyExp = - driver::urCommandBufferAppendMembufferCopyExp; + pDdiTable->pfnAppendMemBufferWriteExp = + driver::urCommandBufferAppendMemBufferWriteExp; - pDdiTable->pfnAppendMembufferWriteExp = - driver::urCommandBufferAppendMembufferWriteExp; + pDdiTable->pfnAppendMemBufferReadExp = + driver::urCommandBufferAppendMemBufferReadExp; - pDdiTable->pfnAppendMembufferReadExp = - driver::urCommandBufferAppendMembufferReadExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + driver::urCommandBufferAppendMemBufferCopyRectExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - driver::urCommandBufferAppendMembufferCopyRectExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + driver::urCommandBufferAppendMemBufferWriteRectExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - driver::urCommandBufferAppendMembufferWriteRectExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + driver::urCommandBufferAppendMemBufferReadRectExp; - pDdiTable->pfnAppendMembufferReadRectExp = - driver::urCommandBufferAppendMembufferReadRectExp; + pDdiTable->pfnAppendMemBufferFillExp = + driver::urCommandBufferAppendMemBufferFillExp; pDdiTable->pfnEnqueueExp = driver::urCommandBufferEnqueueExp; diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 0fe2ebc9f8..3ee474d105 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -925,18 +925,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { os << "UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP: - os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP"; - break; - - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP: - os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP"; - break; - - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP: - os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP"; - break; - case UR_FUNCTION_USM_PITCHED_ALLOC_EXP: os << "UR_FUNCTION_USM_PITCHED_ALLOC_EXP"; break; @@ -1078,22 +1066,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { 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; - case UR_FUNCTION_LOADER_CONFIG_CREATE: os << "UR_FUNCTION_LOADER_CONFIG_CREATE"; break; @@ -1141,6 +1113,42 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_LOADER_TEAR_DOWN: os << "UR_FUNCTION_LOADER_TEAR_DOWN"; break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP"; + break; default: os << "unknown enumerator"; break; @@ -10731,7 +10739,7 @@ inline std::ostream &operator<<( inline std::ostream &operator<<( std::ostream &os, - const struct ur_command_buffer_append_memcpy_usm_exp_params_t *params) { + const struct ur_command_buffer_append_usm_memcpy_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -10772,7 +10780,54 @@ inline std::ostream &operator<<( inline std::ostream &operator<<( std::ostream &os, - const struct ur_command_buffer_append_membuffer_copy_exp_params_t *params) { + const struct ur_command_buffer_append_usm_fill_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur_params::serializePtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".pMemory = "; + + ur_params::serializePtr(os, *(params->ppMemory)); + + os << ", "; + os << ".pPattern = "; + + ur_params::serializePtr(os, *(params->ppPattern)); + + os << ", "; + os << ".patternSize = "; + + os << *(params->ppatternSize); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + 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_mem_buffer_copy_exp_params_t + *params) { os << ".hCommandBuffer = "; @@ -10823,7 +10878,7 @@ inline std::ostream &operator<<( inline std::ostream & operator<<(std::ostream &os, - const struct ur_command_buffer_append_membuffer_write_exp_params_t + const struct ur_command_buffer_append_mem_buffer_write_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -10868,9 +10923,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_command_buffer_append_membuffer_read_exp_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_command_buffer_append_mem_buffer_read_exp_params_t + *params) { os << ".hCommandBuffer = "; @@ -10916,7 +10972,7 @@ inline std::ostream &operator<<( inline std::ostream &operator<<( std::ostream &os, - const struct ur_command_buffer_append_membuffer_copy_rect_exp_params_t + const struct ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -10988,7 +11044,7 @@ inline std::ostream &operator<<( inline std::ostream &operator<<( std::ostream &os, - const struct ur_command_buffer_append_membuffer_write_rect_exp_params_t + const struct ur_command_buffer_append_mem_buffer_write_rect_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -11060,7 +11116,7 @@ inline std::ostream &operator<<( inline std::ostream &operator<<( std::ostream &os, - const struct ur_command_buffer_append_membuffer_read_rect_exp_params_t + const struct ur_command_buffer_append_mem_buffer_read_rect_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -11130,6 +11186,58 @@ inline std::ostream &operator<<( return os; } +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_command_buffer_append_mem_buffer_fill_exp_params_t + *params) { + + os << ".hCommandBuffer = "; + + ur_params::serializePtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hBuffer = "; + + ur_params::serializePtr(os, *(params->phBuffer)); + + os << ", "; + os << ".pPattern = "; + + ur_params::serializePtr(os, *(params->ppPattern)); + + os << ", "; + os << ".patternSize = "; + + os << *(params->ppatternSize); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + 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) { @@ -15433,37 +15541,45 @@ inline int serializeFunctionParams(std::ostream &os, uint32_t function, os << (const struct ur_command_buffer_append_kernel_launch_exp_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP: { - os << (const struct ur_command_buffer_append_memcpy_usm_exp_params_t *) + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP: { + os << (const struct ur_command_buffer_append_usm_memcpy_exp_params_t *) params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP: { - os << (const struct ur_command_buffer_append_membuffer_copy_exp_params_t - *)params; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP: { + os << (const struct ur_command_buffer_append_usm_fill_exp_params_t *) + params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP: { + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP: { os << (const struct - ur_command_buffer_append_membuffer_write_exp_params_t *)params; + ur_command_buffer_append_mem_buffer_copy_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; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP: { + os << (const struct + ur_command_buffer_append_mem_buffer_write_exp_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP: { + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP: { os << (const struct - ur_command_buffer_append_membuffer_copy_rect_exp_params_t *) + ur_command_buffer_append_mem_buffer_read_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP: { + os << (const struct + ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t *) params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP: { + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP: { os << (const struct - ur_command_buffer_append_membuffer_write_rect_exp_params_t *) + ur_command_buffer_append_mem_buffer_write_rect_exp_params_t *) params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP: { + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP: { os << (const struct - ur_command_buffer_append_membuffer_read_rect_exp_params_t *) + ur_command_buffer_append_mem_buffer_read_rect_exp_params_t *) params; } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP: { + os << (const struct + ur_command_buffer_append_mem_buffer_fill_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 3f79c3aa13..dee41bc1c1 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -5184,8 +5184,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMemcpyUSMExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +/// @brief Intercept function for urCommandBufferAppendUSMMemcpyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. void *pDst, ///< [in] Location the data will be copied to. @@ -5198,34 +5198,77 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMemcpyUSMExp = - context.urDdiTable.CommandBufferExp.pfnAppendMemcpyUSMExp; + auto pfnAppendUSMMemcpyExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMMemcpyExp; - if (nullptr == pfnAppendMemcpyUSMExp) { + if (nullptr == pfnAppendUSMMemcpyExp) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_command_buffer_append_memcpy_usm_exp_params_t params = { + ur_command_buffer_append_usm_memcpy_exp_params_t params = { &hCommandBuffer, &pDst, &pSrc, &size, &numSyncPointsInWaitList, &pSyncPointWaitList, &pSyncPoint}; uint64_t instance = - context.notify_begin(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP, - "urCommandBufferAppendMemcpyUSMExp", ¶ms); + context.notify_begin(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP, + "urCommandBufferAppendUSMMemcpyExp", ¶ms); - ur_result_t result = pfnAppendMemcpyUSMExp(hCommandBuffer, pDst, pSrc, size, + ur_result_t result = pfnAppendUSMMemcpyExp(hCommandBuffer, pDst, pSrc, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); - context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP, - "urCommandBufferAppendMemcpyUSMExp", ¶ms, &result, + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP, + "urCommandBufferAppendUSMMemcpyExp", ¶ms, &result, instance); return result; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +/// @brief Intercept function for urCommandBufferAppendUSMFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to fill. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendUSMFillExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMFillExp; + + if (nullptr == pfnAppendUSMFillExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_command_buffer_append_usm_fill_exp_params_t params = { + &hCommandBuffer, &pMemory, &pPattern, + &patternSize, &size, &numSyncPointsInWaitList, + &pSyncPointWaitList, &pSyncPoint}; + uint64_t instance = + context.notify_begin(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP, + "urCommandBufferAppendUSMFillExp", ¶ms); + + ur_result_t result = pfnAppendUSMFillExp( + hCommandBuffer, pMemory, pPattern, patternSize, size, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP, + "urCommandBufferAppendUSMFillExp", ¶ms, &result, + instance); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -5240,14 +5283,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferCopyExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferCopyExp; + auto pfnAppendMemBufferCopyExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferCopyExp; - if (nullptr == pfnAppendMembufferCopyExp) { + if (nullptr == pfnAppendMemBufferCopyExp) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_command_buffer_append_membuffer_copy_exp_params_t params = { + ur_command_buffer_append_mem_buffer_copy_exp_params_t params = { &hCommandBuffer, &hSrcMem, &hDstMem, @@ -5258,23 +5301,23 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( &pSyncPointWaitList, &pSyncPoint}; uint64_t instance = context.notify_begin( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP, - "urCommandBufferAppendMembufferCopyExp", ¶ms); + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP, + "urCommandBufferAppendMemBufferCopyExp", ¶ms); - ur_result_t result = pfnAppendMembufferCopyExp( + ur_result_t result = pfnAppendMemBufferCopyExp( hCommandBuffer, hSrcMem, hDstMem, srcOffset, dstOffset, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); - context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP, - "urCommandBufferAppendMembufferCopyExp", ¶ms, + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP, + "urCommandBufferAppendMemBufferCopyExp", ¶ms, &result, instance); return result; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +/// @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. @@ -5289,14 +5332,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferWriteExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteExp; + auto pfnAppendMemBufferWriteExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferWriteExp; - if (nullptr == pfnAppendMembufferWriteExp) { + if (nullptr == pfnAppendMemBufferWriteExp) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_command_buffer_append_membuffer_write_exp_params_t params = { + ur_command_buffer_append_mem_buffer_write_exp_params_t params = { &hCommandBuffer, &hBuffer, &offset, @@ -5306,23 +5349,23 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( &pSyncPointWaitList, &pSyncPoint}; uint64_t instance = context.notify_begin( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP, - "urCommandBufferAppendMembufferWriteExp", ¶ms); + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP, + "urCommandBufferAppendMemBufferWriteExp", ¶ms); - ur_result_t result = pfnAppendMembufferWriteExp( + 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, + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP, + "urCommandBufferAppendMemBufferWriteExp", ¶ms, &result, instance); return result; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +/// @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. @@ -5336,14 +5379,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferReadExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadExp; + auto pfnAppendMemBufferReadExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferReadExp; - if (nullptr == pfnAppendMembufferReadExp) { + if (nullptr == pfnAppendMemBufferReadExp) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_command_buffer_append_membuffer_read_exp_params_t params = { + ur_command_buffer_append_mem_buffer_read_exp_params_t params = { &hCommandBuffer, &hBuffer, &offset, @@ -5353,23 +5396,23 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( &pSyncPointWaitList, &pSyncPoint}; uint64_t instance = context.notify_begin( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP, - "urCommandBufferAppendMembufferReadExp", ¶ms); + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP, + "urCommandBufferAppendMemBufferReadExp", ¶ms); - ur_result_t result = pfnAppendMembufferReadExp( + 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, + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP, + "urCommandBufferAppendMemBufferReadExp", ¶ms, &result, instance); return result; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -5391,14 +5434,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferCopyRectExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferCopyRectExp; + auto pfnAppendMemBufferCopyRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferCopyRectExp; - if (nullptr == pfnAppendMembufferCopyRectExp) { + if (nullptr == pfnAppendMemBufferCopyRectExp) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_command_buffer_append_membuffer_copy_rect_exp_params_t params = { + ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t params = { &hCommandBuffer, &hSrcMem, &hDstMem, @@ -5413,25 +5456,25 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( &pSyncPointWaitList, &pSyncPoint}; uint64_t instance = context.notify_begin( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP, - "urCommandBufferAppendMembufferCopyRectExp", ¶ms); + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP, + "urCommandBufferAppendMemBufferCopyRectExp", ¶ms); - ur_result_t result = pfnAppendMembufferCopyRectExp( + ur_result_t result = pfnAppendMemBufferCopyRectExp( hCommandBuffer, hSrcMem, hDstMem, srcOrigin, dstOrigin, region, srcRowPitch, srcSlicePitch, dstRowPitch, dstSlicePitch, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); context.notify_end( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP, - "urCommandBufferAppendMembufferCopyRectExp", ¶ms, &result, + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP, + "urCommandBufferAppendMemBufferCopyRectExp", ¶ms, &result, instance); return result; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +/// @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. @@ -5459,14 +5502,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferWriteRectExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteRectExp; + auto pfnAppendMemBufferWriteRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferWriteRectExp; - if (nullptr == pfnAppendMembufferWriteRectExp) { + if (nullptr == pfnAppendMemBufferWriteRectExp) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_command_buffer_append_membuffer_write_rect_exp_params_t params = { + ur_command_buffer_append_mem_buffer_write_rect_exp_params_t params = { &hCommandBuffer, &hBuffer, &bufferOffset, @@ -5481,25 +5524,25 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( &pSyncPointWaitList, &pSyncPoint}; uint64_t instance = context.notify_begin( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP, - "urCommandBufferAppendMembufferWriteRectExp", ¶ms); + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP, + "urCommandBufferAppendMemBufferWriteRectExp", ¶ms); - ur_result_t result = pfnAppendMembufferWriteRectExp( + 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, + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP, + "urCommandBufferAppendMemBufferWriteRectExp", ¶ms, &result, instance); return result; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +/// @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. @@ -5525,14 +5568,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferReadRectExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadRectExp; + auto pfnAppendMemBufferReadRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferReadRectExp; - if (nullptr == pfnAppendMembufferReadRectExp) { + if (nullptr == pfnAppendMemBufferReadRectExp) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_command_buffer_append_membuffer_read_rect_exp_params_t params = { + ur_command_buffer_append_mem_buffer_read_rect_exp_params_t params = { &hCommandBuffer, &hBuffer, &bufferOffset, @@ -5547,22 +5590,72 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( &pSyncPointWaitList, &pSyncPoint}; uint64_t instance = context.notify_begin( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP, - "urCommandBufferAppendMembufferReadRectExp", ¶ms); + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP, + "urCommandBufferAppendMemBufferReadRectExp", ¶ms); - ur_result_t result = pfnAppendMembufferReadRectExp( + 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, + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP, + "urCommandBufferAppendMemBufferReadRectExp", ¶ms, &result, instance); return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( + 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. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t offset, ///< [in] offset into the buffer. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendMemBufferFillExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferFillExp; + + if (nullptr == pfnAppendMemBufferFillExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_command_buffer_append_mem_buffer_fill_exp_params_t params = { + &hCommandBuffer, + &hBuffer, + &pPattern, + &patternSize, + &offset, + &size, + &numSyncPointsInWaitList, + &pSyncPointWaitList, + &pSyncPoint}; + uint64_t instance = context.notify_begin( + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP, + "urCommandBufferAppendMemBufferFillExp", ¶ms); + + ur_result_t result = pfnAppendMemBufferFillExp( + hCommandBuffer, hBuffer, pPattern, patternSize, offset, size, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP, + "urCommandBufferAppendMemBufferFillExp", ¶ms, + &result, instance); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -5943,36 +6036,44 @@ __urdlllocal ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendKernelLaunchExp = ur_tracing_layer::urCommandBufferAppendKernelLaunchExp; - dditable.pfnAppendMemcpyUSMExp = pDdiTable->pfnAppendMemcpyUSMExp; - pDdiTable->pfnAppendMemcpyUSMExp = - ur_tracing_layer::urCommandBufferAppendMemcpyUSMExp; + dditable.pfnAppendUSMMemcpyExp = pDdiTable->pfnAppendUSMMemcpyExp; + pDdiTable->pfnAppendUSMMemcpyExp = + ur_tracing_layer::urCommandBufferAppendUSMMemcpyExp; + + dditable.pfnAppendUSMFillExp = pDdiTable->pfnAppendUSMFillExp; + pDdiTable->pfnAppendUSMFillExp = + ur_tracing_layer::urCommandBufferAppendUSMFillExp; + + dditable.pfnAppendMemBufferCopyExp = pDdiTable->pfnAppendMemBufferCopyExp; + pDdiTable->pfnAppendMemBufferCopyExp = + ur_tracing_layer::urCommandBufferAppendMemBufferCopyExp; - dditable.pfnAppendMembufferCopyExp = pDdiTable->pfnAppendMembufferCopyExp; - pDdiTable->pfnAppendMembufferCopyExp = - ur_tracing_layer::urCommandBufferAppendMembufferCopyExp; + dditable.pfnAppendMemBufferWriteExp = pDdiTable->pfnAppendMemBufferWriteExp; + pDdiTable->pfnAppendMemBufferWriteExp = + ur_tracing_layer::urCommandBufferAppendMemBufferWriteExp; - dditable.pfnAppendMembufferWriteExp = pDdiTable->pfnAppendMembufferWriteExp; - pDdiTable->pfnAppendMembufferWriteExp = - ur_tracing_layer::urCommandBufferAppendMembufferWriteExp; + dditable.pfnAppendMemBufferReadExp = pDdiTable->pfnAppendMemBufferReadExp; + pDdiTable->pfnAppendMemBufferReadExp = + ur_tracing_layer::urCommandBufferAppendMemBufferReadExp; - dditable.pfnAppendMembufferReadExp = pDdiTable->pfnAppendMembufferReadExp; - pDdiTable->pfnAppendMembufferReadExp = - ur_tracing_layer::urCommandBufferAppendMembufferReadExp; + dditable.pfnAppendMemBufferCopyRectExp = + pDdiTable->pfnAppendMemBufferCopyRectExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + ur_tracing_layer::urCommandBufferAppendMemBufferCopyRectExp; - dditable.pfnAppendMembufferCopyRectExp = - pDdiTable->pfnAppendMembufferCopyRectExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - ur_tracing_layer::urCommandBufferAppendMembufferCopyRectExp; + dditable.pfnAppendMemBufferWriteRectExp = + pDdiTable->pfnAppendMemBufferWriteRectExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + ur_tracing_layer::urCommandBufferAppendMemBufferWriteRectExp; - dditable.pfnAppendMembufferWriteRectExp = - pDdiTable->pfnAppendMembufferWriteRectExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - ur_tracing_layer::urCommandBufferAppendMembufferWriteRectExp; + dditable.pfnAppendMemBufferReadRectExp = + pDdiTable->pfnAppendMemBufferReadRectExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + ur_tracing_layer::urCommandBufferAppendMemBufferReadRectExp; - dditable.pfnAppendMembufferReadRectExp = - pDdiTable->pfnAppendMembufferReadRectExp; - pDdiTable->pfnAppendMembufferReadRectExp = - ur_tracing_layer::urCommandBufferAppendMembufferReadRectExp; + dditable.pfnAppendMemBufferFillExp = pDdiTable->pfnAppendMemBufferFillExp; + pDdiTable->pfnAppendMemBufferFillExp = + ur_tracing_layer::urCommandBufferAppendMemBufferFillExp; 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 08cf04c672..efcc2cd9c3 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -6481,8 +6481,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMemcpyUSMExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +/// @brief Intercept function for urCommandBufferAppendUSMMemcpyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. void *pDst, ///< [in] Location the data will be copied to. @@ -6495,10 +6495,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMemcpyUSMExp = - context.urDdiTable.CommandBufferExp.pfnAppendMemcpyUSMExp; + auto pfnAppendUSMMemcpyExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMMemcpyExp; - if (nullptr == pfnAppendMemcpyUSMExp) { + if (nullptr == pfnAppendUSMMemcpyExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6528,7 +6528,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( } } - ur_result_t result = pfnAppendMemcpyUSMExp(hCommandBuffer, pDst, pSrc, size, + ur_result_t result = pfnAppendUSMMemcpyExp(hCommandBuffer, pDst, pSrc, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6536,8 +6536,77 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +/// @brief Intercept function for urCommandBufferAppendUSMFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to fill. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendUSMFillExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMFillExp; + + if (nullptr == pfnAppendUSMFillExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (context.enableParameterValidation) { + if (NULL == hCommandBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == pMemory) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (NULL == pPattern) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (patternSize == 0 || size == 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + if (patternSize > size) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + if ((patternSize & (patternSize - 1)) != 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + if (size % patternSize != 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + 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 = pfnAppendUSMFillExp( + hCommandBuffer, pMemory, pPattern, patternSize, size, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -6552,10 +6621,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferCopyExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferCopyExp; + auto pfnAppendMemBufferCopyExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferCopyExp; - if (nullptr == pfnAppendMembufferCopyExp) { + if (nullptr == pfnAppendMemBufferCopyExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6581,7 +6650,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( } } - ur_result_t result = pfnAppendMembufferCopyExp( + ur_result_t result = pfnAppendMemBufferCopyExp( hCommandBuffer, hSrcMem, hDstMem, srcOffset, dstOffset, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6589,8 +6658,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +/// @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. @@ -6605,10 +6674,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferWriteExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteExp; + auto pfnAppendMemBufferWriteExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferWriteExp; - if (nullptr == pfnAppendMembufferWriteExp) { + if (nullptr == pfnAppendMemBufferWriteExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6634,7 +6703,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( } } - ur_result_t result = pfnAppendMembufferWriteExp( + ur_result_t result = pfnAppendMemBufferWriteExp( hCommandBuffer, hBuffer, offset, size, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6642,8 +6711,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +/// @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. @@ -6657,10 +6726,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferReadExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadExp; + auto pfnAppendMemBufferReadExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferReadExp; - if (nullptr == pfnAppendMembufferReadExp) { + if (nullptr == pfnAppendMemBufferReadExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6686,7 +6755,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( } } - ur_result_t result = pfnAppendMembufferReadExp( + ur_result_t result = pfnAppendMemBufferReadExp( hCommandBuffer, hBuffer, offset, size, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6694,8 +6763,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -6717,10 +6786,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferCopyRectExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferCopyRectExp; + auto pfnAppendMemBufferCopyRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferCopyRectExp; - if (nullptr == pfnAppendMembufferCopyRectExp) { + if (nullptr == pfnAppendMemBufferCopyRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6746,7 +6815,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( } } - ur_result_t result = pfnAppendMembufferCopyRectExp( + ur_result_t result = pfnAppendMemBufferCopyRectExp( hCommandBuffer, hSrcMem, hDstMem, srcOrigin, dstOrigin, region, srcRowPitch, srcSlicePitch, dstRowPitch, dstSlicePitch, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6755,8 +6824,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +/// @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. @@ -6784,10 +6853,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferWriteRectExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteRectExp; + auto pfnAppendMemBufferWriteRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferWriteRectExp; - if (nullptr == pfnAppendMembufferWriteRectExp) { + if (nullptr == pfnAppendMemBufferWriteRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6813,7 +6882,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( } } - ur_result_t result = pfnAppendMembufferWriteRectExp( + ur_result_t result = pfnAppendMemBufferWriteRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6822,8 +6891,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +/// @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. @@ -6849,10 +6918,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferReadRectExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadRectExp; + auto pfnAppendMemBufferReadRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferReadRectExp; - if (nullptr == pfnAppendMembufferReadRectExp) { + if (nullptr == pfnAppendMemBufferReadRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6878,7 +6947,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( } } - ur_result_t result = pfnAppendMembufferReadRectExp( + ur_result_t result = pfnAppendMemBufferReadRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6886,6 +6955,60 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( + 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. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t offset, ///< [in] offset into the buffer. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendMemBufferFillExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferFillExp; + + if (nullptr == pfnAppendMemBufferFillExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + 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 == pPattern) { + 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 = pfnAppendMemBufferFillExp( + hCommandBuffer, hBuffer, pPattern, patternSize, offset, size, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -7304,36 +7427,44 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendKernelLaunchExp = ur_validation_layer::urCommandBufferAppendKernelLaunchExp; - dditable.pfnAppendMemcpyUSMExp = pDdiTable->pfnAppendMemcpyUSMExp; - pDdiTable->pfnAppendMemcpyUSMExp = - ur_validation_layer::urCommandBufferAppendMemcpyUSMExp; + dditable.pfnAppendUSMMemcpyExp = pDdiTable->pfnAppendUSMMemcpyExp; + pDdiTable->pfnAppendUSMMemcpyExp = + ur_validation_layer::urCommandBufferAppendUSMMemcpyExp; + + dditable.pfnAppendUSMFillExp = pDdiTable->pfnAppendUSMFillExp; + pDdiTable->pfnAppendUSMFillExp = + ur_validation_layer::urCommandBufferAppendUSMFillExp; + + dditable.pfnAppendMemBufferCopyExp = pDdiTable->pfnAppendMemBufferCopyExp; + pDdiTable->pfnAppendMemBufferCopyExp = + ur_validation_layer::urCommandBufferAppendMemBufferCopyExp; - dditable.pfnAppendMembufferCopyExp = pDdiTable->pfnAppendMembufferCopyExp; - pDdiTable->pfnAppendMembufferCopyExp = - ur_validation_layer::urCommandBufferAppendMembufferCopyExp; + dditable.pfnAppendMemBufferWriteExp = pDdiTable->pfnAppendMemBufferWriteExp; + pDdiTable->pfnAppendMemBufferWriteExp = + ur_validation_layer::urCommandBufferAppendMemBufferWriteExp; - dditable.pfnAppendMembufferWriteExp = pDdiTable->pfnAppendMembufferWriteExp; - pDdiTable->pfnAppendMembufferWriteExp = - ur_validation_layer::urCommandBufferAppendMembufferWriteExp; + dditable.pfnAppendMemBufferReadExp = pDdiTable->pfnAppendMemBufferReadExp; + pDdiTable->pfnAppendMemBufferReadExp = + ur_validation_layer::urCommandBufferAppendMemBufferReadExp; - dditable.pfnAppendMembufferReadExp = pDdiTable->pfnAppendMembufferReadExp; - pDdiTable->pfnAppendMembufferReadExp = - ur_validation_layer::urCommandBufferAppendMembufferReadExp; + dditable.pfnAppendMemBufferCopyRectExp = + pDdiTable->pfnAppendMemBufferCopyRectExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + ur_validation_layer::urCommandBufferAppendMemBufferCopyRectExp; - dditable.pfnAppendMembufferCopyRectExp = - pDdiTable->pfnAppendMembufferCopyRectExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - ur_validation_layer::urCommandBufferAppendMembufferCopyRectExp; + dditable.pfnAppendMemBufferWriteRectExp = + pDdiTable->pfnAppendMemBufferWriteRectExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + ur_validation_layer::urCommandBufferAppendMemBufferWriteRectExp; - dditable.pfnAppendMembufferWriteRectExp = - pDdiTable->pfnAppendMembufferWriteRectExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - ur_validation_layer::urCommandBufferAppendMembufferWriteRectExp; + dditable.pfnAppendMemBufferReadRectExp = + pDdiTable->pfnAppendMemBufferReadRectExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + ur_validation_layer::urCommandBufferAppendMemBufferReadRectExp; - dditable.pfnAppendMembufferReadRectExp = - pDdiTable->pfnAppendMembufferReadRectExp; - pDdiTable->pfnAppendMembufferReadRectExp = - ur_validation_layer::urCommandBufferAppendMembufferReadRectExp; + dditable.pfnAppendMemBufferFillExp = pDdiTable->pfnAppendMemBufferFillExp; + pDdiTable->pfnAppendMemBufferFillExp = + ur_validation_layer::urCommandBufferAppendMemBufferFillExp; 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 ce615c9945..7776758069 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -6345,8 +6345,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMemcpyUSMExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +/// @brief Intercept function for urCommandBufferAppendUSMMemcpyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. void *pDst, ///< [in] Location the data will be copied to. @@ -6365,9 +6365,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( auto dditable = reinterpret_cast(hCommandBuffer) ->dditable; - auto pfnAppendMemcpyUSMExp = - dditable->ur.CommandBufferExp.pfnAppendMemcpyUSMExp; - if (nullptr == pfnAppendMemcpyUSMExp) { + auto pfnAppendUSMMemcpyExp = + dditable->ur.CommandBufferExp.pfnAppendUSMMemcpyExp; + if (nullptr == pfnAppendUSMMemcpyExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6377,7 +6377,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( ->handle; // forward to device-platform - result = pfnAppendMemcpyUSMExp(hCommandBuffer, pDst, pSrc, size, + result = pfnAppendUSMMemcpyExp(hCommandBuffer, pDst, pSrc, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6385,8 +6385,50 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +/// @brief Intercept function for urCommandBufferAppendUSMFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to fill. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + 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 pfnAppendUSMFillExp = + dditable->ur.CommandBufferExp.pfnAppendUSMFillExp; + if (nullptr == pfnAppendUSMFillExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hCommandBuffer = + reinterpret_cast(hCommandBuffer) + ->handle; + + // forward to device-platform + result = pfnAppendUSMFillExp(hCommandBuffer, pMemory, pPattern, patternSize, + size, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -6407,9 +6449,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( auto dditable = reinterpret_cast(hCommandBuffer) ->dditable; - auto pfnAppendMembufferCopyExp = - dditable->ur.CommandBufferExp.pfnAppendMembufferCopyExp; - if (nullptr == pfnAppendMembufferCopyExp) { + auto pfnAppendMemBufferCopyExp = + dditable->ur.CommandBufferExp.pfnAppendMemBufferCopyExp; + if (nullptr == pfnAppendMemBufferCopyExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6425,7 +6467,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( hDstMem = reinterpret_cast(hDstMem)->handle; // forward to device-platform - result = pfnAppendMembufferCopyExp( + result = pfnAppendMemBufferCopyExp( hCommandBuffer, hSrcMem, hDstMem, srcOffset, dstOffset, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6433,8 +6475,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +/// @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. @@ -6455,9 +6497,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( auto dditable = reinterpret_cast(hCommandBuffer) ->dditable; - auto pfnAppendMembufferWriteExp = - dditable->ur.CommandBufferExp.pfnAppendMembufferWriteExp; - if (nullptr == pfnAppendMembufferWriteExp) { + auto pfnAppendMemBufferWriteExp = + dditable->ur.CommandBufferExp.pfnAppendMemBufferWriteExp; + if (nullptr == pfnAppendMemBufferWriteExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6470,7 +6512,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( hBuffer = reinterpret_cast(hBuffer)->handle; // forward to device-platform - result = pfnAppendMembufferWriteExp(hCommandBuffer, hBuffer, offset, size, + result = pfnAppendMemBufferWriteExp(hCommandBuffer, hBuffer, offset, size, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6478,8 +6520,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +/// @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. @@ -6499,9 +6541,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( auto dditable = reinterpret_cast(hCommandBuffer) ->dditable; - auto pfnAppendMembufferReadExp = - dditable->ur.CommandBufferExp.pfnAppendMembufferReadExp; - if (nullptr == pfnAppendMembufferReadExp) { + auto pfnAppendMemBufferReadExp = + dditable->ur.CommandBufferExp.pfnAppendMemBufferReadExp; + if (nullptr == pfnAppendMemBufferReadExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6514,7 +6556,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( hBuffer = reinterpret_cast(hBuffer)->handle; // forward to device-platform - result = pfnAppendMembufferReadExp(hCommandBuffer, hBuffer, offset, size, + result = pfnAppendMemBufferReadExp(hCommandBuffer, hBuffer, offset, size, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6522,8 +6564,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -6551,9 +6593,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( auto dditable = reinterpret_cast(hCommandBuffer) ->dditable; - auto pfnAppendMembufferCopyRectExp = - dditable->ur.CommandBufferExp.pfnAppendMembufferCopyRectExp; - if (nullptr == pfnAppendMembufferCopyRectExp) { + auto pfnAppendMemBufferCopyRectExp = + dditable->ur.CommandBufferExp.pfnAppendMemBufferCopyRectExp; + if (nullptr == pfnAppendMemBufferCopyRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6569,7 +6611,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( hDstMem = reinterpret_cast(hDstMem)->handle; // forward to device-platform - result = pfnAppendMembufferCopyRectExp( + result = pfnAppendMemBufferCopyRectExp( hCommandBuffer, hSrcMem, hDstMem, srcOrigin, dstOrigin, region, srcRowPitch, srcSlicePitch, dstRowPitch, dstSlicePitch, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6578,8 +6620,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +/// @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. @@ -6613,9 +6655,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( auto dditable = reinterpret_cast(hCommandBuffer) ->dditable; - auto pfnAppendMembufferWriteRectExp = - dditable->ur.CommandBufferExp.pfnAppendMembufferWriteRectExp; - if (nullptr == pfnAppendMembufferWriteRectExp) { + auto pfnAppendMemBufferWriteRectExp = + dditable->ur.CommandBufferExp.pfnAppendMemBufferWriteRectExp; + if (nullptr == pfnAppendMemBufferWriteRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6628,7 +6670,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( hBuffer = reinterpret_cast(hBuffer)->handle; // forward to device-platform - result = pfnAppendMembufferWriteRectExp( + result = pfnAppendMemBufferWriteRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6637,8 +6679,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +/// @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. @@ -6670,9 +6712,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( auto dditable = reinterpret_cast(hCommandBuffer) ->dditable; - auto pfnAppendMembufferReadRectExp = - dditable->ur.CommandBufferExp.pfnAppendMembufferReadRectExp; - if (nullptr == pfnAppendMembufferReadRectExp) { + auto pfnAppendMemBufferReadRectExp = + dditable->ur.CommandBufferExp.pfnAppendMemBufferReadRectExp; + if (nullptr == pfnAppendMemBufferReadRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6685,7 +6727,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( hBuffer = reinterpret_cast(hBuffer)->handle; // forward to device-platform - result = pfnAppendMembufferReadRectExp( + result = pfnAppendMemBufferReadRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6693,6 +6735,52 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( + 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. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t offset, ///< [in] offset into the buffer. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + 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 pfnAppendMemBufferFillExp = + dditable->ur.CommandBufferExp.pfnAppendMemBufferFillExp; + if (nullptr == pfnAppendMemBufferFillExp) { + 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 = pfnAppendMemBufferFillExp( + hCommandBuffer, hBuffer, pPattern, patternSize, offset, size, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -7115,20 +7203,24 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnFinalizeExp = ur_loader::urCommandBufferFinalizeExp; pDdiTable->pfnAppendKernelLaunchExp = ur_loader::urCommandBufferAppendKernelLaunchExp; - pDdiTable->pfnAppendMemcpyUSMExp = - 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->pfnAppendUSMMemcpyExp = + ur_loader::urCommandBufferAppendUSMMemcpyExp; + pDdiTable->pfnAppendUSMFillExp = + ur_loader::urCommandBufferAppendUSMFillExp; + 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->pfnAppendMemBufferFillExp = + ur_loader::urCommandBufferAppendMemBufferFillExp; 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 e7a75147a5..a61caf39ec 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -7105,7 +7105,7 @@ ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( /// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. void *pDst, ///< [in] Location the data will be copied to. @@ -7118,19 +7118,74 @@ ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) try { - auto pfnAppendMemcpyUSMExp = - ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMemcpyUSMExp; - if (nullptr == pfnAppendMemcpyUSMExp) { + auto pfnAppendUSMMemcpyExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendUSMMemcpyExp; + if (nullptr == pfnAppendUSMMemcpyExp) { return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnAppendMemcpyUSMExp(hCommandBuffer, pDst, pSrc, size, + return pfnAppendUSMMemcpyExp(hCommandBuffer, pDst, pSrc, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } catch (...) { return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM fill command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// + `NULL == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `patternSize == 0 || size == 0` +/// + `patternSize > size` +/// + `(patternSize & (patternSize - 1)) != 0` +/// + `size % patternSize != 0` +/// + If `size` is higher than the allocation size of `ptr` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to fill. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. + ) try { + auto pfnAppendUSMFillExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendUSMFillExp; + if (nullptr == pfnAppendUSMFillExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnAppendUSMFillExp(hCommandBuffer, pMemory, pPattern, patternSize, + size, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Append a memory copy command to a command-buffer object /// @@ -7151,7 +7206,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -7166,13 +7221,13 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) try { - auto pfnAppendMembufferCopyExp = - ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMembufferCopyExp; - if (nullptr == pfnAppendMembufferCopyExp) { + auto pfnAppendMemBufferCopyExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMemBufferCopyExp; + if (nullptr == pfnAppendMemBufferCopyExp) { return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnAppendMembufferCopyExp( + return pfnAppendMemBufferCopyExp( hCommandBuffer, hSrcMem, hDstMem, srcOffset, dstOffset, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } catch (...) { @@ -7200,7 +7255,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( /// - ::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_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. @@ -7215,13 +7270,13 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( 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) { + auto pfnAppendMemBufferWriteExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMemBufferWriteExp; + if (nullptr == pfnAppendMemBufferWriteExp) { return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnAppendMembufferWriteExp(hCommandBuffer, hBuffer, offset, size, + return pfnAppendMemBufferWriteExp(hCommandBuffer, hBuffer, offset, size, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } catch (...) { @@ -7249,7 +7304,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( /// - ::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_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. @@ -7263,13 +7318,13 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( 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) { + auto pfnAppendMemBufferReadExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMemBufferReadExp; + if (nullptr == pfnAppendMemBufferReadExp) { return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnAppendMembufferReadExp(hCommandBuffer, hBuffer, offset, size, + return pfnAppendMemBufferReadExp(hCommandBuffer, hBuffer, offset, size, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } catch (...) { @@ -7296,7 +7351,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -7318,14 +7373,14 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) try { - auto pfnAppendMembufferCopyRectExp = + auto pfnAppendMemBufferCopyRectExp = ur_lib::context->urDdiTable.CommandBufferExp - .pfnAppendMembufferCopyRectExp; - if (nullptr == pfnAppendMembufferCopyRectExp) { + .pfnAppendMemBufferCopyRectExp; + if (nullptr == pfnAppendMemBufferCopyRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnAppendMembufferCopyRectExp( + return pfnAppendMemBufferCopyRectExp( hCommandBuffer, hSrcMem, hDstMem, srcOrigin, dstOrigin, region, srcRowPitch, srcSlicePitch, dstRowPitch, dstSlicePitch, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -7354,7 +7409,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( /// - ::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_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. @@ -7382,14 +7437,14 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) try { - auto pfnAppendMembufferWriteRectExp = + auto pfnAppendMemBufferWriteRectExp = ur_lib::context->urDdiTable.CommandBufferExp - .pfnAppendMembufferWriteRectExp; - if (nullptr == pfnAppendMembufferWriteRectExp) { + .pfnAppendMemBufferWriteRectExp; + if (nullptr == pfnAppendMemBufferWriteRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnAppendMembufferWriteRectExp( + return pfnAppendMemBufferWriteRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -7418,7 +7473,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( /// - ::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_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. @@ -7444,14 +7499,14 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) try { - auto pfnAppendMembufferReadRectExp = + auto pfnAppendMemBufferReadRectExp = ur_lib::context->urDdiTable.CommandBufferExp - .pfnAppendMembufferReadRectExp; - if (nullptr == pfnAppendMembufferReadRectExp) { + .pfnAppendMemBufferReadRectExp; + if (nullptr == pfnAppendMemBufferReadRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnAppendMembufferReadRectExp( + return pfnAppendMemBufferReadRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -7459,6 +7514,58 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory fill 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 == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + If `offset + size` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( + 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. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t offset, ///< [in] offset into the buffer. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. + ) try { + auto pfnAppendMemBufferFillExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMemBufferFillExp; + if (nullptr == pfnAppendMemBufferFillExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnAppendMemBufferFillExp( + hCommandBuffer, hBuffer, pPattern, patternSize, offset, size, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Submit a command-buffer for execution on a queue. /// diff --git a/source/ur_api.cpp b/source/ur_api.cpp index e841204835..5dde244596 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -6005,7 +6005,7 @@ ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( /// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. void *pDst, ///< [in] Location the data will be copied to. @@ -6022,6 +6022,52 @@ ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM fill command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// + `NULL == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `patternSize == 0 || size == 0` +/// + `patternSize > size` +/// + `(patternSize & (patternSize - 1)) != 0` +/// + `size % patternSize != 0` +/// + If `size` is higher than the allocation size of `ptr` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::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_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to fill. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + 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 copy command to a command-buffer object /// @@ -6042,7 +6088,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -6082,7 +6128,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( /// - ::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_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. @@ -6122,7 +6168,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( /// - ::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_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. @@ -6160,7 +6206,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -6207,7 +6253,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( /// - ::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_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. @@ -6260,7 +6306,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( /// - ::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_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. @@ -6290,6 +6336,49 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory fill 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 == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + If `offset + size` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( + 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. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t offset, ///< [in] offset into the buffer. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + 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. ///