Skip to content
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

Use InverseCancellation in opt level 1 instead of CXCancellation #11210

Merged
merged 2 commits into from
Nov 8, 2023
Merged
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
36 changes: 34 additions & 2 deletions qiskit/transpiler/preset_passmanagers/builtin_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,31 @@
CommutativeCancellation,
Collect2qBlocks,
ConsolidateBlocks,
CXCancellation,
InverseCancellation,
)
from qiskit.transpiler.passes import Depth, Size, FixedPoint, MinimumPoint
from qiskit.transpiler.passes.utils.gates_basis import GatesInBasis
from qiskit.transpiler.passes.synthesis.unitary_synthesis import UnitarySynthesis
from qiskit.passmanager.flow_controllers import ConditionalController
from qiskit.transpiler.timing_constraints import TimingConstraints
from qiskit.transpiler.passes.layout.vf2_layout import VF2LayoutStopReason
from qiskit.circuit.library.standard_gates import (
CXGate,
ECRGate,
CZGate,
XGate,
YGate,
ZGate,
TGate,
TdgGate,
SwapGate,
SGate,
SdgGate,
HGate,
CYGate,
SXGate,
SXdgGate,
)


class DefaultInitPassManager(PassManagerStagePlugin):
Expand Down Expand Up @@ -468,7 +485,22 @@ def _opt_control(property_set):
Optimize1qGatesDecomposition(
basis=pass_manager_config.basis_gates, target=pass_manager_config.target
),
CXCancellation(),
InverseCancellation(
[
CXGate(),
ECRGate(),
CZGate(),
CYGate(),
XGate(),
YGate(),
ZGate(),
HGate(),
SwapGate(),
(TGate(), TdgGate()),
(SGate(), SdgGate()),
(SXGate(), SXdgGate()),
]
),
]
elif optimization_level == 2:
# Steps for optimization level 2
Expand Down