Add document nodes for gpu pipeline nodes (#1292)

* Add document nodes for gpu pipeline nodes

* Load existing frame instead of clearing it

* Feature gate gpu imports
This commit is contained in:
Dennis Kobert
2023-06-08 10:13:19 +02:00
committed by GitHub
parent 710ff5cd09
commit ad8c406aa0
7 changed files with 493 additions and 12 deletions

View File

@@ -384,25 +384,25 @@ impl ProtoNetwork {
pub fn topological_sort(&self) -> Vec<NodeId> {
let mut sorted = Vec::new();
let inwards_edges = self.collect_inwards_edges();
fn visit(node_id: NodeId, temp_marks: &mut HashSet<NodeId>, sorted: &mut Vec<NodeId>, inwards_edges: &HashMap<NodeId, Vec<NodeId>>) {
fn visit(node_id: NodeId, temp_marks: &mut HashSet<NodeId>, sorted: &mut Vec<NodeId>, inwards_edges: &HashMap<NodeId, Vec<NodeId>>, network: &ProtoNetwork) {
if sorted.contains(&node_id) {
return;
};
if temp_marks.contains(&node_id) {
panic!("Cycle detected");
panic!("Cycle detected {:#?}, {:#?}", &inwards_edges, &network);
}
if let Some(dependencies) = inwards_edges.get(&node_id) {
temp_marks.insert(node_id);
for &dependant in dependencies {
visit(dependant, temp_marks, sorted, inwards_edges);
visit(dependant, temp_marks, sorted, inwards_edges, network);
}
temp_marks.remove(&node_id);
}
sorted.push(node_id);
}
assert!(self.nodes.iter().any(|(id, _)| *id == self.output), "Output id {} does not exist", self.output);
visit(self.output, &mut HashSet::new(), &mut sorted, &inwards_edges);
visit(self.output, &mut HashSet::new(), &mut sorted, &inwards_edges, self);
sorted
}