Oxidize commutation cancellation #13072
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
fixes #12270
Details and comments
This is almost done but requires some discussion around how to handle global phases. The Python implementation of
CommutativeCancellation
sets the global phase of theDAGCircuit
depending on the cancelled commutations without considering the previous global phase of theDAGCircuit
:qiskit/qiskit/transpiler/passes/optimization/commutative_cancellation.py
Line 195 in f4ca088
I think this line should instead be:
dag.global_phase += total_phase - new_op_phase
I changed the tests accordingly in this PR. This PR depends on #12995 and #12870.
The following is still missing:
CommutativeCancellation
with this Rust implementation everywhere (and run thorough tests)test_callback_with_pass_requires
now fails becauseCommutativeCancellation
does not run theCommutationAnalysis
through the pass manager anymore (instead there are internal Rust calls).t
gates but notdg
gates. More importantly we only support a subset of two-qubit gates and no gates with a larger number of qubits. This might have quite an impact in some situations especially considering we are performing this pass before routing...