-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid routing 2q barriers in SabreSwap (#11295)
* Avoid routing 2q barriers in SabreSwap This commit fixes an oversight in the sabre swap pass where a 2 qubit barrier would have been treated like a 2 qubit gate and swaps could potentially be inserted if the sabre algorithm thought it didn't have connectivity for the qargs to the barrier. However as barrier is just a compiler directive it is valid on all qubit pairs so this swap insertion was unnecessary, it was still valid but just not an optimal output. This commit fixes it by adding context to the sabre dag around whether a given node is a directive (and valid on all qubits) or not. * Update rust tests too * Skip directives in extended set generation too Co-authored-by: Kevin Hartman <[email protected]> * Add release note * Update test layout in test_layout_many_search_trials This commit updates a layout in the: `TestSabreLayout.test_layout_many_search_trials` test case which was recently changed in #10323. The change in test ouput caused by #10323 is what triggered the investigation into this bugfix and now that barriers are being treated correctly by sabre the layout doesn't change in the test case anymore and this is reverting the test assertion to use the original layout before #10323 was merged. --------- Co-authored-by: Kevin Hartman <[email protected]>
- Loading branch information
1 parent
33362cc
commit 920fa57
Showing
6 changed files
with
91 additions
and
39 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
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
9 changes: 9 additions & 0 deletions
9
releasenotes/notes/sabre-no-route-barrier-bc82fecb65d3ab9a.yaml
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,9 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixed an issue in the :class:`.SabreSwap` and :class:`.SabreLayout` | ||
transpiler passes where it would incorrectly treat 2 qubit | ||
:class:`.Barrier` instructions as an instruction that needs to be | ||
routed according the transpiler :class:`.Target`. When this occured the | ||
output was still correct but would potentially include unecessary | ||
:class:`.SwapGate` instructions. |
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