Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions qiskit/transpiler/preset_passmanagers/builtin_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
from qiskit.transpiler.passes.optimization import (
Optimize1qGatesDecomposition,
CommutativeCancellation,
CommutativeOptimization,
ConsolidateBlocks,
InverseCancellation,
RemoveIdentityEquivalent,
Expand Down Expand Up @@ -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())
init.append(ConsolidateBlocks())

# If approximation degree is None that indicates a request to approximate up to the
Comment on lines -159 to 162
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs rebasing on main now 🙂

Expand Down Expand Up @@ -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(),
Optimize1qGatesDecomposition(
basis=pass_manager_config.basis_gates, target=pass_manager_config.target
),
CommutativeCancellation(target=pass_manager_config.target),
ContractIdleWiresInControlFlow(),
]
post_loop = []
Expand All @@ -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(),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is CommutativeCancellation faster than Gucci? If yes we can also only run Gucci in the init stage where we expect it to provide an advantage and keep using the existing flow in lower-level stages.

Optimize1qGatesDecomposition(
basis=pass_manager_config.basis_gates, target=pass_manager_config.target
),
CommutativeCancellation(target=pass_manager_config.target),
ContractIdleWiresInControlFlow(),
]
post_loop = []
Expand Down
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.