From 7d2a2c663822402f564699f97089e7b137f114fe Mon Sep 17 00:00:00 2001 From: Egor Duplenskii Date: Sat, 10 Jun 2023 00:09:59 +0200 Subject: [PATCH] [CPU][DEBUG_CAPS] Fix compilation warnings (#17977) --- src/plugins/intel_cpu/src/graph.cpp | 2 +- src/plugins/intel_cpu/src/node.cpp | 2 +- src/plugins/intel_cpu/src/node.h | 2 +- .../src/utils/debug_capabilities.cpp | 24 +++++++++---------- .../intel_cpu/src/utils/debug_capabilities.h | 2 +- .../intel_cpu/src/utils/debug_caps_config.h | 2 +- src/plugins/intel_cpu/src/utils/verbose.cpp | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/plugins/intel_cpu/src/graph.cpp b/src/plugins/intel_cpu/src/graph.cpp index ce54632f8ec662..81ee36ae945ac1 100644 --- a/src/plugins/intel_cpu/src/graph.cpp +++ b/src/plugins/intel_cpu/src/graph.cpp @@ -433,7 +433,7 @@ void Graph::InitDescriptors() { #ifdef CPU_DEBUG_CAPS const auto& SPDs = node->getSupportedPrimitiveDescriptors(); - for (int i = 0; i < SPDs.size(); i++) { + for (size_t i = 0; i < SPDs.size(); i++) { DEBUG_LOG("#", node->getExecIndex(), " ", diff --git a/src/plugins/intel_cpu/src/node.cpp b/src/plugins/intel_cpu/src/node.cpp index 62e62dd3d3eeec..f0bd5e16890828 100644 --- a/src/plugins/intel_cpu/src/node.cpp +++ b/src/plugins/intel_cpu/src/node.cpp @@ -416,7 +416,7 @@ MemoryDescPtr Node::getBaseMemDescAtOutputPort(size_t portNum) const { IE_THROW() << "Can't get output memory desc, primitive descriptor is not selected"; } -std::string Node::getPrimitiveDescriptorType() { +std::string Node::getPrimitiveDescriptorType() const { auto selectedPrimitiveDesc = getSelectedPrimitiveDescriptor(); impl_desc_type type = impl_desc_type::undef; diff --git a/src/plugins/intel_cpu/src/node.h b/src/plugins/intel_cpu/src/node.h index 96d3f42aca9aaf..d11085bcdcf549 100644 --- a/src/plugins/intel_cpu/src/node.h +++ b/src/plugins/intel_cpu/src/node.h @@ -354,7 +354,7 @@ class Node { inplace = InPlaceType::Unknown; } - std::string getPrimitiveDescriptorType(); + std::string getPrimitiveDescriptorType() const; PerfCount &PerfCounter() { return perfCounter; } diff --git a/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp b/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp index cb0384a951b744..882c2fa504c5a3 100644 --- a/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp +++ b/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp @@ -65,7 +65,7 @@ DebugLogEnabled::DebugLogEnabled(const char* file, const char* func, int line, c bool match = false; const char* p0 = p_filters; - const char* p1; + const char* p1 = p0; while (*p0 != 0) { p1 = p0; while (*p1 != ';' && *p1 != 0) @@ -163,7 +163,7 @@ std::ostream & operator<<(std::ostream & os, const Node &c_node) { std::stringstream leftside; int num_output_port = 0; - for (auto wptr : node.getChildEdges()) { + for (const auto& wptr : node.getChildEdges()) { auto edge = wptr.lock(); if (num_output_port < edge->getInputNum() + 1) num_output_port = edge->getInputNum() + 1; @@ -190,7 +190,7 @@ std::ostream & operator<<(std::ostream & os, const Node &c_node) { leftside << "(empty)"; } } - if (!b_ouputed && nodeDesc && i < nodeDesc->getConfig().outConfs.size()) { + if (!b_ouputed && nodeDesc && i < static_cast(nodeDesc->getConfig().outConfs.size())) { auto desc = nodeDesc->getConfig().outConfs[i].getMemDesc(); auto shape_str = desc->getShape().toString(); replace_all(shape_str, "0 - ?", "?"); @@ -258,12 +258,12 @@ std::ostream & operator<<(std::ostream & os, const Node &c_node) { os << " ("; comma = ""; - for (int port = 0; port < node.getParentEdges().size(); ++port) { + for (size_t port = 0; port < node.getParentEdges().size(); ++port) { // find the Parent edge connecting to port for (const auto & e : node.getParentEdges()) { auto edge = e.lock(); if (!edge) continue; - if (edge->getOutputNum() != port) continue; + if (edge->getOutputNum() != static_cast(port)) continue; auto n = edge->getParent(); os << comma; os << node_id(*edge->getParent()); @@ -430,23 +430,23 @@ std::ostream & operator<<(std::ostream & os, const PrintableModel& model) { OstreamAttributeVisitor osvis(os); std::string sep = ""; os << prefix; - for (auto op : f.get_results()) { + for (const auto& op : f.get_results()) { os << sep << op->get_name(); sep = ","; } os << " " << f.get_friendly_name() << "(\n" << prefix; - for (auto op : f.get_parameters()) { + for (const auto& op : f.get_parameters()) { os << "\t" << tag << op->get_friendly_name() << ",\n" << prefix; } os << ") {\n"; - for (auto op : f.get_ordered_ops()) { + for (const auto& op : f.get_ordered_ops()) { auto type = op->get_type_name(); auto name = op->get_friendly_name(); os << prefix << "\t"; if (op->get_output_size() > 1) os << "("; sep = ""; - for (int i = 0; i < op->get_output_size(); i++) { + for (size_t i = 0; i < op->get_output_size(); i++) { os << sep << op->get_output_element_type(i) << "_" << op->get_output_partial_shape(i); sep = ","; } @@ -454,7 +454,7 @@ std::ostream & operator<<(std::ostream & os, const PrintableModel& model) { os << ")"; os << " " << tag << name << " = " << type << "("; sep = ""; - for (int i = 0; i < op->get_input_size(); i++) { + for (size_t i = 0; i < op->get_input_size(); i++) { auto vout = op->get_input_source_output(i); auto iop = vout.get_node_shared_ptr(); if (iop->get_output_size() > 1) { @@ -477,7 +477,7 @@ std::ostream & operator<<(std::ostream & os, const PrintableModel& model) { auto sz = shape_size(constop->get_shape()); if (sz < 9) { sep = ""; - for (auto v : constop->get_value_strings()) { + for (const auto& v : constop->get_value_strings()) { os << sep << v; sep = ","; } @@ -494,7 +494,7 @@ std::ostream & operator<<(std::ostream & os, const PrintableModel& model) { // recursively output subgraphs if (auto msubgraph = std::dynamic_pointer_cast(op)) { auto cnt = msubgraph->get_internal_subgraphs_size(); - for (int i = 0; i < cnt; i++) { + for (size_t i = 0; i < cnt; i++) { os << "\t\t MultiSubGraphOp " << tag << msubgraph->get_friendly_name() << "[" << i << "]" << std::endl; os << PrintableModel(*msubgraph->get_function(i).get(), tag, prefix + "\t\t"); } diff --git a/src/plugins/intel_cpu/src/utils/debug_capabilities.h b/src/plugins/intel_cpu/src/utils/debug_capabilities.h index 83b0028b606538..4ff6a7ef5a3c10 100644 --- a/src/plugins/intel_cpu/src/utils/debug_capabilities.h +++ b/src/plugins/intel_cpu/src/utils/debug_capabilities.h @@ -104,7 +104,7 @@ template std::ostream & operator<<(std::ostream & os, const PrintableVector& vec) { std::stringstream ss; auto N = vec.values.size(); - for (int i = 0; i < N; i++) { + for (size_t i = 0; i < N; i++) { if (i > 0) ss << ","; if (ss.tellp() > vec.maxsize) { diff --git a/src/plugins/intel_cpu/src/utils/debug_caps_config.h b/src/plugins/intel_cpu/src/utils/debug_caps_config.h index 73e1e6da421baf..64ceaa3b740b97 100644 --- a/src/plugins/intel_cpu/src/utils/debug_caps_config.h +++ b/src/plugins/intel_cpu/src/utils/debug_caps_config.h @@ -190,7 +190,7 @@ class DebugCapsConfig { } std::string getPropertyValueDescription(void) const override { std::string supportedTokens = "comma separated filter tokens: "; - for (auto i = 0; i < propertyTokens.size(); i++) { + for (size_t i = 0; i < propertyTokens.size(); i++) { if (i) supportedTokens.push_back(','); supportedTokens.append(propertyTokens[i].name); diff --git a/src/plugins/intel_cpu/src/utils/verbose.cpp b/src/plugins/intel_cpu/src/utils/verbose.cpp index c2def680322cf0..70e5e1c5d40f8d 100644 --- a/src/plugins/intel_cpu/src/utils/verbose.cpp +++ b/src/plugins/intel_cpu/src/utils/verbose.cpp @@ -115,14 +115,14 @@ void Verbose::printInfo() { shift(written); }; - for (int i = 0; i < node->getParentEdges().size(); i++) { + for (size_t i = 0; i < node->getParentEdges().size(); i++) { std::string prefix("src:" + std::to_string(i) + ':'); formatMemDesc(MemoryDescUtils::convertToDnnlMemoryDesc( node->getParentEdgeAt(i)->getMemory().getDesc().clone())->getDnnlDesc().get(), prefix); } - for (int i = 0; i < node->getChildEdges().size(); i++) { + for (size_t i = 0; i < node->getChildEdges().size(); i++) { std::string prefix("dst:" + std::to_string(i) + ':'); formatMemDesc(MemoryDescUtils::convertToDnnlMemoryDesc( node->getChildEdgeAt(i)->getMemory().getDesc().clone())->getDnnlDesc().get(),