-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Deprecate Unroller pass #10607
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
Deprecate Unroller pass #10607
Conversation
One or more of the the following people are requested to review this:
|
So taking a quick look at the qpy failure the error is because the basis translator is causing the internal definition of the controlled gate in circuit the qpy files saved generated by old releases is (via
but with this PR applied the definition is:
which I think is equivalent but I didn't test it yet. To fix this we need to change the test assertion here to just check that they're unitary equivalent because running the same calls to build a circuit will no longer create an identical circuit when |
In this PR by switching the internal use of the Unroller to the BasisTranslator for the add_control.py module results in a different definition for the generated controlled gate than was done in previous releases this causes the qpy backwards compat tests to fail. The qpy backwards compatibility tests generate qpy files with every historical release of qiskit (that had qpy support) and valdiates that if we load those qpy files with the current state of the main branch (plus a PR under test) that the loaded circuits are identical to running the same code to generate the circuit. However, because of this divergence due to an internal change in add_control() the circuits are no longer 100% identical, but are still equivalent. To address this, a new option is added to the test suite to give an option when this situation occurs to test for unitary equivalence instead of a instruction for instruction identical circuit. This is then used for the control circuits.
This commit adds an explicit user facing warning for places where the transpiler is typically invoked by users. The normal entry point for users that are using the unroller is to call `transpile(..., translation_method="unroller")` and they don't work directly with the `Unroller` pass. This means the deprecation warning would be hidden from most users because the warning would not point to user code and the default filters will suppress it. This commit adds an explicit warning to transpile() and generate_preset_pass_manager() when the unroller is requested as the translation method to ensure users see the warning and know how to adjust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I just have a couple of minor suggestions.
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
Hmm, I am wondering if in view of #10965, we eventually want to replace |
I think it would technically be fairly easily to implement after #10965 since it's just changing the recursive exit condition to be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Summary
This PR deprecates the
Unroller
pass and moves the needed functionality over to aPassManager
usingUnrollCustomDefinitions
andBasisTranslator
.Fixes #10605
Details and comments
The
Unroller
seems unnecessary given that other passes do the same thing, andUnroller
is not used in any of the default passmanagers, and can be replaced inadd_control
.