Skip to content

Commit

Permalink
[CPU][DEBUG_CAPS] Bring back an execution of all nodes for debug caps (
Browse files Browse the repository at this point in the history
…#28597)

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 should never be executed
even with debug caps.
  • Loading branch information
EgorDuplensky authored Jan 29, 2025
1 parent 2eb92ad commit bf5175d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/plugins/intel_cpu/src/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/plugins/intel_cpu/src/utils/debug_capabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bf5175d

Please sign in to comment.