Skip to content
Snippets Groups Projects

Fork fission

Merged Xavier Routh requested to merge fork-fission into main
Files
5
@@ -310,23 +310,33 @@ pub fn fork_fission<'a>(
reduce_cycles: &HashMap<NodeID, HashSet<NodeID>>,
loop_tree: &LoopTree,
fork_join_map: &HashMap<NodeID, NodeID>,
fork_label: LabelID,
) -> Vec<NodeID> {
let mut forks: Vec<_> = loop_tree
let forks: Vec<_> = loop_tree
.bottom_up_loops()
.into_iter()
.filter(|(k, _)| editor.func().nodes[k.idx()].is_fork())
.collect();
let mut created_forks = Vec::new();
// This does the reduction fission
for fork in forks.clone() {
for fork in forks {
let join = fork_join_map[&fork.0];
// FIXME: Don't make multiple forks for reduces that are in cycles with each other.
let reduce_partition = default_reduce_partition(editor, fork.0, join);
if !editor.func().labels[fork.0.idx()].contains(&fork_label) {
continue;
}
if editor.is_mutable(fork.0) {
created_forks = fork_reduce_fission_helper(editor, fork_join_map, reduce_partition, nodes_in_fork_joins, fork.0);
if !created_forks.is_empty() {
break;
if created_forks.is_empty() {
continue;
} else {
return created_forks;
}
}
Loading