-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Reset optimization in the transpiler #5127
Comments
@andrewwack if you have any suggestions you'd like to add based on your experience feel free... |
So I think what this comes down to is we have a What I think we should do here is probably add a similar The other alternative I see is exposing a boolean flag in the |
I like this approach in the |
Well, I'm thinking if it's a |
Sure, that makes sense. In that case, I think we'd need a second option so that it doesn't occur anywhere else in the circuit. It would also be nice if the |
What is the expected enhancement?
Modification of the behavior of the
reset
instruction in the transpiler.There is a standard transpiler pass
RemoveResetInZeroState
, which understandably deletes areset
when the qubit is already in the ground state. According to documentation, this should be applied foroptimization_level >= 1
.However, it does not always act as expected. Consider
This gives the output
We would expect that level 1 removes the two
x
gates in line w/ theRemoveResetInZeroState
, but it does not.Furthermore, when using a backend, interchanging of
reset
instructions forswap
gates can be unpredictable.Consider the following circuits which use a single
reset
on 3 different qubits. This is run on the public 5q deviceibmq_ourense
The result is
We observe that for levels 0, 1, the
reset
on1
is changed w/ a swap and moved to another qubit. However, on levels 2,3 this does not occur. I would expect that the optimization increase for these higher levels.Suggestions and Discussion
Regarding the pass,
RemoveResetInZeroState
, I believe we should make it easier for users to turn this off. Advanced users adding their ownreset
instructions may not want them optimized away (for instance, they may be testing the backend reset fidelity). There is a flaginit_qubits
in the assembler which defines whether qubits are initialized, but I think we need something more general to define whether or not resets should be optimized away.The other issue is defining and adding clarity to the unrolling on
reset
instructions as shown above. It would be nice if users could choose to shut this unrolling off and maintain the exact ordering and location ofreset
's that they sent in initially. Some documentation of how this process works would also be beneficial.The text was updated successfully, but these errors were encountered: