From 26232f7500bdefe2f3c952d38bea342c48aeebea Mon Sep 17 00:00:00 2001 From: Alexander Ivrii Date: Tue, 26 Aug 2025 18:00:04 +0300 Subject: [PATCH 1/2] No longer hardcoding the usage of Solovay-Kitaev unitary synthesis plugin --- qiskit/transpiler/preset_passmanagers/common.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/qiskit/transpiler/preset_passmanagers/common.py b/qiskit/transpiler/preset_passmanagers/common.py index 6769a1223fe6..891874da75fb 100644 --- a/qiskit/transpiler/preset_passmanagers/common.py +++ b/qiskit/transpiler/preset_passmanagers/common.py @@ -492,6 +492,12 @@ def generate_translation_passmanager( # We set target=None to make sure extended_basis_gates is not overwritten by the target. extended_basis_gates = list(basis_gates) + ["u"] + # The default value of unitary_synthesis_method in transpile/generate_preset_pass_manager + # is "default". In this case we want to use the Solovay-Kitaev decomposition (called "sk"). + # However, we also allow specifyig a non-default Clifford+T unitary synthesis plugin. + if unitary_synthesis_method == "default": + unitary_synthesis_method = "sk" + unroll = [ # Use the UnitarySynthesis pass to unroll 1-qubit and 2-qubit gates named "unitary" into # extended_basis_gates. @@ -535,14 +541,14 @@ def generate_translation_passmanager( # We use the "clifford" unitary synthesis plugin to replace single-qubit # unitary gates that can be represented as Cliffords by Clifford gates. UnitarySynthesis(method="clifford", plugin_config={"max_qubits": 1}), - # We use the Solovay-Kitaev decomposition via the plugin mechanism for "sk" - # UnitarySynthesisPlugin. + # We decompose single-qubit unitary gates using the UnitarySynthesisPlugin interface + # (by default it's the Solovay-Kitaev decomposition). UnitarySynthesis( basis_gates=["h", "t", "tdg"], approximation_degree=approximation_degree, coupling_map=coupling_map, plugin_config=unitary_synthesis_plugin_config, - method="sk", + method=unitary_synthesis_method, min_qubits=1, target=None, ), From f68a31dbbc7a8911717710ab631a9a3bc1f0442b Mon Sep 17 00:00:00 2001 From: Alexander Ivrii Date: Wed, 22 Oct 2025 11:56:54 +0300 Subject: [PATCH 2/2] clarifying that a custom unitary synthesis method for the Clifford+T flow must be capable of approximating using the Clifford+T basis set --- qiskit/transpiler/__init__.py | 5 ++++- qiskit/transpiler/preset_passmanagers/common.py | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/qiskit/transpiler/__init__.py b/qiskit/transpiler/__init__.py index fbfa6d0417f1..c1ccf8725a3e 100644 --- a/qiskit/transpiler/__init__.py +++ b/qiskit/transpiler/__init__.py @@ -748,7 +748,10 @@ towards the ISA. For a Clifford+T basis set, the single-qubit rotation gates are approximated using the -:class:`.SolovayKitaevDecomposition` algorithm. +:class:`.UnitarySynthesis` pass. By default (when ``unitary_synthesis_method='default'``), +this invokes the :class:`.SolovayKitaevDecomposition` algorithm. A custom synthesis +method may be also speficied, but it must be capable of performing approximations using the +Clifford+T basis set. This is the default translation method. diff --git a/qiskit/transpiler/preset_passmanagers/common.py b/qiskit/transpiler/preset_passmanagers/common.py index 548bc87adea4..ee81c815c004 100644 --- a/qiskit/transpiler/preset_passmanagers/common.py +++ b/qiskit/transpiler/preset_passmanagers/common.py @@ -549,7 +549,9 @@ def generate_translation_passmanager( # unitary gates that can be represented as Cliffords by Clifford gates. UnitarySynthesis(method="clifford", plugin_config={"max_qubits": 1}), # We decompose single-qubit unitary gates using the UnitarySynthesisPlugin interface - # (by default it's the Solovay-Kitaev decomposition). + # By default it's the Solovay-Kitaev decomposition. If a custom ``unitary_synthesis_method`` + # method is specified, it must be capable of performing approximations using the + # Clifford+T basis set. UnitarySynthesis( basis_gates=["h", "t", "tdg"], approximation_degree=approximation_degree, @@ -559,7 +561,7 @@ def generate_translation_passmanager( min_qubits=1, target=None, ), - # Finally, we use BasisTranslator to translate ["h", "t", "tdg"] to the actually + # Finally, we use BasisTranslator to translate Clifford+T/Tdg to the actually # specified set of basis gates. BasisTranslator(sel, basis_gates, target), ]