Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[CPU][DEBUG_CAPS] Fix OV_CPU_VERBOSE missing shapes (#28937)

Egor Duplenskii779d459be41c
diff --git a/src/plugins/intel_cpu/src/utils/verbose.cpp b/src/plugins/intel_cpu/src/utils/verbose.cpp
index 64287eb125c..d8f94b83be7 100644
--- a/src/plugins/intel_cpu/src/utils/verbose.cpp
+++ b/src/plugins/intel_cpu/src/utils/verbose.cpp
@@ -104,30 +104,37 @@ void Verbose::printInfo() {
written_total += size;
};
- auto formatMemDesc = [&](const MemoryDescPtr& desc, std::string& prefix) {
- prefix = colorize(BLUE, prefix);
- written = snprintf(portsInfo + written_total, CPU_VERBOSE_DAT_LEN - written_total, " ");
- shift(written);
- written = snprintf(portsInfo + written_total, CPU_VERBOSE_DAT_LEN - written_total, "%s", prefix.c_str());
- shift(written);
- std::string fmt_str = {};
- std::string dim_str = {};
+ auto getFormatAndDims = [](const MemoryDescPtr& desc) -> std::pair<std::string, std::string> {
if (DnnlExtensionUtils::ElementTypeToDataType(desc->getPrecision(), DnnlExtensionUtils::nothrow_tag{})) {
if (auto dnnl_desc = MemoryDescUtils::convertToDnnlMemoryDesc(desc)->getDnnlDesc()) {
- fmt_str = dnnl::impl::md2fmt_str("", dnnl_desc.get(), dnnl::impl::format_kind_t::dnnl_format_kind_undef);
- std::string dim_str = dnnl::impl::md2dim_str(dnnl_desc.get());
+ using namespace dnnl::impl;
+ auto fmt_str = md2fmt_str("", dnnl_desc.get(), format_kind_t::dnnl_format_kind_undef);
+ auto dim_str = md2dim_str(dnnl_desc.get());
+ return {fmt_str, dim_str};
} else {
- fmt_str = "empty";
+ return {"empty", {}};
}
} else {
- fmt_str = desc->getPrecision().to_string();
+ auto fmt_str = desc->getPrecision().to_string();
if (const auto& dims = desc->getShape().getDims(); !dims.empty()) {
- dim_str = dim2str(dims.front());
+ auto dim_str = dim2str(dims.front());
std::for_each(++(dims.begin()), dims.end(), [&dim_str](size_t dim) {
- dim_str.append("x" + std::to_string(dim));
+ dim_str.append("x" + dim2str(dim));
});
+ return {fmt_str, dim_str};
+ } else {
+ return {fmt_str, {}};
}
}
+ };
+
+ auto formatMemDesc = [&](const MemoryDescPtr& desc, std::string& prefix) {
+ prefix = colorize(BLUE, prefix);
+ written = snprintf(portsInfo + written_total, CPU_VERBOSE_DAT_LEN - written_total, " ");
+ shift(written);
+ written = snprintf(portsInfo + written_total, CPU_VERBOSE_DAT_LEN - written_total, "%s", prefix.c_str());
+ shift(written);
+ const auto [fmt_str, dim_str] = getFormatAndDims(desc);
written = snprintf(portsInfo + written_total, CPU_VERBOSE_DAT_LEN - written_total, "%s", fmt_str.c_str());
shift(written);
written = snprintf(portsInfo + written_total, CPU_VERBOSE_DAT_LEN - written_total, ":");