@@ -155,6 +155,9 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_virtual_mem
155155template <>
156156inline ur_result_t printFlag<ur_physical_mem_flag_t>(std::ostream &os, uint32_t flag);
157157
158+ template <>
159+ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_physical_mem_info_t value, size_t size);
160+
158161inline ur_result_t printUnion(
159162 std::ostream &os,
160163 const union ur_program_metadata_value_t params,
@@ -313,6 +316,7 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_virtual_mem_access_fla
313316inline std::ostream &operator<<(std::ostream &os, enum ur_virtual_mem_info_t value);
314317inline std::ostream &operator<<(std::ostream &os, enum ur_physical_mem_flag_t value);
315318inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_physical_mem_properties_t params);
319+ inline std::ostream &operator<<(std::ostream &os, enum ur_physical_mem_info_t value);
316320inline std::ostream &operator<<(std::ostream &os, enum ur_program_metadata_type_t value);
317321inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_metadata_t params);
318322inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_properties_t params);
@@ -994,6 +998,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) {
994998 case UR_FUNCTION_TENSOR_MAP_ENCODE_TILED_EXP:
995999 os << "UR_FUNCTION_TENSOR_MAP_ENCODE_TILED_EXP";
9961000 break;
1001+ case UR_FUNCTION_PHYSICAL_MEM_GET_INFO:
1002+ os << "UR_FUNCTION_PHYSICAL_MEM_GET_INFO";
1003+ break;
9971004 default:
9981005 os << "unknown enumerator";
9991006 break;
@@ -7498,6 +7505,113 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_physical_mem_p
74987505 os << "}";
74997506 return os;
75007507}
7508+ ///////////////////////////////////////////////////////////////////////////////
7509+ /// @brief Print operator for the ur_physical_mem_info_t type
7510+ /// @returns
7511+ /// std::ostream &
7512+ inline std::ostream &operator<<(std::ostream &os, enum ur_physical_mem_info_t value) {
7513+ switch (value) {
7514+ case UR_PHYSICAL_MEM_INFO_CONTEXT:
7515+ os << "UR_PHYSICAL_MEM_INFO_CONTEXT";
7516+ break;
7517+ case UR_PHYSICAL_MEM_INFO_DEVICE:
7518+ os << "UR_PHYSICAL_MEM_INFO_DEVICE";
7519+ break;
7520+ case UR_PHYSICAL_MEM_INFO_SIZE:
7521+ os << "UR_PHYSICAL_MEM_INFO_SIZE";
7522+ break;
7523+ case UR_PHYSICAL_MEM_INFO_PROPERTIES:
7524+ os << "UR_PHYSICAL_MEM_INFO_PROPERTIES";
7525+ break;
7526+ case UR_PHYSICAL_MEM_INFO_REFERENCE_COUNT:
7527+ os << "UR_PHYSICAL_MEM_INFO_REFERENCE_COUNT";
7528+ break;
7529+ default:
7530+ os << "unknown enumerator";
7531+ break;
7532+ }
7533+ return os;
7534+ }
7535+ namespace ur::details {
7536+ ///////////////////////////////////////////////////////////////////////////////
7537+ /// @brief Print ur_physical_mem_info_t enum value
7538+ template <>
7539+ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_physical_mem_info_t value, size_t size) {
7540+ if (ptr == NULL) {
7541+ return printPtr(os, ptr);
7542+ }
7543+
7544+ switch (value) {
7545+ case UR_PHYSICAL_MEM_INFO_CONTEXT: {
7546+ const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr;
7547+ if (sizeof(ur_context_handle_t) > size) {
7548+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_context_handle_t) << ")";
7549+ return UR_RESULT_ERROR_INVALID_SIZE;
7550+ }
7551+ os << (const void *)(tptr) << " (";
7552+
7553+ ur::details::printPtr(os,
7554+ *tptr);
7555+
7556+ os << ")";
7557+ } break;
7558+ case UR_PHYSICAL_MEM_INFO_DEVICE: {
7559+ const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr;
7560+ if (sizeof(ur_device_handle_t) > size) {
7561+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_handle_t) << ")";
7562+ return UR_RESULT_ERROR_INVALID_SIZE;
7563+ }
7564+ os << (const void *)(tptr) << " (";
7565+
7566+ ur::details::printPtr(os,
7567+ *tptr);
7568+
7569+ os << ")";
7570+ } break;
7571+ case UR_PHYSICAL_MEM_INFO_SIZE: {
7572+ const size_t *tptr = (const size_t *)ptr;
7573+ if (sizeof(size_t) > size) {
7574+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")";
7575+ return UR_RESULT_ERROR_INVALID_SIZE;
7576+ }
7577+ os << (const void *)(tptr) << " (";
7578+
7579+ os << *tptr;
7580+
7581+ os << ")";
7582+ } break;
7583+ case UR_PHYSICAL_MEM_INFO_PROPERTIES: {
7584+ const ur_physical_mem_properties_t *tptr = (const ur_physical_mem_properties_t *)ptr;
7585+ if (sizeof(ur_physical_mem_properties_t) > size) {
7586+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_physical_mem_properties_t) << ")";
7587+ return UR_RESULT_ERROR_INVALID_SIZE;
7588+ }
7589+ os << (const void *)(tptr) << " (";
7590+
7591+ os << *tptr;
7592+
7593+ os << ")";
7594+ } break;
7595+ case UR_PHYSICAL_MEM_INFO_REFERENCE_COUNT: {
7596+ const uint32_t *tptr = (const uint32_t *)ptr;
7597+ if (sizeof(uint32_t) > size) {
7598+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")";
7599+ return UR_RESULT_ERROR_INVALID_SIZE;
7600+ }
7601+ os << (const void *)(tptr) << " (";
7602+
7603+ os << *tptr;
7604+
7605+ os << ")";
7606+ } break;
7607+ default:
7608+ os << "unknown enumerator";
7609+ return UR_RESULT_ERROR_INVALID_ENUMERATION;
7610+ }
7611+ return UR_RESULT_SUCCESS;
7612+ }
7613+ } // namespace ur::details
7614+
75017615///////////////////////////////////////////////////////////////////////////////
75027616/// @brief Print operator for the ur_program_metadata_type_t type
75037617/// @returns
@@ -13805,6 +13919,40 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
1380513919 return os;
1380613920}
1380713921
13922+ ///////////////////////////////////////////////////////////////////////////////
13923+ /// @brief Print operator for the ur_physical_mem_get_info_params_t type
13924+ /// @returns
13925+ /// std::ostream &
13926+ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_physical_mem_get_info_params_t *params) {
13927+
13928+ os << ".hPhysicalMem = ";
13929+
13930+ ur::details::printPtr(os,
13931+ *(params->phPhysicalMem));
13932+
13933+ os << ", ";
13934+ os << ".propName = ";
13935+
13936+ os << *(params->ppropName);
13937+
13938+ os << ", ";
13939+ os << ".propSize = ";
13940+
13941+ os << *(params->ppropSize);
13942+
13943+ os << ", ";
13944+ os << ".pPropValue = ";
13945+ ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize));
13946+
13947+ os << ", ";
13948+ os << ".pPropSizeRet = ";
13949+
13950+ ur::details::printPtr(os,
13951+ *(params->ppPropSizeRet));
13952+
13953+ return os;
13954+ }
13955+
1380813956///////////////////////////////////////////////////////////////////////////////
1380913957/// @brief Print operator for the ur_adapter_get_params_t type
1381013958/// @returns
@@ -19652,6 +19800,9 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, ur_function_
1965219800 case UR_FUNCTION_PHYSICAL_MEM_RELEASE: {
1965319801 os << (const struct ur_physical_mem_release_params_t *)params;
1965419802 } break;
19803+ case UR_FUNCTION_PHYSICAL_MEM_GET_INFO: {
19804+ os << (const struct ur_physical_mem_get_info_params_t *)params;
19805+ } break;
1965519806 case UR_FUNCTION_ADAPTER_GET: {
1965619807 os << (const struct ur_adapter_get_params_t *)params;
1965719808 } break;
0 commit comments