quilc
quilc copied to clipboard
Allow `embed-swap.lisp` to assign logical qubits to physical addresses
As of #534, we avoid a bug in the addresser by limiting it to only inject SWAPs along physical edges where both endpoints have logical qubits assigned to them. There are edge cases for which this produces inefficient programs: for instance, on a chip with n+1 qubits arranged in a ring, addressing the program
CNOT 0 1
CNOT 1 2
...
CNOT (n-2) (n-1)
CNOT (n-1) 0
will miss an opportunity to assign the logical qubit n to the physical qubit n, then execute SWAP (n-1) n. Instead, it will inject SWAP 0 1 ; SWAP (n-1) (n-2) ; SWAP 1 2 ; SWAP (n-2) (n-3) ; ... until the outer two qubits interact at the center of the chain.
Decide how appropriate it is to allow the addresser to assign qubits in order to enable short SWAP chains, in which situations it's an advantage or a disadvantage, and what abstractions in CL-QUIL it might break. If appropriate, implement something.
CC @notmgsk