-
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
…10493) * Fix final_layout when VF2PostLayout finds a better layout This commit fixes a bug in the preset pass managers when VF2PostLayout is run and finds a better layout to use. In these cases the ApplyLayout was updating the layout but we never updated the final layout to reflect these changes. This would result in an incorrect final layout because the input positions of the qubits were incorrect after re-applying the layout. This commit fixes this by adding code to ApplyLayout to also update final_layout, if one is set, to reflect the new initial layout found by VF2PostLayout. Fixes #10457 * Remove stray debug print * Use a list instead of a dict * Add assertion on vf2postlayout being used in compiler.transpile tests * Actually assert a post layout is set (cherry picked from commit 42a0ee8) Co-authored-by: Matthew Treinish <[email protected]>
- Loading branch information
1 parent
f08636d
commit 04c8108
Showing
4 changed files
with
117 additions
and
2 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
15 changes: 15 additions & 0 deletions
15
releasenotes/notes/fix-final-layout-in-apply-layout-dfbdbde593cf7929.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,15 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixed an issue with the :func:`~.transpile` function and all the preset | ||
pass managers generated via :func:`~.generate_preset_pass_manager` where | ||
the output :class:`~.QuantumCircuit` object's :attr:`~.QuantumCircuit.layout` | ||
attribute would have an invalid :attr:`.TranspileLayout.final_layout` | ||
attribute. This would occur in scenarios when the :class:`~.VF2PostLayout` | ||
pass would run and find an alternative initial layout that has lower | ||
reported error rates. When altering the initial layout the | ||
:attr:`~.TranspileLayout.final_layout` attribute was never updated to | ||
reflect this change. This has been corrected so that the ``final_layout`` | ||
is always correctly reflecting the output permutation caused by the routing | ||
stage. | ||
Fixed `#10457 <https://github.com/Qiskit/qiskit-terra/issues/10457>`__ |
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