-
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.
Browse files
Browse the repository at this point in the history
* Fix SabreSwap with classically conditioned gates The calculation of the expected number of predecessors for a gate to be considered "resolved" in `SabreSwap` was not accounting for wires stemming from classical conditions. The tracking of the _actual_ number of predecessor requirements satisfied did correctly account for this, so in certain circumstances the actual count could jump from "too low" to "too high" without passing through "just right", and the gate would never get added to the circuit. * Use `successors` to calculate required predecessors This unifies the calculation of what is considered a required predecessor by using the same `SabreSwap._successors` function for both aspects of the comparison: counting the required predecessors and counting the actual number of applied predecessors. This simplifies the logic, since now an update in one place is sufficient, and the wires are read directly from the DAG, rather than using assumptions about the nodes. * Fix incorrect import * Fix decremented typo Co-authored-by: Matthew Treinish <mtreinish@kortar.org> Co-authored-by: Matthew Treinish <mtreinish@kortar.org> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 4410a9b) Co-authored-by: Jake Lishman <jake@binhbar.com>
- Loading branch information
1 parent
3149826
commit a094757
Showing
3 changed files
with
53 additions
and
14 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
8 changes: 8 additions & 0 deletions
8
releasenotes/notes/sabreswap-fix-condition-593f36e855f9064c.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,8 @@ | ||
--- | ||
fixes: | ||
- | | ||
The :class:`.SabreSwap` transpiler pass, used in :func:`.transpile` when | ||
``routing_method="sabre"`` is set, will no longer sporadically drop | ||
classically conditioned gates and their successors from circuits during the | ||
routing phase of transpilation. See | ||
`#8040 <https://github.com/Qiskit/qiskit-terra/issues/8040>`__. |
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