diff --git a/include/ur.py b/include/ur.py index 028ce1bf96..91b57e416b 100644 --- a/include/ur.py +++ b/include/ur.py @@ -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: @@ -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 ] @@ -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) diff --git a/include/ur_api.h b/include/ur_api.h index b30e52b67b..92ad71b675 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -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__) @@ -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; @@ -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; diff --git a/include/ur_ddi.h b/include/ur_ddi.h index 3b761dde59..27c7a13593 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -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)( @@ -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; diff --git a/scripts/core/memory.yml b/scripts/core/memory.yml index 4c6d9832f7..b589a2bbbe 100644 --- a/scripts/core/memory.yml +++ b/scripts/core/memory.yml @@ -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. diff --git a/source/ur_api.cpp b/source/ur_api.cpp index c22585df67..a9cb00bd15 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -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;