Skip to content

Commit 510ca8c

Browse files
committed
Visit all bus operations
1 parent 21ebd2c commit 510ca8c

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

air/src/tests/buses.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ fn buses_in_integrity_constraints() {
4949
main: [a],
5050
}
5151
52+
fn double(a: felt) -> felt {
53+
return a+a;
54+
}
55+
5256
buses {
5357
unit p,
5458
mult q,
@@ -69,7 +73,7 @@ fn buses_in_integrity_constraints() {
6973
}
7074
7175
integrity_constraints {
72-
p.add(1) when 1;
76+
p.add(double(a)) when 1;
7377
p.rem(1) when 1;
7478
q.add(1, 2) when 1;
7579
q.add(1, 2) when 1;

mir/src/passes/inlining.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ impl Visitor for InliningFirstPass<'_> {
204204
let evaluators = graph.get_evaluator_nodes();
205205
let boundary_constraints_roots_ref = graph.boundary_constraints_roots.borrow();
206206
let integrity_constraints_roots_ref = graph.integrity_constraints_roots.borrow();
207+
let bus_roots: Vec<_> = graph
208+
.buses
209+
.values()
210+
.flat_map(|b| b.borrow().clone().columns.into_iter().collect::<Vec<_>>())
211+
.collect();
207212

208213
let combined_roots = boundary_constraints_roots_ref
209214
.clone()
@@ -215,6 +220,7 @@ impl Visitor for InliningFirstPass<'_> {
215220
.into_iter()
216221
.map(|ic| ic.as_node()),
217222
)
223+
.chain(bus_roots.into_iter().map(|b| b.as_node()))
218224
.chain(evaluators.into_iter().map(|e| e.as_node()))
219225
.chain(functions.into_iter().map(|f| f.as_node()));
220226
combined_roots.collect()

mir/src/passes/unrolling.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,11 @@ impl Visitor for UnrollingFirstPass<'_> {
846846
fn root_nodes_to_visit(&self, graph: &Graph) -> Vec<Link<Node>> {
847847
let boundary_constraints_roots_ref = graph.boundary_constraints_roots.borrow();
848848
let integrity_constraints_roots_ref = graph.integrity_constraints_roots.borrow();
849+
let bus_roots: Vec<_> = graph
850+
.buses
851+
.values()
852+
.flat_map(|b| b.borrow().clone().columns.into_iter().collect::<Vec<_>>())
853+
.collect();
849854
let combined_roots = boundary_constraints_roots_ref
850855
.clone()
851856
.into_iter()
@@ -855,7 +860,8 @@ impl Visitor for UnrollingFirstPass<'_> {
855860
.clone()
856861
.into_iter()
857862
.map(|ic| ic.as_node()),
858-
);
863+
)
864+
.chain(bus_roots.into_iter().map(|b| b.as_node()));
859865
combined_roots.collect()
860866
}
861867

@@ -894,7 +900,7 @@ impl Visitor for UnrollingFirstPass<'_> {
894900
Node::Accessor(a) => {
895901
to_link_and(a.clone(), graph, |g, el| self.visit_accessor_bis(g, el))
896902
}
897-
Node::BusOp(_b) => todo!(),
903+
Node::BusOp(_b) => Ok(None),
898904
Node::Parameter(p) => {
899905
to_link_and(p.clone(), graph, |g, el| self.visit_parameter_bis(g, el))
900906
}

0 commit comments

Comments
 (0)