Skip to content

Commit

Permalink
fix: Avoid processing the same nodes multiple times in order to avoid…
Browse files Browse the repository at this point in the history
… duplicated transient nodes.
  • Loading branch information
LukeMathWalker committed Nov 12, 2024
1 parent b493d53 commit 689020b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libs/pavexc/src/compiler/analyses/call_graph/core_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ where
let root_node_index = add_node_for_component(&mut call_graph, &mut node_deduplicator, root_id);
let mut nodes_to_be_visited: IndexSet<VisitorStackElement> =
IndexSet::from_iter([VisitorStackElement::orphan(root_node_index)]);
let mut processed_nodes = HashSet::new();

loop {
while let Some(node_to_be_visited) = nodes_to_be_visited.pop() {
Expand All @@ -179,6 +180,11 @@ where
}
}

// We've already processed dependencies for this node.
if processed_nodes.contains(&current_index) {
continue;
}

// We need to recursively build the input types for all our compute components;
if let CallGraphNode::Compute { component_id, .. } = call_graph[current_index].clone() {
let component = component_db.hydrated_component(component_id, computation_db);
Expand Down Expand Up @@ -243,6 +249,8 @@ where
}
}
}

processed_nodes.insert(current_index);
}

let indexes = call_graph.node_indices().collect::<Vec<_>>();
Expand Down

0 comments on commit 689020b

Please sign in to comment.