openqasm / qe-compiler

An MLIR based compiler dynamic circuit compiler for real-time control systems supporting OpenQASM 3
Other
38 stars 12 forks source link

Test for overlap with all quantum operations in MergeCircuitsPass #244

Closed bcdonovan closed 5 months ago

bcdonovan commented 5 months ago

The MergeCircuitsPass assumed that the only quantum operation between quir.call_circuits operations would be quir.barriers. This assumption failed with the BreakResetsPass which currently inserts quir.measure and quir.call_gate @x in the main function.

One way to fix this would be to adjust BreakResetsPass to be --enable-circuits aware. The alternative implemented here is to handle operations other than barriers between quir.circuit_ops and test for qubit overlap in the same way currently being applied to quir.barriers.

This alternative was chosen so that existing and future passes would not be required to be "quir.circuit" aware and therefore MergeCircuitsPass would be more robust to that situation.