@@ -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;
@@ -7435,6 +7442,113 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_physical_mem_p
74357442 os << "}";
74367443 return os;
74377444}
7445+ ///////////////////////////////////////////////////////////////////////////////
7446+ /// @brief Print operator for the ur_physical_mem_info_t type
7447+ /// @returns
7448+ /// std::ostream &
7449+ inline std::ostream &operator<<(std::ostream &os, enum ur_physical_mem_info_t value) {
7450+ switch (value) {
7451+ case UR_PHYSICAL_MEM_INFO_CONTEXT:
7452+ os << "UR_PHYSICAL_MEM_INFO_CONTEXT";
7453+ break;
7454+ case UR_PHYSICAL_MEM_INFO_DEVICE:
7455+ os << "UR_PHYSICAL_MEM_INFO_DEVICE";
7456+ break;
7457+ case UR_PHYSICAL_MEM_INFO_SIZE:
7458+ os << "UR_PHYSICAL_MEM_INFO_SIZE";
7459+ break;
7460+ case UR_PHYSICAL_MEM_INFO_PROPERTIES:
7461+ os << "UR_PHYSICAL_MEM_INFO_PROPERTIES";
7462+ break;
7463+ case UR_PHYSICAL_MEM_INFO_REFERENCE_COUNT:
7464+ os << "UR_PHYSICAL_MEM_INFO_REFERENCE_COUNT";
7465+ break;
7466+ default:
7467+ os << "unknown enumerator";
7468+ break;
7469+ }
7470+ return os;
7471+ }
7472+ namespace ur::details {
7473+ ///////////////////////////////////////////////////////////////////////////////
7474+ /// @brief Print ur_physical_mem_info_t enum value
7475+ template <>
7476+ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_physical_mem_info_t value, size_t size) {
7477+ if (ptr == NULL) {
7478+ return printPtr(os, ptr);
7479+ }
7480+
7481+ switch (value) {
7482+ case UR_PHYSICAL_MEM_INFO_CONTEXT: {
7483+ const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr;
7484+ if (sizeof(ur_context_handle_t) > size) {
7485+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_context_handle_t) << ")";
7486+ return UR_RESULT_ERROR_INVALID_SIZE;
7487+ }
7488+ os << (const void *)(tptr) << " (";
7489+
7490+ ur::details::printPtr(os,
7491+ *tptr);
7492+
7493+ os << ")";
7494+ } break;
7495+ case UR_PHYSICAL_MEM_INFO_DEVICE: {
7496+ const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr;
7497+ if (sizeof(ur_device_handle_t) > size) {
7498+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_handle_t) << ")";
7499+ return UR_RESULT_ERROR_INVALID_SIZE;
7500+ }
7501+ os << (const void *)(tptr) << " (";
7502+
7503+ ur::details::printPtr(os,
7504+ *tptr);
7505+
7506+ os << ")";
7507+ } break;
7508+ case UR_PHYSICAL_MEM_INFO_SIZE: {
7509+ const size_t *tptr = (const size_t *)ptr;
7510+ if (sizeof(size_t) > size) {
7511+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")";
7512+ return UR_RESULT_ERROR_INVALID_SIZE;
7513+ }
7514+ os << (const void *)(tptr) << " (";
7515+
7516+ os << *tptr;
7517+
7518+ os << ")";
7519+ } break;
7520+ case UR_PHYSICAL_MEM_INFO_PROPERTIES: {
7521+ const ur_physical_mem_properties_t *tptr = (const ur_physical_mem_properties_t *)ptr;
7522+ if (sizeof(ur_physical_mem_properties_t) > size) {
7523+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_physical_mem_properties_t) << ")";
7524+ return UR_RESULT_ERROR_INVALID_SIZE;
7525+ }
7526+ os << (const void *)(tptr) << " (";
7527+
7528+ os << *tptr;
7529+
7530+ os << ")";
7531+ } break;
7532+ case UR_PHYSICAL_MEM_INFO_REFERENCE_COUNT: {
7533+ const uint32_t *tptr = (const uint32_t *)ptr;
7534+ if (sizeof(uint32_t) > size) {
7535+ os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")";
7536+ return UR_RESULT_ERROR_INVALID_SIZE;
7537+ }
7538+ os << (const void *)(tptr) << " (";
7539+
7540+ os << *tptr;
7541+
7542+ os << ")";
7543+ } break;
7544+ default:
7545+ os << "unknown enumerator";
7546+ return UR_RESULT_ERROR_INVALID_ENUMERATION;
7547+ }
7548+ return UR_RESULT_SUCCESS;
7549+ }
7550+ } // namespace ur::details
7551+
74387552///////////////////////////////////////////////////////////////////////////////
74397553/// @brief Print operator for the ur_program_metadata_type_t type
74407554/// @returns
@@ -13170,6 +13284,40 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
1317013284 return os;
1317113285}
1317213286
13287+ ///////////////////////////////////////////////////////////////////////////////
13288+ /// @brief Print operator for the ur_physical_mem_get_info_params_t type
13289+ /// @returns
13290+ /// std::ostream &
13291+ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_physical_mem_get_info_params_t *params) {
13292+
13293+ os << ".hPhysicalMem = ";
13294+
13295+ ur::details::printPtr(os,
13296+ *(params->phPhysicalMem));
13297+
13298+ os << ", ";
13299+ os << ".propName = ";
13300+
13301+ os << *(params->ppropName);
13302+
13303+ os << ", ";
13304+ os << ".propSize = ";
13305+
13306+ os << *(params->ppropSize);
13307+
13308+ os << ", ";
13309+ os << ".pPropValue = ";
13310+ ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize));
13311+
13312+ os << ", ";
13313+ os << ".pPropSizeRet = ";
13314+
13315+ ur::details::printPtr(os,
13316+ *(params->ppPropSizeRet));
13317+
13318+ return os;
13319+ }
13320+
1317313321///////////////////////////////////////////////////////////////////////////////
1317413322/// @brief Print operator for the ur_adapter_get_params_t type
1317513323/// @returns
@@ -18825,6 +18973,9 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, ur_function_
1882518973 case UR_FUNCTION_PHYSICAL_MEM_RELEASE: {
1882618974 os << (const struct ur_physical_mem_release_params_t *)params;
1882718975 } break;
18976+ case UR_FUNCTION_PHYSICAL_MEM_GET_INFO: {
18977+ os << (const struct ur_physical_mem_get_info_params_t *)params;
18978+ } break;
1882818979 case UR_FUNCTION_ADAPTER_GET: {
1882918980 os << (const struct ur_adapter_get_params_t *)params;
1883018981 } break;
0 commit comments