-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Default optimization level does not perform self-inverse gate cancellations #7016
Comments
Work was recently started in this direction by @vadebayo49 (see #6855 and #6576 ) but there is still some work to be done before this can be utilized by the default optimization levels, namely a way to identify (either through gate annotations or a library) which gates and gate pairs are inverse. |
This is caused by the I think we need to re-evaluate which passes we include in the different optimization levels because I think we can get away with more optimization in level 1 than we have right now. |
It does work at level 2 and higher. However, given that the vast majority of users just do |
This commit updates the default optimization stage plugin to use the InverseCancellation pass instead of CXCancellation for optimization level 1. The CXCancellation pass was hard coded to only cancel runs of CX gates on the same qubits. This was fine when CX is the target, but for other targets which aren't using CX the pass had no value. An alternative, more general, inverse cancellation pass was added in Qiskit#6855 that enables defining arbitrary inverse cancellation rules and simplifying a dag based on it. This commit updates the default optimization plugin at optimization level 1 to use this with some common inverse rules for 2q gates from the standard gate library. Closes: Qiskit#6576 Closes: Qiskit#7016 Related-to: Qiskit#7112
This commit updates the default optimization stage plugin to use the InverseCancellation pass instead of CXCancellation for optimization level 1. The CXCancellation pass was hard coded to only cancel runs of CX gates on the same qubits. This was fine when CX is the target, but for other targets which aren't using CX the pass had no value. An alternative, more general, inverse cancellation pass was added in Qiskit#6855 that enables defining arbitrary inverse cancellation rules and simplifying a dag based on it. This commit updates the default optimization plugin at optimization level 1 to use this with some common inverse rules for 2q gates from the standard gate library. Closes: Qiskit#6576 Closes: Qiskit#7016 Related-to: Qiskit#7112
) * Use InverseCancellation in opt level 1 instead of CXCancellation This commit updates the default optimization stage plugin to use the InverseCancellation pass instead of CXCancellation for optimization level 1. The CXCancellation pass was hard coded to only cancel runs of CX gates on the same qubits. This was fine when CX is the target, but for other targets which aren't using CX the pass had no value. An alternative, more general, inverse cancellation pass was added in #6855 that enables defining arbitrary inverse cancellation rules and simplifying a dag based on it. This commit updates the default optimization plugin at optimization level 1 to use this with some common inverse rules for 2q gates from the standard gate library. Closes: #6576 Closes: #7016 Related-to: #7112 * Add sx sx dagger inverse pair to pass
Information
What is the current behavior?
Steps to reproduce the problem
What is the expected behavior?
I would expect the default level of optimization to remove trivial things like repeated H gates.
Suggested solutions
The text was updated successfully, but these errors were encountered: