From b66f662702ae6ff9295d608d15d2f80d23cbc642 Mon Sep 17 00:00:00 2001 From: Toshinari Itoko <15028342+itoko@users.noreply.github.com> Date: Wed, 24 Jan 2024 00:01:41 +0900 Subject: [PATCH] Fix Clifford synthesis not to use the old PassManager API (#1363) ### Summary Change to use the new PassManager API to make Clifford synthesis for 3Q+ RB work with qiskit 1.0. ### Details and comments The old interface of `PassManager.append` has been removed since qiskit 1.0. It's been used to transpile 3Q+ RB circuits. This PR changes to use the new interface that uses `ConditionalController`. --------- Co-authored-by: Will Shanks --- .../library/randomized_benchmarking/clifford_synthesis.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qiskit_experiments/library/randomized_benchmarking/clifford_synthesis.py b/qiskit_experiments/library/randomized_benchmarking/clifford_synthesis.py index 29873fb37f..d1a88d7480 100644 --- a/qiskit_experiments/library/randomized_benchmarking/clifford_synthesis.py +++ b/qiskit_experiments/library/randomized_benchmarking/clifford_synthesis.py @@ -19,6 +19,7 @@ from qiskit.circuit import QuantumCircuit, Operation from qiskit.circuit.equivalence_library import SessionEquivalenceLibrary as sel from qiskit.exceptions import QiskitError +from qiskit.passmanager.flow_controllers import ConditionalController from qiskit.synthesis.clifford import synth_clifford_full from qiskit.transpiler import PassManager, CouplingMap, Layout, Target from qiskit.transpiler.passes import ( @@ -94,8 +95,8 @@ def _direction_condition(property_set): undo_layout_change, BasisTranslator(sel, basis_gates), CheckGateDirection(coupling_map), + ConditionalController(GateDirection(coupling_map), condition=_direction_condition), + Optimize1qGatesDecomposition(basis=basis_gates), ] ) - pm.append([GateDirection(coupling_map)], condition=_direction_condition) - pm.append([Optimize1qGatesDecomposition(basis=basis_gates)]) return pm.run(circ)