QuTech-Delft / OpenQL

OpenQL: A Portable Quantum Programming Framework for Quantum Accelerators. https://dl.acm.org/doi/10.1145/3474222
https://openql.readthedocs.io
Other
101 stars 45 forks source link

How to represent that of swap(q1,q2), q1 is idling in the first cycle #488

Open jvansomeren opened 1 year ago

jvansomeren commented 1 year ago

When swap(q1,q2) is implemented by a decomposition to 3 CNOTs and those are decomposed to Ym90;CZ;Y90, then q1 (or otherwise q2, this depends on the details of the decomposition) idles during the first of the 10 cycles of the effective duration of this decomposition on starmon. This means that when q1 is free earlier in the past than q2 that interchanging the operands of swap(q1,q2) to swap(q2,q1) extends the circuit less so is better. This optimization is implemented in the generic (target independent) part of the router although it is specific to a particular target (starmon). Adding introspection could solve this: at the first use of this optimization, it is tested by decomposing swap(q1,q2) (and also move(q1,q2)) and 'scheduling' those sequences of primitives; by inspecting the schedule one could detect this idling; and this could be indicated in an attribute of the class for later use.