You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If circuits with measurements are run on real hardware they must be the last operation on the wire/qubit. If the measurement is specified as last operation, but no prior global barrier is added the transpiler might move gates behind these measurements and causes the circuit to fail.
Steps to reproduce the problem
Transpile the QASM below [1] with the specifications of the singapore backend [2].
Then the transpiled circuit contains the following part:
What is the expected behavior?
If measurement are added as final operations, they should remain the final operations.
Suggested solutions
Possibly check if the measurements are the final operations and apply the transpiler only to the part prior to the measurements.
I think the root of the problem is that BarrierBeforeFinalMeasurements should be over all the qubits, not just those with measure. @kdk has more experience here, what do think?
Adding manually barrier q, aux; before the measure seems to do the trick.
Think this was caused I think by a change in stochastic swap, but making BarrierBeforeFinalMeasurements across all qubits should fix it, and will correspond more closely to the actual device constraint.
Information
What is the current behavior?
If circuits with measurements are run on real hardware they must be the last operation on the wire/qubit. If the measurement is specified as last operation, but no prior global barrier is added the transpiler might move gates behind these measurements and causes the circuit to fail.
Steps to reproduce the problem
Transpile the QASM below [1] with the specifications of the singapore backend [2].
Then the transpiled circuit contains the following part:
What is the expected behavior?
If measurement are added as final operations, they should remain the final operations.
Suggested solutions
Possibly check if the measurements are the final operations and apply the transpiler only to the part prior to the measurements.
Resources for reproducing the problem
[1] QASM:
[2] Specs of the singapore backend:
The text was updated successfully, but these errors were encountered: