@@ -153,6 +153,9 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_virtual_mem
153153template <>
154154inline ur_result_t printFlag<ur_physical_mem_flag_t>(std::ostream &os, uint32_t flag);
155155
156+ template <>
157+ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_physical_mem_info_t value, size_t size);
158+
156159inline ur_result_t printUnion(
157160 std::ostream &os,
158161 const union ur_program_metadata_value_t params,
@@ -293,6 +296,7 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_virtual_mem_access_fla
293296inline std::ostream &operator<<(std::ostream &os, enum ur_virtual_mem_info_t value);
294297inline std::ostream &operator<<(std::ostream &os, enum ur_physical_mem_flag_t value);
295298inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_physical_mem_properties_t params);
299+ inline std::ostream &operator<<(std::ostream &os, enum ur_physical_mem_info_t value);
296300inline std::ostream &operator<<(std::ostream &os, enum ur_program_metadata_type_t value);
297301inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_metadata_t params);
298302inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_properties_t params);
@@ -962,6 +966,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) {
962966 case UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER_EXT:
963967 os << "UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER_EXT";
964968 break;
969+ case UR_FUNCTION_PHYSICAL_MEM_GET_INFO:
970+ os << "UR_FUNCTION_PHYSICAL_MEM_GET_INFO";
971+ break;
965972 default:
966973 os << "unknown enumerator";
967974 break;
@@ -7434,6 +7441,113 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_physical_mem_p
74347441 os << "}";
74357442 return os;
74367443}
7444+ ///////////////////////////////////////////////////////////////////////////////
7445+ /// @brief Print operator for the ur_physical_mem_info_t type
7446+ /// @returns
7447+ /// std::ostream &
7448+ inline std::ostream &operator<<(std::ostream &os, enum ur_physical_mem_info_t value) {
7449+ switch (value) {
7450+ case UR_PHYSICAL_MEM_INFO_CONTEXT:
7451+ os << "UR_PHYSICAL_MEM_INFO_CONTEXT";
7452+ break;
7453+ case UR_PHYSICAL_MEM_INFO_DEVICE:
7454+ os << "UR_PHYSICAL_MEM_INFO_DEVICE";
7455+ break;
7456+ case UR_PHYSICAL_MEM_INFO_SIZE:
7457+ os << "UR_PHYSICAL_MEM_INFO_SIZE";
7458+ break;
7459+ case UR_PHYSICAL_MEM_INFO_PROPERTIES:
7460+ os << "UR_PHYSICAL_MEM_INFO_PROPERTIES";
7461+ break;
7462+ case UR_PHYSICAL_MEM_INFO_REFERENCE_COUNT:
7463+ os << "UR_PHYSICAL_MEM_INFO_REFERENCE_COUNT";
7464+ break;
7465+ default:
7466+ os << "unknown enumerator";
7467+ break;
7468+ }
7469+ return os;
7470+ }
7471+ namespace ur::details {
7472+ ///////////////////////////////////////////////////////////////////////////////
7473+ /// @brief Print ur_physical_mem_info_t enum value
7474+ template <>
7475+ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_physical_mem_info_t value, size_t size) {
7476+ if (ptr == NULL) {
7477+ return printPtr(os, ptr);
7478+ }
7479+
7480+ switch (value) {
7481+ case UR_PHYSICAL_MEM_INFO_CONTEXT: {
7482+ const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr;
7483+ if (sizeof(ur_context_handle_t) > size) {
7484+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_context_handle_t) << ")";
7485+ return UR_RESULT_ERROR_INVALID_SIZE;
7486+ }
7487+ os << (const void *)(tptr) << " (";
7488+
7489+ ur::details::printPtr(os,
7490+ *tptr);
7491+
7492+ os << ")";
7493+ } break;
7494+ case UR_PHYSICAL_MEM_INFO_DEVICE: {
7495+ const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr;
7496+ if (sizeof(ur_device_handle_t) > size) {
7497+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_handle_t) << ")";
7498+ return UR_RESULT_ERROR_INVALID_SIZE;
7499+ }
7500+ os << (const void *)(tptr) << " (";
7501+
7502+ ur::details::printPtr(os,
7503+ *tptr);
7504+
7505+ os << ")";
7506+ } break;
7507+ case UR_PHYSICAL_MEM_INFO_SIZE: {
7508+ const size_t *tptr = (const size_t *)ptr;
7509+ if (sizeof(size_t) > size) {
7510+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")";
7511+ return UR_RESULT_ERROR_INVALID_SIZE;
7512+ }
7513+ os << (const void *)(tptr) << " (";
7514+
7515+ os << *tptr;
7516+
7517+ os << ")";
7518+ } break;
7519+ case UR_PHYSICAL_MEM_INFO_PROPERTIES: {
7520+ const ur_physical_mem_properties_t *tptr = (const ur_physical_mem_properties_t *)ptr;
7521+ if (sizeof(ur_physical_mem_properties_t) > size) {
7522+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_physical_mem_properties_t) << ")";
7523+ return UR_RESULT_ERROR_INVALID_SIZE;
7524+ }
7525+ os << (const void *)(tptr) << " (";
7526+
7527+ os << *tptr;
7528+
7529+ os << ")";
7530+ } break;
7531+ case UR_PHYSICAL_MEM_INFO_REFERENCE_COUNT: {
7532+ const uint32_t *tptr = (const uint32_t *)ptr;
7533+ if (sizeof(uint32_t) > size) {
7534+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")";
7535+ return UR_RESULT_ERROR_INVALID_SIZE;
7536+ }
7537+ os << (const void *)(tptr) << " (";
7538+
7539+ os << *tptr;
7540+
7541+ os << ")";
7542+ } break;
7543+ default:
7544+ os << "unknown enumerator";
7545+ return UR_RESULT_ERROR_INVALID_ENUMERATION;
7546+ }
7547+ return UR_RESULT_SUCCESS;
7548+ }
7549+ } // namespace ur::details
7550+
74377551///////////////////////////////////////////////////////////////////////////////
74387552/// @brief Print operator for the ur_program_metadata_type_t type
74397553/// @returns
@@ -13085,6 +13199,40 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
1308513199 return os;
1308613200}
1308713201
13202+ ///////////////////////////////////////////////////////////////////////////////
13203+ /// @brief Print operator for the ur_physical_mem_get_info_params_t type
13204+ /// @returns
13205+ /// std::ostream &
13206+ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_physical_mem_get_info_params_t *params) {
13207+
13208+ os << ".hPhysicalMem = ";
13209+
13210+ ur::details::printPtr(os,
13211+ *(params->phPhysicalMem));
13212+
13213+ os << ", ";
13214+ os << ".propName = ";
13215+
13216+ os << *(params->ppropName);
13217+
13218+ os << ", ";
13219+ os << ".propSize = ";
13220+
13221+ os << *(params->ppropSize);
13222+
13223+ os << ", ";
13224+ os << ".pPropValue = ";
13225+ ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize));
13226+
13227+ os << ", ";
13228+ os << ".pPropSizeRet = ";
13229+
13230+ ur::details::printPtr(os,
13231+ *(params->ppPropSizeRet));
13232+
13233+ return os;
13234+ }
13235+
1308813236///////////////////////////////////////////////////////////////////////////////
1308913237/// @brief Print operator for the ur_adapter_get_params_t type
1309013238/// @returns
@@ -18528,6 +18676,9 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, ur_function_
1852818676 case UR_FUNCTION_PHYSICAL_MEM_RELEASE: {
1852918677 os << (const struct ur_physical_mem_release_params_t *)params;
1853018678 } break;
18679+ case UR_FUNCTION_PHYSICAL_MEM_GET_INFO: {
18680+ os << (const struct ur_physical_mem_get_info_params_t *)params;
18681+ } break;
1853118682 case UR_FUNCTION_ADAPTER_GET: {
1853218683 os << (const struct ur_adapter_get_params_t *)params;
1853318684 } break;
0 commit comments