Alice-Bob-SW / qiskit-alice-bob-provider

Qiskit provider to execute quantum circuits on Alice & Bob cat qubits
https://felis.alice-bob.com/docs/
Apache License 2.0
28 stars 11 forks source link

Ensure every qubit is initialized #6

Closed jrj-d closed 1 year ago

jrj-d commented 1 year ago

From the docstring of EnsurePreparationPass:

A transpilation pass that ensures there is a state preparation at the beginning of the circuit.

If there isn't, a Reset is added (i.e. prepare the zero state in the Z basis).

The reason for this pass is that Qiskit runs the RemoveResetInZeroState pass as part of the default transpilation passes, in most cases (precisely for optimization_level >=1, the default being 1).

The community seems to agree that this behavior is a bad decision and should be removed. https://github.com/Qiskit/qiskit-terra/issues/6943 The rationale for this behavior was that IBM backends always reset the qubits to zero between shots. This behavior cannot be assumed to be true for all backends, including Alice & Bob's. Once this issue is resolved, this transpilation pass should be removed from the Alice & Bob provider.

This transpilation pass cannot be added to the transpilation stage plugin of the Alice & Bob provider, because the RemoveResetInZeroState runs in the optimization stage, which happens after the transpilation stage.

For this reason, this pass is run manually right before the compilation from Qiskit to QIR.