CQCL / hugr

Hierarchical Unified Graph Representation for quantum and classical programs
https://crates.io/crates/hugr
Apache License 2.0
15 stars 4 forks source link

Add a "sink" pass #1282

Closed doug-q closed 2 weeks ago

doug-q commented 2 weeks ago

We have a need to perform some operations as early as possible and some operations as late as possible.

Create a "sink" pass that is parameterised by a rank: Fn(Node) -> i64.

For all pairs of operations (o1,o2) such that:

After the pass is run o1 dominates o2.

This should be achieved by adding order edges.

aborgna-q commented 2 weeks ago

This is fixing a specific topological sort, so it could be called ~"force order".

sink sounds like a flow-related thing instead.