From ce56f7e7441980734a0db56535096a39b9edc2e1 Mon Sep 17 00:00:00 2001 From: Luciano Bello Date: Tue, 23 Jul 2024 17:20:00 +0200 Subject: [PATCH 1/3] change the default routing_method to sabre --- qiskit/transpiler/preset_passmanagers/level0.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit/transpiler/preset_passmanagers/level0.py b/qiskit/transpiler/preset_passmanagers/level0.py index 7289a8635c55..58381b3db7a8 100644 --- a/qiskit/transpiler/preset_passmanagers/level0.py +++ b/qiskit/transpiler/preset_passmanagers/level0.py @@ -48,7 +48,7 @@ def level_0_pass_manager(pass_manager_config: PassManagerConfig) -> StagedPassMa initial_layout = pass_manager_config.initial_layout init_method = pass_manager_config.init_method or "default" layout_method = pass_manager_config.layout_method or "default" - routing_method = pass_manager_config.routing_method or "stochastic" + routing_method = pass_manager_config.routing_method or "sabre" translation_method = pass_manager_config.translation_method or "translator" optimization_method = pass_manager_config.optimization_method or "default" scheduling_method = pass_manager_config.scheduling_method or "default" From ea89958665d7a7ae1d61c39d07ebca6a027b8aad Mon Sep 17 00:00:00 2001 From: Luciano Bello Date: Tue, 23 Jul 2024 17:26:33 +0200 Subject: [PATCH 2/3] reno --- releasenotes/notes/sabre_level0-1524f01965257f3f.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 releasenotes/notes/sabre_level0-1524f01965257f3f.yaml diff --git a/releasenotes/notes/sabre_level0-1524f01965257f3f.yaml b/releasenotes/notes/sabre_level0-1524f01965257f3f.yaml new file mode 100644 index 000000000000..77f238bf1ecb --- /dev/null +++ b/releasenotes/notes/sabre_level0-1524f01965257f3f.yaml @@ -0,0 +1,5 @@ +--- +features_transpiler: + - | + The default `routing_method` for optimization level 0 was changed from ``stochastic`` to ``sabre``. + The pass :class:`.SabreSwap` fully supersedes :class:`.StochasticSwap` and the latter will be deprecated in a future release. From b6c92f2be5d9bc20eca10726b0b533151166ff5a Mon Sep 17 00:00:00 2001 From: Luciano Bello Date: Thu, 25 Jul 2024 14:44:36 +0200 Subject: [PATCH 3/3] Update releasenotes/notes/sabre_level0-1524f01965257f3f.yaml Co-authored-by: Matthew Treinish --- .../notes/sabre_level0-1524f01965257f3f.yaml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/releasenotes/notes/sabre_level0-1524f01965257f3f.yaml b/releasenotes/notes/sabre_level0-1524f01965257f3f.yaml index 77f238bf1ecb..c24775d6d096 100644 --- a/releasenotes/notes/sabre_level0-1524f01965257f3f.yaml +++ b/releasenotes/notes/sabre_level0-1524f01965257f3f.yaml @@ -1,5 +1,13 @@ --- -features_transpiler: +upgrade_transpiler: - | - The default `routing_method` for optimization level 0 was changed from ``stochastic`` to ``sabre``. - The pass :class:`.SabreSwap` fully supersedes :class:`.StochasticSwap` and the latter will be deprecated in a future release. + The default routing pass used by optimization level 0 for :func:`.generate_preset_pass_manager` + and :func:`.transpile` has been changed from :class:`.StochasticSwap` to :class:`.SabreSwap`. + The :class:`.SabreSwap` pass performs exactly the same function but performs better in both + runtime and output quality (in number of swap gates and depth) compared to + :class:`.StochasticSwap`. For ``optimization_level=0`` this shouldn't matter because it's not + expected to run routing for the typical use case of level 0. + + If you were relying on the previous default routing algorithm for any reason you can use the + ``routing_method`` argument for :func:`.transpile` and :func:`.generate_preset_pass_manager` + to ``"stochastic"`` to use the :class:`.StochasticSwap` pass.