Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase heuristic effort for sabre #10588

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/accelerate/src/sabre_swap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use swap_map::SwapMap;

const BEST_EPSILON: f64 = 1e-10; // Epsilon used in minimum-score calculations.

const EXTENDED_SET_SIZE: usize = 20; // Size of lookahead window.
const EXTENDED_SET_SIZE: usize = 62; // Size of lookahead window.
const DECAY_RATE: f64 = 0.001; // Decay coefficient for penalizing serial swaps.
const DECAY_RESET_INTERVAL: u8 = 5; // How often to reset all decay rates to 1.
const EXTENDED_SET_WEIGHT: f64 = 0.5; // Weight of lookahead window compared to front_layer.
Expand Down
6 changes: 3 additions & 3 deletions qiskit/transpiler/preset_passmanagers/level1.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ def _vf2_match_not_found(property_set):
elif layout_method == "sabre":
_improve_layout = SabreLayout(
coupling_map_layout,
max_iterations=2,
max_iterations=4,
seed=seed_transpiler,
swap_trials=5,
layout_trials=5,
swap_trials=10,
layout_trials=10,
skip_routing=pass_manager_config.routing_method is not None
and routing_method != "sabre",
)
Expand Down
6 changes: 3 additions & 3 deletions qiskit/transpiler/preset_passmanagers/level2.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ def _vf2_match_not_found(property_set):
elif layout_method == "sabre":
_choose_layout_1 = SabreLayout(
coupling_map_layout,
max_iterations=2,
max_iterations=4,
seed=seed_transpiler,
swap_trials=10,
layout_trials=10,
swap_trials=20,
layout_trials=20,
skip_routing=pass_manager_config.routing_method is not None
and routing_method != "sabre",
)
Expand Down
6 changes: 3 additions & 3 deletions qiskit/transpiler/preset_passmanagers/level3.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ def _vf2_match_not_found(property_set):
elif layout_method == "sabre":
_choose_layout_1 = SabreLayout(
coupling_map_layout,
max_iterations=4,
max_iterations=10,
seed=seed_transpiler,
swap_trials=20,
layout_trials=20,
swap_trials=40,
layout_trials=40,
skip_routing=pass_manager_config.routing_method is not None
and routing_method != "sabre",
)
Expand Down
2 changes: 1 addition & 1 deletion test/python/transpiler/test_sabre_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def test_layout_with_classical_bits(self):
self.assertIsInstance(res, QuantumCircuit)
layout = res._layout.initial_layout
self.assertEqual(
[layout[q] for q in qc.qubits], [13, 10, 11, 12, 17, 14, 22, 26, 5, 16, 25, 19, 7, 8]
[layout[q] for q in qc.qubits], [8, 12, 14, 13, 7, 5, 22, 21, 18, 16, 23, 19, 11, 3]
)

# pylint: disable=line-too-long
Expand Down