From e46f3fb25048a3cbb1752823e4829a9296b6f1f0 Mon Sep 17 00:00:00 2001 From: Przemek Malon Date: Fri, 14 Jul 2023 10:39:12 +0100 Subject: [PATCH] [Bindless][Exp] Update struct and param naming style to adhere to convention --- include/ur.py | 10 ++++---- include/ur_api.h | 22 ++++++++--------- include/ur_ddi.h | 2 +- scripts/core/EXP-BINDLESS-IMAGES.rst | 6 +++-- scripts/core/exp-bindless-images.yml | 10 ++++---- source/adapters/null/ur_nullddi.cpp | 6 ++--- source/common/ur_params.hpp | 24 +++++++++---------- source/loader/layers/tracing/ur_trcddi.cpp | 8 +++---- source/loader/layers/validation/ur_valddi.cpp | 8 +++---- source/loader/ur_ldrddi.cpp | 6 ++--- source/loader/ur_libapi.cpp | 8 +++---- source/ur_api.cpp | 6 ++--- 12 files changed, 59 insertions(+), 57 deletions(-) diff --git a/include/ur.py b/include/ur.py index 39888418af..f6a8d0ab3c 100644 --- a/include/ur.py +++ b/include/ur.py @@ -232,7 +232,7 @@ class ur_structure_type_v(IntEnum): KERNEL_ARG_LOCAL_PROPERTIES = 33 ## ::ur_kernel_arg_local_properties_t EXP_COMMAND_BUFFER_DESC = 0x1000 ## ::ur_exp_command_buffer_desc_t EXP_SAMPLER_MIP_PROPERTIES = 0x2000 ## ::ur_exp_sampler_mip_properties_t - EXP_INTEROP_MEMORY_DESC = 0x2001 ## ::ur_exp_interop_memory_desc_t + EXP_INTEROP_MEM_DESC = 0x2001 ## ::ur_exp_interop_mem_desc_t EXP_INTEROP_SEMAPHORE_DESC = 0x2002 ## ::ur_exp_interop_semaphore_desc_t EXP_FILE_DESCRIPTOR = 0x2003 ## ::ur_exp_file_descriptor_t EXP_WIN32_HANDLE = 0x2004 ## ::ur_exp_win32_handle_t @@ -2143,10 +2143,10 @@ class ur_exp_sampler_mip_properties_t(Structure): ############################################################################### ## @brief Describes an interop memory resource descriptor -class ur_exp_interop_memory_desc_t(Structure): +class ur_exp_interop_mem_desc_t(Structure): _fields_ = [ ("stype", ur_structure_type_t), ## [in] type of this structure, must be - ## ::UR_STRUCTURE_TYPE_EXP_INTEROP_MEMORY_DESC + ## ::UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC ("pNext", c_void_p) ## [in][optional] pointer to extension-specific structure ] @@ -3159,9 +3159,9 @@ class ur_queue_dditable_t(Structure): ############################################################################### ## @brief Function-pointer for urBindlessImagesImportOpaqueFDExp if __use_win_types: - _urBindlessImagesImportOpaqueFDExp_t = WINFUNCTYPE( ur_result_t, ur_context_handle_t, ur_device_handle_t, c_size_t, POINTER(ur_exp_interop_memory_desc_t), POINTER(ur_exp_interop_mem_handle_t) ) + _urBindlessImagesImportOpaqueFDExp_t = WINFUNCTYPE( ur_result_t, ur_context_handle_t, ur_device_handle_t, c_size_t, POINTER(ur_exp_interop_mem_desc_t), POINTER(ur_exp_interop_mem_handle_t) ) else: - _urBindlessImagesImportOpaqueFDExp_t = CFUNCTYPE( ur_result_t, ur_context_handle_t, ur_device_handle_t, c_size_t, POINTER(ur_exp_interop_memory_desc_t), POINTER(ur_exp_interop_mem_handle_t) ) + _urBindlessImagesImportOpaqueFDExp_t = CFUNCTYPE( ur_result_t, ur_context_handle_t, ur_device_handle_t, c_size_t, POINTER(ur_exp_interop_mem_desc_t), POINTER(ur_exp_interop_mem_handle_t) ) ############################################################################### ## @brief Function-pointer for urBindlessImagesMapExternalArrayExp diff --git a/include/ur_api.h b/include/ur_api.h index de09cda21f..99f4d71872 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -241,7 +241,7 @@ typedef enum ur_structure_type_t { UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES = 33, ///< ::ur_kernel_arg_local_properties_t UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC = 0x1000, ///< ::ur_exp_command_buffer_desc_t UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES = 0x2000, ///< ::ur_exp_sampler_mip_properties_t - UR_STRUCTURE_TYPE_EXP_INTEROP_MEMORY_DESC = 0x2001, ///< ::ur_exp_interop_memory_desc_t + UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC = 0x2001, ///< ::ur_exp_interop_mem_desc_t UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC = 0x2002, ///< ::ur_exp_interop_semaphore_desc_t UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR = 0x2003, ///< ::ur_exp_file_descriptor_t UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE = 0x2004, ///< ::ur_exp_win32_handle_t @@ -6662,12 +6662,12 @@ typedef struct ur_exp_sampler_mip_properties_t { /////////////////////////////////////////////////////////////////////////////// /// @brief Describes an interop memory resource descriptor -typedef struct ur_exp_interop_memory_desc_t { +typedef struct ur_exp_interop_mem_desc_t { ur_structure_type_t stype; ///< [in] type of this structure, must be - ///< ::UR_STRUCTURE_TYPE_EXP_INTEROP_MEMORY_DESC + ///< ::UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC const void *pNext; ///< [in][optional] pointer to extension-specific structure -} ur_exp_interop_memory_desc_t; +} ur_exp_interop_mem_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Describes an interop semaphore resource descriptor @@ -7076,18 +7076,18 @@ urBindlessImagesMipmapFreeExp( /// + `NULL == hContext` /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == interopMemDesc` +/// + `NULL == pInteropMemDesc` /// + `NULL == phInteropMem` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( - ur_context_handle_t hContext, ///< [in] handle of the context object - ur_device_handle_t hDevice, ///< [in] handle of the device object - size_t size, ///< [in] size of the external memory - ur_exp_interop_memory_desc_t *interopMemDesc, ///< [in] the interop memory descriptor - ur_exp_interop_mem_handle_t *phInteropMem ///< [out] interop memory handle to the external memory + ur_context_handle_t hContext, ///< [in] handle of the context object + ur_device_handle_t hDevice, ///< [in] handle of the device object + size_t size, ///< [in] size of the external memory + ur_exp_interop_mem_desc_t *pInteropMemDesc, ///< [in] the interop memory descriptor + ur_exp_interop_mem_handle_t *phInteropMem ///< [out] interop memory handle to the external memory ); /////////////////////////////////////////////////////////////////////////////// @@ -9243,7 +9243,7 @@ typedef struct ur_bindless_images_import_opaque_fd_exp_params_t { ur_context_handle_t *phContext; ur_device_handle_t *phDevice; size_t *psize; - ur_exp_interop_memory_desc_t **pinteropMemDesc; + ur_exp_interop_mem_desc_t **ppInteropMemDesc; ur_exp_interop_mem_handle_t **pphInteropMem; } ur_bindless_images_import_opaque_fd_exp_params_t; diff --git a/include/ur_ddi.h b/include/ur_ddi.h index 66ab7cde74..8856249ed7 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -1375,7 +1375,7 @@ typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImportOpaqueFDExp_t)( ur_context_handle_t, ur_device_handle_t, size_t, - ur_exp_interop_memory_desc_t *, + ur_exp_interop_mem_desc_t *, ur_exp_interop_mem_handle_t *); /////////////////////////////////////////////////////////////////////////////// diff --git a/scripts/core/EXP-BINDLESS-IMAGES.rst b/scripts/core/EXP-BINDLESS-IMAGES.rst index d7d1bd4486..5a001f2915 100644 --- a/scripts/core/EXP-BINDLESS-IMAGES.rst +++ b/scripts/core/EXP-BINDLESS-IMAGES.rst @@ -64,7 +64,7 @@ Enums ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ${x}_structure_type_t ${X}_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES - ${X}_STRUCTURE_TYPE_EXP_INTEROP_MEMORY_DESC + ${X}_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC ${X}_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC ${X}_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR ${X}_STRUCTURE_TYPE_EXP_WIN32_HANDLE @@ -123,7 +123,7 @@ Types * ${x}_exp_image_mem_handle_t * ${x}_exp_interop_mem_handle_t * ${x}_exp_interop_semaphore_handle_t -* ${x}_exp_interop_memory_desc_t +* ${x}_exp_interop_mem_desc_t * ${x}_exp_interop_semaphore_desc_t * ${x}_exp_file_descriptor_t * ${x}_exp_win32_handle_t @@ -172,6 +172,8 @@ Changelog | 4.0 || Added platform specific interop resource handles. | | || Added and updated to use new interop resource descriptors. | +----------+-------------------------------------------------------------+ +| 5.0 | Update interop struct and func param names to adhere to convention. | ++----------+-------------------------------------------------------------+ Contributors -------------------------------------------------------------------------------- diff --git a/scripts/core/exp-bindless-images.yml b/scripts/core/exp-bindless-images.yml index a84d571807..993c95add8 100644 --- a/scripts/core/exp-bindless-images.yml +++ b/scripts/core/exp-bindless-images.yml @@ -86,8 +86,8 @@ etors: - name: EXP_SAMPLER_MIP_PROPERTIES desc: $x_exp_sampler_mip_properties_t value: "0x2000" - - name: EXP_INTEROP_MEMORY_DESC - desc: $x_exp_interop_memory_desc_t + - name: EXP_INTEROP_MEM_DESC + desc: $x_exp_interop_mem_desc_t value: "0x2001" - name: EXP_INTEROP_SEMAPHORE_DESC desc: $x_exp_interop_semaphore_desc_t @@ -166,7 +166,7 @@ members: type: struct desc: "Describes an interop memory resource descriptor" class: $xBindlessImages -name: $x_exp_interop_memory_desc_t +name: $x_exp_interop_mem_desc_t base: $x_base_desc_t members: [] --- #-------------------------------------------------------------------------- @@ -562,8 +562,8 @@ params: - type: size_t name: size desc: "[in] size of the external memory" - - type: $x_exp_interop_memory_desc_t* - name: interopMemDesc + - type: $x_exp_interop_mem_desc_t* + name: pInteropMemDesc desc: "[in] the interop memory descriptor" - type: $x_exp_interop_mem_handle_t* name: phInteropMem diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index 91d91d6910..e2d80641cc 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -4128,8 +4128,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( ur_context_handle_t hContext, ///< [in] handle of the context object ur_device_handle_t hDevice, ///< [in] handle of the device object size_t size, ///< [in] size of the external memory - ur_exp_interop_memory_desc_t - *interopMemDesc, ///< [in] the interop memory descriptor + ur_exp_interop_mem_desc_t + *pInteropMemDesc, ///< [in] the interop memory descriptor ur_exp_interop_mem_handle_t *phInteropMem ///< [out] interop memory handle to the external memory ) try { @@ -4139,7 +4139,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( auto pfnImportOpaqueFDExp = d_context.urDdiTable.BindlessImagesExp.pfnImportOpaqueFDExp; if (nullptr != pfnImportOpaqueFDExp) { - result = pfnImportOpaqueFDExp(hContext, hDevice, size, interopMemDesc, + result = pfnImportOpaqueFDExp(hContext, hDevice, size, pInteropMemDesc, phInteropMem); } else { // generic implementation diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 3036d2791e..c9f0cf0201 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -396,8 +396,8 @@ inline std::ostream &operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, const struct ur_exp_sampler_mip_properties_t params); -inline std::ostream & -operator<<(std::ostream &os, const struct ur_exp_interop_memory_desc_t params); +inline std::ostream &operator<<(std::ostream &os, + const struct ur_exp_interop_mem_desc_t params); inline std::ostream & operator<<(std::ostream &os, const struct ur_exp_interop_semaphore_desc_t params); @@ -1223,8 +1223,8 @@ inline std::ostream &operator<<(std::ostream &os, os << "UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_EXP_INTEROP_MEMORY_DESC: - os << "UR_STRUCTURE_TYPE_EXP_INTEROP_MEMORY_DESC"; + case UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC: + os << "UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC"; break; case UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC: @@ -1462,9 +1462,9 @@ inline void serializeStruct(std::ostream &os, const void *ptr) { ur_params::serializePtr(os, pstruct); } break; - case UR_STRUCTURE_TYPE_EXP_INTEROP_MEMORY_DESC: { - const ur_exp_interop_memory_desc_t *pstruct = - (const ur_exp_interop_memory_desc_t *)ptr; + case UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC: { + const ur_exp_interop_mem_desc_t *pstruct = + (const ur_exp_interop_mem_desc_t *)ptr; ur_params::serializePtr(os, pstruct); } break; @@ -9590,9 +9590,9 @@ operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, const struct ur_exp_interop_memory_desc_t params) { - os << "(struct ur_exp_interop_memory_desc_t){"; +inline std::ostream &operator<<(std::ostream &os, + const struct ur_exp_interop_mem_desc_t params) { + os << "(struct ur_exp_interop_mem_desc_t){"; os << ".stype = "; @@ -10083,9 +10083,9 @@ inline std::ostream &operator<<( os << *(params->psize); os << ", "; - os << ".interopMemDesc = "; + os << ".pInteropMemDesc = "; - ur_params::serializePtr(os, *(params->pinteropMemDesc)); + ur_params::serializePtr(os, *(params->ppInteropMemDesc)); os << ", "; os << ".phInteropMem = "; diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index ff9892fc2e..f0ccc8fea9 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -4700,8 +4700,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( ur_context_handle_t hContext, ///< [in] handle of the context object ur_device_handle_t hDevice, ///< [in] handle of the device object size_t size, ///< [in] size of the external memory - ur_exp_interop_memory_desc_t - *interopMemDesc, ///< [in] the interop memory descriptor + ur_exp_interop_mem_desc_t + *pInteropMemDesc, ///< [in] the interop memory descriptor ur_exp_interop_mem_handle_t *phInteropMem ///< [out] interop memory handle to the external memory ) { @@ -4713,13 +4713,13 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( } ur_bindless_images_import_opaque_fd_exp_params_t params = { - &hContext, &hDevice, &size, &interopMemDesc, &phInteropMem}; + &hContext, &hDevice, &size, &pInteropMemDesc, &phInteropMem}; uint64_t instance = context.notify_begin(UR_FUNCTION_BINDLESS_IMAGES_IMPORT_OPAQUE_FD_EXP, "urBindlessImagesImportOpaqueFDExp", ¶ms); ur_result_t result = pfnImportOpaqueFDExp(hContext, hDevice, size, - interopMemDesc, phInteropMem); + pInteropMemDesc, phInteropMem); context.notify_end(UR_FUNCTION_BINDLESS_IMAGES_IMPORT_OPAQUE_FD_EXP, "urBindlessImagesImportOpaqueFDExp", ¶ms, &result, diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index a1bd38d8ea..a79756d755 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -5955,8 +5955,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( ur_context_handle_t hContext, ///< [in] handle of the context object ur_device_handle_t hDevice, ///< [in] handle of the device object size_t size, ///< [in] size of the external memory - ur_exp_interop_memory_desc_t - *interopMemDesc, ///< [in] the interop memory descriptor + ur_exp_interop_mem_desc_t + *pInteropMemDesc, ///< [in] the interop memory descriptor ur_exp_interop_mem_handle_t *phInteropMem ///< [out] interop memory handle to the external memory ) { @@ -5976,7 +5976,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( return UR_RESULT_ERROR_INVALID_NULL_HANDLE; } - if (NULL == interopMemDesc) { + if (NULL == pInteropMemDesc) { return UR_RESULT_ERROR_INVALID_NULL_POINTER; } @@ -5986,7 +5986,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( } ur_result_t result = pfnImportOpaqueFDExp(hContext, hDevice, size, - interopMemDesc, phInteropMem); + pInteropMemDesc, phInteropMem); return result; } diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 4fd29c846a..7ae7865d0c 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -5725,8 +5725,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( ur_context_handle_t hContext, ///< [in] handle of the context object ur_device_handle_t hDevice, ///< [in] handle of the device object size_t size, ///< [in] size of the external memory - ur_exp_interop_memory_desc_t - *interopMemDesc, ///< [in] the interop memory descriptor + ur_exp_interop_mem_desc_t + *pInteropMemDesc, ///< [in] the interop memory descriptor ur_exp_interop_mem_handle_t *phInteropMem ///< [out] interop memory handle to the external memory ) { @@ -5747,7 +5747,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( hDevice = reinterpret_cast(hDevice)->handle; // forward to device-platform - result = pfnImportOpaqueFDExp(hContext, hDevice, size, interopMemDesc, + result = pfnImportOpaqueFDExp(hContext, hDevice, size, pInteropMemDesc, phInteropMem); if (UR_RESULT_SUCCESS != result) { diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 4d5c95be98..95077120e8 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -6304,7 +6304,7 @@ ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( /// + `NULL == hContext` /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == interopMemDesc` +/// + `NULL == pInteropMemDesc` /// + `NULL == phInteropMem` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE @@ -6313,8 +6313,8 @@ ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( ur_context_handle_t hContext, ///< [in] handle of the context object ur_device_handle_t hDevice, ///< [in] handle of the device object size_t size, ///< [in] size of the external memory - ur_exp_interop_memory_desc_t - *interopMemDesc, ///< [in] the interop memory descriptor + ur_exp_interop_mem_desc_t + *pInteropMemDesc, ///< [in] the interop memory descriptor ur_exp_interop_mem_handle_t *phInteropMem ///< [out] interop memory handle to the external memory ) try { @@ -6324,7 +6324,7 @@ ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnImportOpaqueFDExp(hContext, hDevice, size, interopMemDesc, + return pfnImportOpaqueFDExp(hContext, hDevice, size, pInteropMemDesc, phInteropMem); } catch (...) { return exceptionToResult(std::current_exception()); diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 082693d32c..da5d63e087 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -5326,7 +5326,7 @@ ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( /// + `NULL == hContext` /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == interopMemDesc` +/// + `NULL == pInteropMemDesc` /// + `NULL == phInteropMem` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE @@ -5335,8 +5335,8 @@ ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( ur_context_handle_t hContext, ///< [in] handle of the context object ur_device_handle_t hDevice, ///< [in] handle of the device object size_t size, ///< [in] size of the external memory - ur_exp_interop_memory_desc_t - *interopMemDesc, ///< [in] the interop memory descriptor + ur_exp_interop_mem_desc_t + *pInteropMemDesc, ///< [in] the interop memory descriptor ur_exp_interop_mem_handle_t *phInteropMem ///< [out] interop memory handle to the external memory ) {