Skip to content

Commit

Permalink
exclude loops from some handling of things
Browse files Browse the repository at this point in the history
  • Loading branch information
MingweiSamuel committed Jan 17, 2025
1 parent 59fa7e0 commit 0aa8156
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 10 deletions.
10 changes: 10 additions & 0 deletions dfir_lang/src/graph/flat_to_partitioned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ impl BarrierCrossers {
fn find_barrier_crossers(partitioned_graph: &DfirGraph) -> BarrierCrossers {
let edge_barrier_crossers = partitioned_graph
.edges()
.filter(|&(_, (_src, dst))| {
// Exclude edges within `loop {` contexts.
partitioned_graph.node_loop(dst).is_none()
})
.filter_map(|(edge_id, (_src, dst))| {
let (_src_port, dst_port) = partitioned_graph.edge_ports(edge_id);
let op_constraints = partitioned_graph.node_op_inst(dst)?.op_constraints;
Expand Down Expand Up @@ -396,6 +400,12 @@ fn find_subgraph_strata(
let extra_stratum = partitioned_graph.max_stratum().unwrap_or(0) + 1; // Used for `defer_tick()` delayer subgraphs.
for (edge_id, &delay_type) in barrier_crossers.edge_barrier_crossers.iter() {
let (hoff, dst) = partitioned_graph.edge(edge_id);

// ignore for `loop {`s.
if partitioned_graph.node_loop(dst).is_some() {
continue;
}

let (_hoff_port, dst_port) = partitioned_graph.edge_ports(edge_id);

assert_eq!(1, partitioned_graph.node_predecessors(hoff).count());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ digraph {
subgraph "cluster n4v1" {
fillcolor="#dddddd"
style=filled
label = "sg_4v1\nstratum 1"
label = "sg_4v1\nstratum 0"
n8v1
n9v1
n10v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ subgraph sg_3v1 ["sg_3v1 stratum 0"]
7v1
end
end
subgraph sg_4v1 ["sg_4v1 stratum 1"]
subgraph sg_4v1 ["sg_4v1 stratum 0"]
8v1
9v1
10v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ digraph {
subgraph "cluster n4v1" {
fillcolor="#dddddd"
style=filled
label = "sg_4v1\nstratum 1"
label = "sg_4v1\nstratum 0"
n8v1
n9v1
n10v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ subgraph sg_3v1 ["sg_3v1 stratum 0"]
7v1
end
end
subgraph sg_4v1 ["sg_4v1 stratum 1"]
subgraph sg_4v1 ["sg_4v1 stratum 0"]
8v1
9v1
10v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ digraph {
subgraph "cluster n4v1" {
fillcolor="#dddddd"
style=filled
label = "sg_4v1\nstratum 1"
label = "sg_4v1\nstratum 0"
n4v1
subgraph "cluster_sg_4v1_var_usrs3" {
label="var usrs3"
Expand All @@ -73,7 +73,7 @@ digraph {
subgraph "cluster n5v1" {
fillcolor="#dddddd"
style=filled
label = "sg_5v1\nstratum 1"
label = "sg_5v1\nstratum 0"
n5v1
subgraph "cluster_sg_5v1_var_usrs3" {
label="var usrs3"
Expand All @@ -83,7 +83,7 @@ digraph {
subgraph "cluster n6v1" {
fillcolor="#dddddd"
style=filled
label = "sg_6v1\nstratum 2"
label = "sg_6v1\nstratum 0"
n6v1
n7v1
n8v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ subgraph sg_3v1 ["sg_3v1 stratum 0"]
3v1
end
end
subgraph sg_4v1 ["sg_4v1 stratum 1"]
subgraph sg_4v1 ["sg_4v1 stratum 0"]
4v1
subgraph sg_4v1_var_usrs3 ["var <tt>usrs3</tt>"]
4v1
end
end
subgraph sg_5v1 ["sg_5v1 stratum 1"]
subgraph sg_5v1 ["sg_5v1 stratum 0"]
5v1
subgraph sg_5v1_var_usrs3 ["var <tt>usrs3</tt>"]
5v1
end
end
subgraph sg_6v1 ["sg_6v1 stratum 2"]
subgraph sg_6v1 ["sg_6v1 stratum 0"]
6v1
7v1
8v1
Expand Down

0 comments on commit 0aa8156

Please sign in to comment.