-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Larger barrier than expected following a quantum volume circuit #8910
Comments
I believe that is intentional behavior, I ran a quick test of your code with a callback set:
and the barrier is being added by the The idea behind it is to prevent swap mapping from unintentionally inserting a swap after a measurement by inserting a barrier on all qubits. But that pass predates my involvement on the project, maybe @kdk can comment on this more as it looks like he made this pass insert a device wide barrier in #4054 |
Thanks, and thanks for the debug callback trick. Do you know what makes import qiskit
from qiskit.converters import dag_to_circuit
c = qiskit.QuantumCircuit(3)
c.x(0)
c.cnot(0,1)
c.cnot(1,2)
cc = qiskit.QuantumCircuit(*c.qregs)
cc.compose(c.to_instruction(), qubits=cc.qubits, inplace=True)
cc.measure_active()
def callback(**kwargs):
print(kwargs["pass_"])
print(dag_to_circuit(kwargs["dag"]))
qiskit.transpile(cc, backend=backend, initial_layout=[0,1,2], callback=callback) (where I've wrapped a circuit into an instruction to make it look as much like a QV circuit as possible) |
My guess is that there is no routing (the transpiler stage that adds swaps to make up for a lack of connectivity on the device to run the circuit) needed. The cnot circuit just needs a 3 nodes that have a path between them which the coupling map will have, while a quantum volume circuit needs routing to run because the device has insufficient connectivity. The barrier before measurement pass only runs when there is routing is run, because it adds the barrier as a guard against the pass adding a swap incorrectly (according to the comments). |
It's looking more and more like it should be |
Environment
What is happening?
Construction a quantum volume circuit, followed by a measurement of active qubits, followed by a transpilation to a backend, produces a barrier across all qubits in the device including the ancilla.
How can we reproduce the issue?
What should happen?
This behaviour is stochastic depending on the circuit generated, but I expected transpiler to always keep the barrier on only the active physical qubits. I believe this issue is the root of qiskit-community/qiskit-experiments#845, though that issue could also be fixed in other ways.
Any suggestions?
No response
The text was updated successfully, but these errors were encountered: