Skip to content

Commit

Permalink
Merge pull request #718 from przemektmalon/przemek/fix-interop-struct…
Browse files Browse the repository at this point in the history
…-param-name-style

[Bindless][Exp] Update struct and param naming style to adhere to convention
  • Loading branch information
veselypeta authored Jul 14, 2023
2 parents 9b5b8b9 + e46f3fb commit bc0b581
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 57 deletions.
10 changes: 5 additions & 5 deletions include/ur.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
]

Expand Down Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
);

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion include/ur_ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);

///////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 4 additions & 2 deletions scripts/core/EXP-BINDLESS-IMAGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
--------------------------------------------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions scripts/core/exp-bindless-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: []
--- #--------------------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions source/adapters/null/ur_nullddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
24 changes: 12 additions & 12 deletions source/common/ur_params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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 = ";

Expand Down Expand Up @@ -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 = ";
Expand Down
8 changes: 4 additions & 4 deletions source/loader/layers/tracing/ur_trcddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand All @@ -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", &params);

ur_result_t result = pfnImportOpaqueFDExp(hContext, hDevice, size,
interopMemDesc, phInteropMem);
pInteropMemDesc, phInteropMem);

context.notify_end(UR_FUNCTION_BINDLESS_IMAGES_IMPORT_OPAQUE_FD_EXP,
"urBindlessImagesImportOpaqueFDExp", &params, &result,
Expand Down
8 changes: 4 additions & 4 deletions source/loader/layers/validation/ur_valddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand All @@ -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;
}

Expand All @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions source/loader/ur_ldrddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand All @@ -5747,7 +5747,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp(
hDevice = reinterpret_cast<ur_device_object_t *>(hDevice)->handle;

// forward to device-platform
result = pfnImportOpaqueFDExp(hContext, hDevice, size, interopMemDesc,
result = pfnImportOpaqueFDExp(hContext, hDevice, size, pInteropMemDesc,
phInteropMem);

if (UR_RESULT_SUCCESS != result) {
Expand Down
8 changes: 4 additions & 4 deletions source/loader/ur_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand All @@ -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());
Expand Down
6 changes: 3 additions & 3 deletions source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
) {
Expand Down

0 comments on commit bc0b581

Please sign in to comment.