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.
Make all Layout and Routing passes target aware (Qiskit#9263)
* Make all Layout and Routing passes target aware This commit updates all the layout and routing passes which leverage hardware constraints to have a new optional keyword argument, target, to specify a Target object for modelling the constraints of the target backend. This option will superscede any other specified arguments for backend constraints. For most of these passes the target argument is just internally leveraged to build a CouplingMap (and in 2 cases a BackendProperties) as most of the algorithms don't need more than the global connectivity graph and there is minimal overhead to convert from a target to a CouplingMap. The 2 passes which take backend properties should be refactored to work natively with the target because the conversion adds extra overhead which isn't needed, but in those cases the passes aren't enabled by default (or are slated to be moved out of tree as a plugin, see Qiskit#8662) so the extra overhead isn't of particular concern. This is part of the first step towards making all backend constraints for the transpiler used the Target internally (see Qiskit#9256). Once all passes that take hardware constraints parameters as an input are updated to have a target we can start internally using the Target only for all preset pass manager construction and start the long process of deprecating the legacy interface in these passes. Related to Qiskit#9256 * Update pass manager drawer reference dot files The pass manager drawer tests were comparing the dot output for statically built pass managers to test that the output visualization is generated correctly. However, the new arguments for the taget are changing the visualization (to show the new option) and caused these tests to fail. This commit updates the reference images to include the new argument. * Fix lint * Optimize CheckMap This commit optimizes the logic of the CheckMap pass. Previously we were unecessarily creating a distance matrix from the coupling graph, and with a target unecessarily creating a CouplingMap object. Instead of doing this instead the pass now creates a list of bidirectional edges for adjacent nodes in the coupling graph and then a set lookup is done for each check instead of checking for a distance of 1 in the distance matrix. * Fix test failures * Update qiskit/transpiler/passes/layout/full_ancilla_allocation.py * Add test coverage for passes not run in preset pass managers * Fix lint * Fix reference dot for new preset pass managers * Rework arguments to take CouplingMap or Target This commit updates the pass constructors to use a single positional argument for both the coupling map or a target. This replaces the previous behavior where a new keyword argument was added to pass in the target. The exception to this is passes where the target was used differently than the coupling map for extra functionality. * Expand test coverage * Small typo fixes from review * Fix lint and test failure * Update qiskit/transpiler/preset_passmanagers/level0.py Co-authored-by: Ali Javadi-Abhari <[email protected]> * Update logic to favor target in all optimization levels In an earlier commit we updated the logic in optimization level 0 to favor target instead of a coupling map. But, that ignored the other optimization levels. This commit corrects this oversight and adds the same logically change to all the preset pass managers. * Update release note for api changes in earlier iterations * Update docstrings * Use a single positional argument for embed pm function --------- Co-authored-by: Ali Javadi-Abhari <[email protected]>
- Loading branch information
1 parent
502590a
commit 84f7201
Showing
34 changed files
with
660 additions
and
125 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
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
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
Oops, something went wrong.