Delegate BasePass.__call__ to PassManager.run#13820
Conversation
This ensures that calling a pass directly will follow the same execution logic as a regular pass-manager construction. This particularly matters for passes that have `requires`. It also ensures that the conversion from a circuit and back to a DAG will follow the same rules, which is expected since it is a shorthand notation, but liable to get out of sync as they are complex.
|
One or more of the following people are relevant to this code:
|
| # is equivalent to the original circuit | ||
| perm = pass_.property_set["virtual_permutation_layout"].to_permutation(qc.qubits) | ||
| res.append(PermutationGate(perm), [0, 1, 2, 3, 4]) | ||
| res.append(PermutationGate(res.layout.routing_permutation()), [0, 1, 2, 3, 4]) |
There was a problem hiding this comment.
PassManager.run explicitly clears out virtual_permutation_layout from a property_set after execution, since it updates the layout fields. This new version of the PermutationGate is more properly the behaviour we want to test, though.
|
Oh whoops, I forgot I hadn't fixed that test error locally. |
Pull Request Test Coverage Report for Build 13687355258Details
💛 - Coveralls |
06e1753 to
390fa85
Compare
mtreinish
left a comment
There was a problem hiding this comment.
This LGTM, it seems pretty straightforward and it'll be good to unify the logic between __call__ and PassManager.run()
| try: | ||
| return meth(*meth_args, **meth_kwargs) | ||
| except TranspilerError: | ||
| # If it's already a `TranspilerError` subclass, don't erase the extra information. |
There was a problem hiding this comment.
I remember discussing this offline, but TranspilerError being a subclass of PassManagerError seems so weird. But it's hard to change this now so this makes sense.
There was a problem hiding this comment.
I assume it was intended as a backwards-compatibility shim for a move to PassManagerError during the genericisation of PassManager, but I don't really know.
This ensures that calling a pass directly will follow the same execution logic as a regular pass-manager construction. This particularly matters for passes that have
requires. It also ensures that the conversion from a circuit and back to a DAG will follow the same rules, which is expected since it is a shorthand notation, but liable to get out of sync as they are complex.Summary
Details and comments
Fix #13444.
Requires #13821 to effect the warning on the future behaviour change.