diff --git a/qiskit/transpiler/preset_passmanagers/builtin_plugins.py b/qiskit/transpiler/preset_passmanagers/builtin_plugins.py index 85b0c05d5cae..1e5ca4519864 100644 --- a/qiskit/transpiler/preset_passmanagers/builtin_plugins.py +++ b/qiskit/transpiler/preset_passmanagers/builtin_plugins.py @@ -238,7 +238,6 @@ class BasicSwapPassManager(PassManagerStagePlugin): def pass_manager(self, pass_manager_config, optimization_level=None) -> PassManager: """Build routing stage PassManager.""" - seed_transpiler = pass_manager_config.seed_transpiler target = pass_manager_config.target coupling_map = pass_manager_config.coupling_map backend_properties = pass_manager_config.backend_properties @@ -257,7 +256,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana routing_pass, target, coupling_map=coupling_map, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, use_barrier_before_measurement=True, ) if optimization_level == 1: @@ -268,7 +267,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana vf2_call_limit=vf2_call_limit, vf2_max_trials=vf2_max_trials, backend_properties=backend_properties, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, check_trivial=True, use_barrier_before_measurement=True, ) @@ -280,7 +279,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana vf2_call_limit=vf2_call_limit, vf2_max_trials=vf2_max_trials, backend_properties=backend_properties, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, use_barrier_before_measurement=True, ) if optimization_level == 3: @@ -291,7 +290,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana vf2_call_limit=vf2_call_limit, vf2_max_trials=vf2_max_trials, backend_properties=backend_properties, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, use_barrier_before_measurement=True, ) raise TranspilerError(f"Invalid optimization level specified: {optimization_level}") @@ -324,7 +323,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana routing_pass, target, coupling_map=coupling_map, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, use_barrier_before_measurement=True, ) if optimization_level == 1: @@ -335,7 +334,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana vf2_call_limit=vf2_call_limit, vf2_max_trials=vf2_max_trials, backend_properties=backend_properties, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, check_trivial=True, use_barrier_before_measurement=True, ) @@ -347,7 +346,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana vf2_call_limit=vf2_call_limit, vf2_max_trials=vf2_max_trials, backend_properties=backend_properties, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, use_barrier_before_measurement=True, ) raise TranspilerError(f"Invalid optimization level specified: {optimization_level}") @@ -358,7 +357,6 @@ class LookaheadSwapPassManager(PassManagerStagePlugin): def pass_manager(self, pass_manager_config, optimization_level=None) -> PassManager: """Build routing stage PassManager.""" - seed_transpiler = pass_manager_config.seed_transpiler target = pass_manager_config.target coupling_map = pass_manager_config.coupling_map coupling_map_routing = target @@ -376,7 +374,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana routing_pass, target, coupling_map=coupling_map, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, use_barrier_before_measurement=True, ) if optimization_level == 1: @@ -388,7 +386,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana vf2_call_limit=vf2_call_limit, vf2_max_trials=vf2_max_trials, backend_properties=backend_properties, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, check_trivial=True, use_barrier_before_measurement=True, ) @@ -401,7 +399,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana vf2_call_limit=vf2_call_limit, vf2_max_trials=vf2_max_trials, backend_properties=backend_properties, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, use_barrier_before_measurement=True, ) if optimization_level == 3: @@ -413,7 +411,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana vf2_call_limit=vf2_call_limit, vf2_max_trials=vf2_max_trials, backend_properties=backend_properties, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, use_barrier_before_measurement=True, ) raise TranspilerError(f"Invalid optimization level specified: {optimization_level}") @@ -448,7 +446,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana routing_pass, target, coupling_map=coupling_map, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, use_barrier_before_measurement=True, ) if optimization_level == 1: @@ -466,7 +464,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana vf2_call_limit=vf2_call_limit, vf2_max_trials=vf2_max_trials, backend_properties=backend_properties, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, check_trivial=True, use_barrier_before_measurement=True, ) @@ -486,7 +484,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana vf2_call_limit=vf2_call_limit, vf2_max_trials=vf2_max_trials, backend_properties=backend_properties, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, use_barrier_before_measurement=True, ) if optimization_level == 3: @@ -504,7 +502,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana vf2_call_limit=vf2_call_limit, vf2_max_trials=vf2_max_trials, backend_properties=backend_properties, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, use_barrier_before_measurement=True, ) raise TranspilerError(f"Invalid optimization level specified: {optimization_level}") @@ -515,7 +513,6 @@ class NoneRoutingPassManager(PassManagerStagePlugin): def pass_manager(self, pass_manager_config, optimization_level=None) -> PassManager: """Build routing stage PassManager.""" - seed_transpiler = pass_manager_config.seed_transpiler target = pass_manager_config.target coupling_map = pass_manager_config.coupling_map routing_pass = Error( @@ -527,7 +524,7 @@ def pass_manager(self, pass_manager_config, optimization_level=None) -> PassMana routing_pass, target, coupling_map=coupling_map, - seed_transpiler=seed_transpiler, + seed_transpiler=-1, use_barrier_before_measurement=True, ) @@ -793,7 +790,7 @@ def _swap_mapped(property_set): ) choose_layout_1 = VF2Layout( coupling_map=pass_manager_config.coupling_map, - seed=pass_manager_config.seed_transpiler, + seed=-1, call_limit=int(5e4), # Set call limit to ~100ms with rustworkx 0.10.2 properties=pass_manager_config.backend_properties, target=pass_manager_config.target, @@ -826,7 +823,7 @@ def _swap_mapped(property_set): elif optimization_level == 2: choose_layout_0 = VF2Layout( coupling_map=pass_manager_config.coupling_map, - seed=pass_manager_config.seed_transpiler, + seed=-1, call_limit=int(5e6), # Set call limit to ~10s with rustworkx 0.10.2 properties=pass_manager_config.backend_properties, target=pass_manager_config.target, @@ -861,7 +858,7 @@ def _swap_mapped(property_set): elif optimization_level == 3: choose_layout_0 = VF2Layout( coupling_map=pass_manager_config.coupling_map, - seed=pass_manager_config.seed_transpiler, + seed=-1, call_limit=int(3e7), # Set call limit to ~60s with rustworkx 0.10.2 properties=pass_manager_config.backend_properties, target=pass_manager_config.target, diff --git a/test/python/primitives/test_backend_estimator.py b/test/python/primitives/test_backend_estimator.py index 62845461dacf..49d5efa2d782 100644 --- a/test/python/primitives/test_backend_estimator.py +++ b/test/python/primitives/test_backend_estimator.py @@ -440,7 +440,7 @@ def test_layout(self, backend): estimator.set_transpile_options(seed_transpiler=15, optimization_level=1) value = estimator.run(qc, op, shots=10000).result().values[0] if optionals.HAS_AER: - ref_value = -0.9954 if isinstance(backend, GenericBackendV2) else -0.916 + ref_value = -0.9954 if isinstance(backend, GenericBackendV2) else -0.934 else: ref_value = -1 self.assertEqual(value, ref_value)