Skip to content

Commit

Permalink
Fix e2e issue
Browse files Browse the repository at this point in the history
Sync node indexes must be registered to global allocation context
in order.
  • Loading branch information
EgorDuplensky committed Jan 29, 2025
1 parent 00be0fe commit 73956d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/plugins/intel_cpu/src/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,19 +911,20 @@ int Graph::RegisterToAllocationContext(int offset, AllocationContext& context) {
ResolveInOutInPlaceEdges(graphEdges);

// nodes are expected to be topologically sorted
for (size_t execIndex = 0, j = 0; execIndex < graphNodes.size(); execIndex++) {
for (size_t execIndex = 0, syncNodeIdx = 0; execIndex < graphNodes.size(); execIndex++) {
const auto& node = graphNodes[execIndex];
const auto inputExecIndex = offset;
// register local sync node idx to global allocation context as well
if (syncNodeIdx < syncNodesInds.size() && syncNodesInds[syncNodeIdx] == execIndex) {
context.syncPoints.push_back(inputExecIndex);
syncNodeIdx++;
}

// an offset is the number of nodes in the internal graph minus the current node (-1)
offset = node->registerToAllocationContext(inputExecIndex, context);
const auto outputExecIndex = offset;
offset++;
context.execIndex[node] = {inputExecIndex, outputExecIndex};

if (j < syncNodesInds.size() && syncNodesInds[j] == execIndex) {
context.syncPoints.push_back(inputExecIndex);
j++;
}
}

context.edges.insert(context.edges.end(), graphEdges.begin(), graphEdges.end());
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/intel_cpu/src/nodes/if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ void If::initSupportedPrimitiveDescriptors() {
}

int If::registerToAllocationContext(int offset, AllocationContext& context) {
offset = m_thenGraph.RegisterToAllocationContext(offset, context);
return m_elseGraph.RegisterToAllocationContext(offset, context);
const int thenOffset = m_thenGraph.RegisterToAllocationContext(offset, context);
const int elseOffset = m_elseGraph.RegisterToAllocationContext(thenOffset, context);
return m_elseGraph.RegisterToAllocationContext(elseOffset, context);
}

void If::createPrimitive() {
Expand Down

0 comments on commit 73956d3

Please sign in to comment.