Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LookaheadSwap condition to prevent hangs #4112

Merged
merged 4 commits into from
Apr 9, 2020

Conversation

kdk
Copy link
Member

@kdk kdk commented Apr 8, 2020

Summary

Resolves #2171 by adding a check that a candidate swap is able to either map at least one gate or improve the score of the resulting layout before it is considered. A follow up PR is needed to generalize this approach. (Ideally, this should be incorporated into _score_step, and we should make sure this does not limit our ability to find a long-range improvement that requires first passing through short-term loss).

Additionally, adds some debug level logging and removes duplicate edges for symmetric 2q gates from the list of available swaps.

Details and comments

@kdk kdk added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Apr 8, 2020
@kdk kdk added this to the 0.13 milestone Apr 8, 2020
@ajavadia
Copy link
Member

ajavadia commented Apr 8, 2020

so cases that previously hung now raise error, or they actually move forward?

@kdk
Copy link
Member Author

kdk commented Apr 8, 2020

The example in the issue now completes (its in the added test).

Copy link
Member

@ajavadia ajavadia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mergify mergify bot merged commit 7d0ba7c into Qiskit:master Apr 9, 2020
faisaldebouni pushed a commit to faisaldebouni/qiskit-terra that referenced this pull request Aug 5, 2020
* Add LookaheadSwap logging, document step['swaps_added'].

* Ensure candidate swap improves at least one metric.

* Remove redundant edge counting for symmetric 2q gates.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LookaheadSwap mapper hangs in some cases
2 participants