-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 (…
…#9560) * Remove Sabre's manual insertion-order iteration and unnecessary sorts The manual insertion-order tracking was initially added in 02a1939 (gh-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. * Fix RNG-related tests * Add RNG-change note
- Loading branch information
1 parent
1fb00e6
commit e016f9c
Showing
5 changed files
with
39 additions
and
120 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,15 @@ | ||
--- | ||
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. | ||
upgrade: | ||
- | | ||
The result of transpilations for fixed seeds may have changed compared to | ||
previous versions of Qiskit Terra. This is because of internal tweaks to | ||
the routing algorithm used by :class:`.SabreSwap` and :class:`.SabreLayout`, | ||
which are the default routing and layout passes respectively, to make them | ||
significantly faster for large circuits. |
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
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