-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add CommutativeOptimization to transpiler pipeline
#15464
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
base: main
Are you sure you want to change the base?
Changes from all commits
7256088
acab8de
b943de7
2725ecc
a9ea934
313190a
99fb3ff
efd283e
6ead751
a3b4fa5
3127f0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,7 @@ | |
| from qiskit.transpiler.passes.optimization import ( | ||
| Optimize1qGatesDecomposition, | ||
| CommutativeCancellation, | ||
| CommutativeOptimization, | ||
| ConsolidateBlocks, | ||
| InverseCancellation, | ||
| RemoveIdentityEquivalent, | ||
|
|
@@ -152,11 +153,15 @@ def pass_manager(self, pass_manager_config, optimization_level=None): | |
| ContractIdleWiresInControlFlow(), | ||
| ] | ||
| ) | ||
| init.append(CommutativeCancellation()) | ||
|
|
||
| # We do not want to consolidate blocks for a Clifford+T basis set, | ||
| # since this involves resynthesizing 2-qubit unitaries. | ||
| if not pass_manager_config._is_clifford_t: | ||
| # For continuous basis sets, we now CommutativeOptimization instead of | ||
| # CommutativeCancellation. For Clifford+T transpilation, we still use | ||
| # CommutativeCancellation and disable consolidating | ||
| # blocks as this involves resynthesizing 2-qubit unitaries. | ||
| if pass_manager_config._is_clifford_t: | ||
| init.append(CommutativeCancellation()) | ||
| else: | ||
| init.append(CommutativeOptimization()) | ||
alexanderivrii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| init.append(ConsolidateBlocks()) | ||
|
|
||
| # If approximation degree is None that indicates a request to approximate up to the | ||
|
Comment on lines
-159
to
162
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs rebasing on |
||
|
|
@@ -531,10 +536,10 @@ def pass_manager(self, pass_manager_config, optimization_level=None): | |
| approximation_degree=pass_manager_config.approximation_degree, | ||
| target=pass_manager_config.target, | ||
| ), | ||
| CommutativeOptimization(), | ||
alexanderivrii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Optimize1qGatesDecomposition( | ||
| basis=pass_manager_config.basis_gates, target=pass_manager_config.target | ||
| ), | ||
| CommutativeCancellation(target=pass_manager_config.target), | ||
| ContractIdleWiresInControlFlow(), | ||
| ] | ||
| post_loop = [] | ||
|
|
@@ -559,10 +564,10 @@ def pass_manager(self, pass_manager_config, optimization_level=None): | |
| approximation_degree=pass_manager_config.approximation_degree, | ||
| target=pass_manager_config.target, | ||
| ), | ||
| CommutativeOptimization(), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is |
||
| Optimize1qGatesDecomposition( | ||
| basis=pass_manager_config.basis_gates, target=pass_manager_config.target | ||
| ), | ||
| CommutativeCancellation(target=pass_manager_config.target), | ||
| ContractIdleWiresInControlFlow(), | ||
| ] | ||
| post_loop = [] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| features_transpiler: | ||
| - | | ||
| The default compilation pipeline for continuous basis sets now uses | ||
| :class:`.CommutativeOptimization` instead of :class:`.CommutativeCancellation`, | ||
| which is relevant for optimization levels 2 and 3. This change should | ||
| yield higher-quality circuits at similar runtimes. |
Uh oh!
There was an error while loading. Please reload this page.