Skip to content

Commit

Permalink
Add more default trials to sabre layout
Browse files Browse the repository at this point in the history
Right now sabre layout uses n random trials (as specified by the user or
defaulting to num_cpus) and since Qiskit#12453 one additional trial taking the
qubits of the densest subgraph as a starting point. There are also a
couple of other trivial examples to try which may or may not produce
better results depending on the circuit, a trivial layout and a reverse
trivial layout. In the case of a hardware efficient circuit the trivial
layout will map exactly and would always be picked. When running in a
preset pass manager sabre should never be called in this scenario
because VF2Layout will find the mapping, but the incremental cost of
adding the trial is minimal. Similarly the cost of a reversed trivial
layout (where virtual qubit 0 -> n, 1 -> n - 1, etc.) is trivial and
may in some scenarios produce a better results.
  • Loading branch information
mtreinish committed Oct 23, 2024
1 parent 2284f19 commit f2e4aeb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/accelerate/src/sabre/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ pub fn sabre_layout_and_routing(
&target,
run_in_parallel,
));
starting_layouts.push((0..dag.num_qubits as u32).map(Some).collect());
starting_layouts.push((0..dag.num_qubits as u32).rev().map(Some).collect());
let outer_rng = match seed {
Some(seed) => Pcg64Mcg::seed_from_u64(seed),
None => Pcg64Mcg::from_entropy(),
Expand Down

0 comments on commit f2e4aeb

Please sign in to comment.