Skip to content

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

[CPU][DEBUG_CAPS] Bring back an execution of all nodes for debug caps (#28597)

Egor Duplenskiibf5175da75de
diff --git a/src/plugins/intel_cpu/src/graph.cpp b/src/plugins/intel_cpu/src/graph.cpp
index 3d83d644185..9dee4424e7a 100644
--- a/src/plugins/intel_cpu/src/graph.cpp
+++ b/src/plugins/intel_cpu/src/graph.cpp
@@ -288,12 +288,16 @@ static std::tuple<std::vector<NodePtr>, std::vector<size_t>> ExtractExecutableNo
std::unordered_map<size_t, size_t> graphIdToExecutableId;
std::vector<NodePtr> executableGraphNodes;
for (size_t i = 0; i < graphNodes.size(); i++) {
- const auto& graphNode = graphNodes[i];
- if ((!graphNode->isConstant() && graphNode->isExecutable()) || // non-constant executable or
- (graphNode->isDynamicNode() &&
- !one_of(graphNode->getType(), Type::Input, Type::Output))) { // dynamic, except inputs / outputs
+ const auto& node = graphNodes[i];
+ const bool staticZeroDims = !node->isDynamicNode() && !node->isExecutable() && !node->isInPlace();
+ const bool dynamicNonInputOutput = node->isDynamicNode() && !one_of(node->getType(), Type::Input, Type::Output);
+
+ if (!node->isConstant() && // constants are executed once in scope of compile_model
+ !staticZeroDims && // never execute static nodes with zero dim input / output tensors
+ (CPU_DEBUG_CAPS_ALWAYS_TRUE(node->isExecutable()) || // execute all executable nodes
+ dynamicNonInputOutput)) { // plus dynamic ones, except inputs / outputs
graphIdToExecutableId[i] = executableGraphNodes.size();
- executableGraphNodes.emplace_back(graphNode);
+ executableGraphNodes.emplace_back(node);
}
}
diff --git a/src/plugins/intel_cpu/src/utils/debug_capabilities.h b/src/plugins/intel_cpu/src/utils/debug_capabilities.h
index 4165f71885b..d9dfbd88ae6 100644
--- a/src/plugins/intel_cpu/src/utils/debug_capabilities.h
+++ b/src/plugins/intel_cpu/src/utils/debug_capabilities.h
@@ -181,6 +181,8 @@ static inline std::ostream& _write_all_to_stream(std::ostream& os, const T& arg,
# define CREATE_DEBUG_TIMER(x) PrintableTimer x
+# define CPU_DEBUG_CAPS_ALWAYS_TRUE(x) true
+
/*
* important debugging tools for accuracy issues
* OV_CPU_INFER_PRC_POS_PATTERN : positive regex pattern to filter node type & orgname.
@@ -286,6 +288,8 @@ bool getEnvBool(const char* name);
# define CREATE_DEBUG_TIMER(x)
+# define CPU_DEBUG_CAPS_ALWAYS_TRUE(x) x
+
#endif // CPU_DEBUG_CAPS
// To avoid "unused variable" warnings `when debug caps