Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions include/ur.py
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,13 @@ class ur_sampler_dditable_t(Structure):
else:
_urMemGetInfo_t = CFUNCTYPE( ur_result_t, ur_mem_handle_t, ur_mem_info_t, c_size_t, c_void_p, POINTER(c_size_t) )

###############################################################################
## @brief Function-pointer for urMemImageGetInfo
if __use_win_types:
_urMemImageGetInfo_t = WINFUNCTYPE( ur_result_t, ur_mem_handle_t, ur_image_info_t, c_size_t, c_void_p, POINTER(c_size_t) )
else:
_urMemImageGetInfo_t = CFUNCTYPE( ur_result_t, ur_mem_handle_t, ur_image_info_t, c_size_t, c_void_p, POINTER(c_size_t) )

###############################################################################
## @brief Function-pointer for urMemFree
if __use_win_types:
Expand Down Expand Up @@ -1523,6 +1530,7 @@ class ur_mem_dditable_t(Structure):
("pfnGetNativeHandle", c_void_p), ## _urMemGetNativeHandle_t
("pfnCreateWithNativeHandle", c_void_p), ## _urMemCreateWithNativeHandle_t
("pfnGetInfo", c_void_p), ## _urMemGetInfo_t
("pfnImageGetInfo", c_void_p), ## _urMemImageGetInfo_t
("pfnFree", c_void_p), ## _urMemFree_t
("pfnGetMemAllocInfo", c_void_p) ## _urMemGetMemAllocInfo_t
]
Expand Down Expand Up @@ -2054,6 +2062,7 @@ def __init__(self, version : ur_api_version_t):
self.urMemGetNativeHandle = _urMemGetNativeHandle_t(self.__dditable.Mem.pfnGetNativeHandle)
self.urMemCreateWithNativeHandle = _urMemCreateWithNativeHandle_t(self.__dditable.Mem.pfnCreateWithNativeHandle)
self.urMemGetInfo = _urMemGetInfo_t(self.__dditable.Mem.pfnGetInfo)
self.urMemImageGetInfo = _urMemImageGetInfo_t(self.__dditable.Mem.pfnImageGetInfo)
self.urMemFree = _urMemFree_t(self.__dditable.Mem.pfnFree)
self.urMemGetMemAllocInfo = _urMemGetMemAllocInfo_t(self.__dditable.Mem.pfnGetMemAllocInfo)

Expand Down
60 changes: 58 additions & 2 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1990,8 +1990,37 @@ urMemGetInfo(
///< If propSize is less than the real number of bytes needed to return
///< the info then the ::UR_RESULT_ERROR_INVALID_SIZE error is returned and
///< pMemInfo is not used.
size_t* pPropSizeRet ///< [out][optional] pointer to the actual size in bytes of data queried by
///< pMemInfo.
size_t* pPropSizeRet ///< [out][optional] pointer to the actual size in bytes of data queried by pMemInfo.
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Retrieve information about an image object.
///
/// @details
/// - Query information specific to an image object.
///
/// @remarks
/// _Analogues_
/// - **clGetImageInfo**
///
/// @returns
/// - ::UR_RESULT_SUCCESS
/// - ::UR_RESULT_ERROR_UNINITIALIZED
/// - ::UR_RESULT_ERROR_DEVICE_LOST
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hMemory`
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_IMAGE_INFO_DEPTH < ImgInfoType`
UR_APIEXPORT ur_result_t UR_APICALL
urMemImageGetInfo(
ur_mem_handle_t hMemory, ///< [in] handle to the image object being queried.
ur_image_info_t ImgInfoType, ///< [in] type of image info to retrieve.
size_t propSize, ///< [in] the number of bytes of memory pointer to by pImgInfo.
void* pImgInfo, ///< [out][optional] array of bytes holding the info.
///< If propSize is less than the real number of bytes needed to return
///< the info then the ::UR_RESULT_ERROR_INVALID_SIZE error is returned and
///< pImgInfo is not used.
size_t* pPropSizeRet ///< [out][optional] pointer to the actual size in bytes of data queried by pImgInfo.
);

#if !defined(__GNUC__)
Expand Down Expand Up @@ -5815,6 +5844,32 @@ typedef void (UR_APICALL *ur_pfnMemGetInfoCb_t)(
void** ppTracerInstanceUserData
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Callback function parameters for urMemImageGetInfo
/// @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_mem_image_get_info_params_t
{
ur_mem_handle_t* phMemory;
ur_image_info_t* pImgInfoType;
size_t* ppropSize;
void** ppImgInfo;
size_t** ppPropSizeRet;
} ur_mem_image_get_info_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Callback function-pointer for urMemImageGetInfo
/// @param[in] params Parameters passed to this instance
/// @param[in] result Return value
/// @param[in] pTracerUserData Per-Tracer user data
/// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data
typedef void (UR_APICALL *ur_pfnMemImageGetInfoCb_t)(
ur_mem_image_get_info_params_t* params,
ur_result_t result,
void* pTracerUserData,
void** ppTracerInstanceUserData
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Callback function parameters for urMemFree
/// @details Each entry is a pointer to the parameter passed to the function;
Expand Down Expand Up @@ -5877,6 +5932,7 @@ typedef struct ur_mem_callbacks_t
ur_pfnMemGetNativeHandleCb_t pfnGetNativeHandleCb;
ur_pfnMemCreateWithNativeHandleCb_t pfnCreateWithNativeHandleCb;
ur_pfnMemGetInfoCb_t pfnGetInfoCb;
ur_pfnMemImageGetInfoCb_t pfnImageGetInfoCb;
ur_pfnMemFreeCb_t pfnFreeCb;
ur_pfnMemGetMemAllocInfoCb_t pfnGetMemAllocInfoCb;
} ur_mem_callbacks_t;
Expand Down
11 changes: 11 additions & 0 deletions include/ur_ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,16 @@ typedef ur_result_t (UR_APICALL *ur_pfnMemGetInfo_t)(
size_t*
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urMemImageGetInfo
typedef ur_result_t (UR_APICALL *ur_pfnMemImageGetInfo_t)(
ur_mem_handle_t,
ur_image_info_t,
size_t,
void*,
size_t*
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urMemFree
typedef ur_result_t (UR_APICALL *ur_pfnMemFree_t)(
Expand Down Expand Up @@ -800,6 +810,7 @@ typedef struct ur_mem_dditable_t
ur_pfnMemGetNativeHandle_t pfnGetNativeHandle;
ur_pfnMemCreateWithNativeHandle_t pfnCreateWithNativeHandle;
ur_pfnMemGetInfo_t pfnGetInfo;
ur_pfnMemImageGetInfo_t pfnImageGetInfo;
ur_pfnMemFree_t pfnFree;
ur_pfnMemGetMemAllocInfo_t pfnGetMemAllocInfo;
} ur_mem_dditable_t;
Expand Down
33 changes: 32 additions & 1 deletion scripts/core/memory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -428,4 +428,35 @@ params:
- type: "size_t*"
name: pPropSizeRet
desc: |
[out][optional] pointer to the actual size in bytes of data queried by pMemInfo.
[out][optional] pointer to the actual size in bytes of data queried by pMemInfo.
--- #--------------------------------------------------------------------------
type: function
desc: "Retrieve information about an image object."
class: $xMem
name: ImageGetInfo
decl: static
ordinal: "0"
analogue:
- "**clGetImageInfo**"
details:
- "Query information specific to an image object."
params:
- type: $x_mem_handle_t
name: hMemory
desc: "[in] handle to the image object being queried."
- type: $x_image_info_t
name: ImgInfoType
desc: "[in] type of image info to retrieve."
- type: "size_t"
name: propSize
desc: "[in] the number of bytes of memory pointer to by pImgInfo."
- type: "void*"
name: pImgInfo
desc: |
[out][optional] array of bytes holding the info.
If propSize is less than the real number of bytes needed to return
the info then the $X_RESULT_ERROR_INVALID_SIZE error is returned and pImgInfo is not used.
- type: "size_t*"
name: pPropSizeRet
desc: |
[out][optional] pointer to the actual size in bytes of data queried by pImgInfo.
37 changes: 35 additions & 2 deletions source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1642,8 +1642,41 @@ urMemGetInfo(
///< If propSize is less than the real number of bytes needed to return
///< the info then the ::UR_RESULT_ERROR_INVALID_SIZE error is returned and
///< pMemInfo is not used.
size_t* pPropSizeRet ///< [out][optional] pointer to the actual size in bytes of data queried by
///< pMemInfo.
size_t* pPropSizeRet ///< [out][optional] pointer to the actual size in bytes of data queried by pMemInfo.
)
{
ur_result_t result = UR_RESULT_SUCCESS;
return result;
}

///////////////////////////////////////////////////////////////////////////////
/// @brief Retrieve information about an image object.
///
/// @details
/// - Query information specific to an image object.
///
/// @remarks
/// _Analogues_
/// - **clGetImageInfo**
///
/// @returns
/// - ::UR_RESULT_SUCCESS
/// - ::UR_RESULT_ERROR_UNINITIALIZED
/// - ::UR_RESULT_ERROR_DEVICE_LOST
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hMemory`
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_IMAGE_INFO_DEPTH < ImgInfoType`
ur_result_t UR_APICALL
urMemImageGetInfo(
ur_mem_handle_t hMemory, ///< [in] handle to the image object being queried.
ur_image_info_t ImgInfoType, ///< [in] type of image info to retrieve.
size_t propSize, ///< [in] the number of bytes of memory pointer to by pImgInfo.
void* pImgInfo, ///< [out][optional] array of bytes holding the info.
///< If propSize is less than the real number of bytes needed to return
///< the info then the ::UR_RESULT_ERROR_INVALID_SIZE error is returned and
///< pImgInfo is not used.
size_t* pPropSizeRet ///< [out][optional] pointer to the actual size in bytes of data queried by pImgInfo.
)
{
ur_result_t result = UR_RESULT_SUCCESS;
Expand Down