forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Sabre's manual insertion-order iteration and unnecessary sorts
The manual insertion-order tracking was initially added in 02a1939 (Qiskitgh-9012) during a complete rewrite of the scoring algorithms for Sabre to demonstrate that the new algorithm could be made fully RNG compatible. It maintained the identical iteration order to the previous iteration once the front-layer data structure was swapped from being a raw list to hash-based. The new data structure doesn't require the manual tracking to be reproducible as long as the iteration order is independent of the hash seed. This swaps the relevant places over the `IndexMap` to be able to remove a lot of the manual tracking. In casual testing, this didn't appear to have much effect on performance, but the resulting code is much simpler. The sorts (and deliberate canonicalisation of the swaps) was necessary to match RNG compatibility in the pre-relative-score Sabre, but since the swaps are now iterated through in a deterministic order and guaranteed to be generated only once each (the previous version used a hashset to remove duplicates), neither step is necessary. For a QV circuit of depth 5 at 1081 qubits on heavy hex, this is worth almost a 2x speedup in routing performance.
- Loading branch information
1 parent
26d1554
commit 0db3ac3
Showing
3 changed files
with
20 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
features: | ||
- | | ||
Internal tweaks to the routing algorithm in :class:`.SabreSwap`, used in | ||
transpilation of non-dynamic circuits at all non-zero optimization levels, | ||
have sped up routing for very large circuits. As an example, the time to | ||
route a depth-5 :class:`.QuantumVolume` circuit for a 1081-qubit heavy-hex | ||
coupling map is approximately halved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters