Skip to content

Commit

Permalink
Avoid unnecessary reordering for nodes with several consumers before …
Browse files Browse the repository at this point in the history
…output
  • Loading branch information
v-Golubev committed Jul 11, 2024
1 parent 433456b commit 12f652e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/plugins/intel_cpu/src/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,15 @@ void Graph::Replicate(const std::shared_ptr<const ov::Model> &model) {
const auto parentEdge = outputNode->getParentEdgeAt(0);
const auto parent = parentEdge->getParent();
parent->setOriginalOutputPrecisionAtPort(parentEdge->getInputNum(), precToSet);
// If the parent has consumers except Output, precToSet is propagated to consumer's inputs
// to avoid precision mismatch (which leads to reaorder insertion and unnecessary performance overheads)
if (parent->getChildEdges().size() > 1) {
for (size_t i = 0; i < parent->getChildEdges().size(); ++i) {
const auto childEdge = parent->getChildEdgeAt(i);
const auto child = childEdge->getChild();
child->setOriginalInputPrecisionAtPort(childEdge->getOutputNum(), precToSet);
}
}
}
}

Expand Down

0 comments on commit 12f652e

Please sign in to comment.