@@ -249,6 +249,17 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana
249249 )
250250
251251
252+ class DefaultRoutingPassManager (PassManagerStagePlugin ):
253+ """Plugin class for the "default" routing stage implementation."""
254+
255+ def pass_manager (self , pass_manager_config , optimization_level = None ) -> PassManager :
256+ # The Sabre-based PM is the default implementation currently, but semantically the "default"
257+ # plugin has more scope to change its logic than one called "sabre". In practice, we don't
258+ # run the actually `SabreSwap` logic from this pass most of the time, because we do that
259+ # during default layout; we're looking for the VF2PostLayout stuff mostly.
260+ return SabreSwapPassManager ().pass_manager (pass_manager_config , optimization_level )
261+
262+
252263class BasicSwapPassManager (PassManagerStagePlugin ):
253264 """Plugin class for routing stage with :class:`~.BasicSwap`"""
254265
@@ -804,8 +815,7 @@ def _swap_mapped(property_set):
804815 seed = pass_manager_config .seed_transpiler ,
805816 swap_trials = trial_count ,
806817 layout_trials = trial_count ,
807- skip_routing = pass_manager_config .routing_method is not None
808- and pass_manager_config .routing_method != "sabre" ,
818+ skip_routing = pass_manager_config .routing_method not in (None , "default" , "sabre" ),
809819 )
810820 layout .append (
811821 ConditionalController (
@@ -838,8 +848,7 @@ def _swap_mapped(property_set):
838848 seed = pass_manager_config .seed_transpiler ,
839849 swap_trials = trial_count ,
840850 layout_trials = trial_count ,
841- skip_routing = pass_manager_config .routing_method is not None
842- and pass_manager_config .routing_method != "sabre" ,
851+ skip_routing = pass_manager_config .routing_method not in (None , "default" , "sabre" ),
843852 )
844853 layout .append (
845854 ConditionalController (
@@ -872,8 +881,7 @@ def _swap_mapped(property_set):
872881 seed = pass_manager_config .seed_transpiler ,
873882 swap_trials = trial_count ,
874883 layout_trials = trial_count ,
875- skip_routing = pass_manager_config .routing_method is not None
876- and pass_manager_config .routing_method != "sabre" ,
884+ skip_routing = pass_manager_config .routing_method not in (None , "default" , "sabre" ),
877885 )
878886 layout .append (
879887 ConditionalController (
@@ -974,8 +982,7 @@ def _swap_mapped(property_set):
974982 seed = pass_manager_config .seed_transpiler ,
975983 swap_trials = trial_count ,
976984 layout_trials = trial_count ,
977- skip_routing = pass_manager_config .routing_method is not None
978- and pass_manager_config .routing_method != "sabre" ,
985+ skip_routing = pass_manager_config .routing_method not in (None , "default" , "sabre" ),
979986 )
980987 elif optimization_level == 1 :
981988 trial_count = _get_trial_count (5 )
@@ -986,8 +993,7 @@ def _swap_mapped(property_set):
986993 seed = pass_manager_config .seed_transpiler ,
987994 swap_trials = trial_count ,
988995 layout_trials = trial_count ,
989- skip_routing = pass_manager_config .routing_method is not None
990- and pass_manager_config .routing_method != "sabre" ,
996+ skip_routing = pass_manager_config .routing_method not in (None , "default" , "sabre" ),
991997 )
992998 elif optimization_level == 2 :
993999 trial_count = _get_trial_count (20 )
@@ -998,8 +1004,7 @@ def _swap_mapped(property_set):
9981004 seed = pass_manager_config .seed_transpiler ,
9991005 swap_trials = trial_count ,
10001006 layout_trials = trial_count ,
1001- skip_routing = pass_manager_config .routing_method is not None
1002- and pass_manager_config .routing_method != "sabre" ,
1007+ skip_routing = pass_manager_config .routing_method not in (None , "default" , "sabre" ),
10031008 )
10041009 elif optimization_level == 3 :
10051010 trial_count = _get_trial_count (20 )
@@ -1010,8 +1015,7 @@ def _swap_mapped(property_set):
10101015 seed = pass_manager_config .seed_transpiler ,
10111016 swap_trials = trial_count ,
10121017 layout_trials = trial_count ,
1013- skip_routing = pass_manager_config .routing_method is not None
1014- and pass_manager_config .routing_method != "sabre" ,
1018+ skip_routing = pass_manager_config .routing_method not in (None , "default" , "sabre" ),
10151019 )
10161020 else :
10171021 raise TranspilerError (f"Invalid optimization level: { optimization_level } " )
0 commit comments