From 80c25fc55061b06b98a63aa5effbc907b5009fcd Mon Sep 17 00:00:00 2001 From: Egor Duplensky Date: Tue, 21 Jan 2025 19:38:05 +0100 Subject: [PATCH] [CPU][DEBUG_CAPS] Bring back an execution of all nodes for debug caps The logic was reverted due to the issues with making all the nodes executable in some scenarious. The problem is that without this functionality debug capabilities became less usable. So bring back the logic and try to cover problematic scenarios, i.e. static nodes with empty shapes, which never should be executed even with debug caps. --- src/plugins/intel_cpu/src/graph.cpp | 14 +++++++++----- .../intel_cpu/src/utils/debug_capabilities.h | 4 ++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/plugins/intel_cpu/src/graph.cpp b/src/plugins/intel_cpu/src/graph.cpp index 01371d64b779a0..262c00ad1cd750 100644 --- a/src/plugins/intel_cpu/src/graph.cpp +++ b/src/plugins/intel_cpu/src/graph.cpp @@ -284,12 +284,16 @@ static std::tuple, std::vector> ExtractExecutableNo std::unordered_map graphIdToExecutableId; std::vector 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 4165f71885b2b9..d9dfbd88ae6784 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