-
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.
Make internal Layout and CouplingMap attrs slotted and adjust passes …
…for fast access (#7036) * Make internal layout and coupling map attributes public and slotted This commit updates the layout and coupling map classes to tune them for performance when used by transpiler passes. Right now the user facing api is doing a bunch of extra validation to provide helpful user messages and the internal data structures of both classes are hidden behind this api. This can add a bunch of overhead to transpiler passes (specifically routing passes) that are using these APIs in a loop. To address this commit changes these internal properties to public attributes and adds slots to the classes to speed up direct attribute access. This will enable us to tune transpiler passes to access these attributes more easily and faster. The follow on step here is to update any transpiler passes using the user facing api to access the attributes directly. Fixes #7035 * Update pass access patterns for performance * Move connectivity check inside distance matrix rebuild condition * Adjust array access pattern to avoid temporary object contruction * Make attributes private again * Update sabre layout virtual bit usage * Apply suggestions from code review Co-authored-by: Kevin Krsulich <[email protected]> * Get mapping from layout once outside of loop This commit updates the layout usage in ApplyLayout and Layout2QDistance to access the internal map once and store that in a local variable which is then accessed from the loop using the layout. Co-authored-by: Kevin Krsulich <[email protected]> * Update qiskit/transpiler/passes/layout/sabre_layout.py Co-authored-by: Jake Lishman <[email protected]> * Locally cache objects in compute_cost * Adjust access in full ancilla and layout2q passes to avoid private access * Adjust gate_direction to limit private access * Add comments about private access to Checkmap * Update qiskit/transpiler/passes/layout/layout_2q_distance.py Co-authored-by: Kevin Krsulich <[email protected]> * Updates to sabre passes * Remove unecessary private access from stochastic swap * Add comment on private access to stochastic swap * Adjust distance matrix access Co-authored-by: Kevin Krsulich <[email protected]> Co-authored-by: Jake Lishman <[email protected]>
- Loading branch information
1 parent
7a13cc8
commit 1567e4e
Showing
12 changed files
with
67 additions
and
38 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
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