-
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
CommutationAnalysis needs to be refactored #8020
Comments
In continuation of #8056, the following test currently fails due to unsound optimization:
due to transitivity assumption. The following test is an example of missed optimization in case of naive fix:
|
A few questions.
|
Copying the comment from https://qiskit.org/documentation/stubs/qiskit.transpiler.passes.CommutationAnalysis.html:
At least it's worth adding some simple rule-based commuting relations between standard gates. |
in 2018, #1500 introduced
CommutationAnalysis
pass. The pass does the trick while working withCommutativeCancellation
. However, there are some aspects that are not very well covered and I think it is time to sit again with it and think it over again. Here there are a list of the problems:property
commutation_set
is a messy dictThe property
property_set['commutation_set']
is a non-uniformly typed dict:suggested solution:
property_set['commutation_set']
should be aqiskit.dagcircuit.dagdependency.DAGDependency
.does not handle intransitivity
The current commutation analysis assumes transitivity (I think), while the relation is intransitive. For example
H
commutes withI
andI
commutes withZ
, butH
does not commute withZ
. This is not reflected in the commutative set:There is a lot of duplication with
DAGDependency
The
qiskit.dagcircuit.dagdependency.DAGDependency
seems to do the same asqiskit.transpiler.passes.optimization.commutation_analysis.CommutationAnalysis
. For exampleqiskit.dagcircuit.dagdependency._does_commute
andqiskit.transpiler.passes.optimization.commutation_analysis._commute
are similar in their goal, but one of them has a cache system that makes it better.The text was updated successfully, but these errors were encountered: