-
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
Incorrect Optimization of Swap and Measure Instructions #11195
Comments
I would like to work on this! |
The bug is in A more minimal reproducer showing the bug: from qiskit import QuantumCircuit
from qiskit.transpiler.passes import OptimizeSwapBeforeMeasure
pass_ = OptimizeSwapBeforeMeasure()
qc = QuantumCircuit(2, 1)
qc.swap(0, 1)
qc.measure(0, 0)
qc.measure(0, 0)
print(qc.draw())
print(pass_(qc).draw()) This prints
but the second circuit should be
@border-b: I can assign you, thanks! |
@jakelishman, sorry I was a bit busy with work these past couple of weeks. |
* fixed bug in OptimizeSwapBeforeMeasure #11195 * fix lint issue
* fixed bug in OptimizeSwapBeforeMeasure #11195 * fix lint issue (cherry picked from commit 3551c7c) Co-authored-by: Seemanta Bhattacharjee <[email protected]>
Fixed by: #11413 |
Environment
What is happening?
Hello, The
qiskit.transpile
function atoptimization_level=3
incorrectly optimizes circuits involving swap and measure instructions. This leads to incorrect possible outcomes when the circuit is executed.How can we reproduce the issue?
The issue can be replicated using the following Python code:
The possible outcomes differ between the original and optimized circuits:
What should happen?
The optimized circuit should yield only
000
and010
outcomes, consistent with the original circuit.Any suggestions?
The potential source of the bug could be in
qiskit/transpiler/passes/optimization/optimize_swap_before_measure
The text was updated successfully, but these errors were encountered: