-
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.
Filter/ignore qubits in Target without any operations (#9927)
* Filter/ignore qubits in Target without any operations Building off #9840 which adds full path support in all the preset pass managers for targetting backends with a disconnected coupling graph, this commit adds support for ignoring qubits that do not support any operations. When a Target is generated from #9911 with `filter_faulty` set to `True` this will potentially result in qubits being present in the `Target` without any supported operations. In these cases the layout passes in the transpiler might inadvertently use these qubits only to fail in the basis translator because there are no instructions available. This commit adds filtering of connected components from the list of output connected components if the `Target` does have any supported instructions on a qubit. This works by building a copy of the coupling map's internal graph that removes the nodes which do not have any supported operations. Then when we compute the connected components of this graph it will exclude any components of isolated qubits without any operations supported. A similar change is made to the coupling graph we pass to rustworkx.vf2_mapping() inside the vf2 layout family of passes. * Expand testing * Make filtered qubit coupling map a Target.build_coupling_map option This commit reworks the logic to construct a filtered coupling map as an optional argument on `Target.build_coupling_map()`. This makes the filtering a function of the Target object itself, which is where the context/data about which qubits support operations or not lives. The previous versions of this PR had a weird mix of responsibilities where the target would generate a coupling map and then we'd pass the target to that coupling map to do an additional round of filtering on it. * Apply suggestions from code review Co-authored-by: John Lapeyre <jlapeyre@users.noreply.github.com> * Fix incorrect set construction * Expand docstring on build_coupling_map argument * Rework logic in vf2 passes for filtering * Update argument name in disjoint_utils.py * Inline second argument for require_layout_isolated_to_component Co-authored-by: Kevin Hartman <kevin@hart.mn> * Update qiskit/transpiler/passes/layout/vf2_post_layout.py Co-authored-by: Kevin Hartman <kevin@hart.mn> * Apply suggestions from code review Co-authored-by: Kevin Hartman <kevin@hart.mn> * Remove unnecessary len() * Inline second arg for dense_layout too --------- Co-authored-by: John Lapeyre <jlapeyre@users.noreply.github.com> Co-authored-by: Kevin Hartman <kevin@hart.mn>
- Loading branch information
1 parent
3c393ad
commit e18e4d2
Showing
14 changed files
with
185 additions
and
15 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
6 changes: 6 additions & 0 deletions
6
releasenotes/notes/filter-idle-qubits-cmap-74ac7711fc7476f3.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,6 @@ | ||
--- | ||
features: | ||
- | | ||
The :meth:`~.Target.build_coupling_map` method has a new keyword argument, | ||
``filter_idle_qubits`` which when set to ``True`` will remove any qubits | ||
from the output :class:`~.CouplingMap` that don't support any operations. |
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