openqasm / qe-compiler

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

Add CircuitBarrierCircuitPattern to MergeCircuits #239

Closed bcdonovan closed 7 months ago

bcdonovan commented 8 months ago

Adds a CircuitBarrierCircuitPattern to the MergeCircuits Pass to allow:

quir.call_circuit @circuit_0(%1, %0) : (!quir.qubit<1>, !quir.qubit<1>) -> ()
quir.barrier %3, %4 : (!quir.qubit<1>, !quir.qubit<1>) -> ()
quir.call_circuit @circuit_1(%1, %0) : (!quir.qubit<1>, !quir.qubit<1>) -> ()

To be merged into a circuit quir.call_circuit with the merge circuit containing the barrier(s). Adding this pass enables more efficient pulse scheduling.

The overall pass has been refactored to factor out a number of helper functions.

bcdonovan commented 8 months ago

Could some or all of this be eliminated by doing QUIRGen more intelligently instead of having to search through and merge later?

Yes and I have started to experiment with updating QUIRGen but it will be more work and take more effort than adding this pattern. My suggestion would be to add this pattern and the update QUIRGen in the future.