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
add control flow to CommutativeCancellation pass (Qiskit#9143)
* add initial tests
* tests passing
* remove debug code
* fix test for clbits
* formatting
* Lift creation of PassManager out of loop
In _handle_control_flow_ops, a new PassManager was created for each ControlFlowOp
found. This commit moves the creation out of the loop over nodes. This should be
a bit more efficient.
I also considered mapped_blocks.clear() rather than reallocating. But in some
simpler tests of clearing rather than reallocating, this is actually less performant.
I think reallocating renders the code slightly more understandable.
* Test commutative cancellation does not cross block boundaries
These were requested in a review comment. The previous commit was
also requested in a review comment.
* Add release note for commutative cancellation in control flow blocks
* Include CommutativeAnalysis pass explicitly when doing control flow blocks
A new PassManager for CommutativeCancellation is constructed when descending into control flow blocks.
This commit explicitly includes a CommutativeAnalysis pass in this construction rather than relying on
`requires`. This change, while not necessary, is made for consistency with other explicit constructions
of PassManagers containing these passes.
* Use existing CommutativeCancellation pass in control flow op blocks
A previous commit made a copy of the pass being used in the parent context to be used
in the blocks of a control flow op. With this commit, we reuse the existing pass,
as it is immutable.
* Move import of PassManager from method to top of file
* Revert commit f8c2aaf because I missed a fix already to go
* Update qiskit/transpiler/passes/optimization/commutative_cancellation.py
Co-authored-by: Matthew Treinish <[email protected]>
---------
Co-authored-by: John Lapeyre <[email protected]>
Co-authored-by: Matthew Treinish <[email protected]>
0 commit comments