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

Fix interaction graph vf2 scoring to include 1q component #10084

Merged
merged 2 commits into from
May 8, 2023

Conversation

mtreinish
Copy link
Member

Summary

In #9148 a bug was introduced into the vf2 scoring code. In that PR the vf2 passes were changed to treat standalone qubits as a special case to improve the algorithmic efficiency of the pass. However, that PR broke the scoring algorithm so that it was no longer factoring in the 1q component of the interaction graph when scoring a layout. This meant that when scoring a potential layout only the 2q error rates were been factored into the score and the pass was potentially selecting worse performing qubits. This commit fixes this error and ensures the scoring is looking at all the error rates.

Details and comments

In Qiskit#9148 a bug was introduced into the vf2 scoring code. In that PR the
vf2 passes were changed to treat standalone qubits as a special case to
improve the algorithmic efficiency of the pass. However, that PR
broke the scoring algorithm so that it was no longer factoring in the 1q
component of the interaction graph when scoring a layout. This meant
that when scoring a potential layout only the 2q error rates were been
factored into the score and the pass was potentially selecting worse
performing qubits. This commit fixes this error and ensures the scoring
is looking at all the error rates.
@mtreinish mtreinish added the Changelog: Bugfix Include in the "Fixed" section of the changelog label May 5, 2023
@mtreinish mtreinish added this to the 0.24.1 milestone May 5, 2023
@mtreinish mtreinish requested a review from a team as a code owner May 5, 2023 21:17
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

@mtreinish mtreinish added the stable backport potential The bug might be minimal and/or import enough to be port to stable label May 5, 2023
@coveralls
Copy link

coveralls commented May 5, 2023

Pull Request Test Coverage Report for Build 4915006120

  • 15 of 15 (100.0%) changed or added relevant lines in 2 files are covered.
  • 33 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.04%) to 85.895%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/expr.rs 1 93.76%
crates/accelerate/src/sabre_swap/mod.rs 2 99.53%
crates/qasm2/src/lex.rs 6 90.89%
crates/qasm2/src/parse.rs 24 96.18%
Totals Coverage Status
Change from base Build 4895540988: 0.04%
Covered Lines: 71203
Relevant Lines: 82895

💛 - Coveralls

---
fixes:
- |
Fix a bug in the :class:`~.VF2Layout` and :class:`~.VF2PostLayout` passes
Copy link
Contributor

Choose a reason for hiding this comment

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

We're still doing past tense for these, yeah? Fixed a bug might be more consistent.

qiskit/transpiler/passes/layout/vf2_utils.py Outdated Show resolved Hide resolved
Copy link
Contributor

@kevinhartman kevinhartman left a comment

Choose a reason for hiding this comment

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

LGTM, feel free to delay changes to release note tense until we eventually prep for the next release.

@kevinhartman kevinhartman added this pull request to the merge queue May 8, 2023
Merged via the queue into Qiskit:main with commit 0e44c5e May 8, 2023
mergify bot pushed a commit that referenced this pull request May 8, 2023
* Fix interaction graph vf2 scoring to include 1q component

In #9148 a bug was introduced into the vf2 scoring code. In that PR the
vf2 passes were changed to treat standalone qubits as a special case to
improve the algorithmic efficiency of the pass. However, that PR
broke the scoring algorithm so that it was no longer factoring in the 1q
component of the interaction graph when scoring a layout. This meant
that when scoring a potential layout only the 2q error rates were been
factored into the score and the pass was potentially selecting worse
performing qubits. This commit fixes this error and ensures the scoring
is looking at all the error rates.

* Update qiskit/transpiler/passes/layout/vf2_utils.py

(cherry picked from commit 0e44c5e)
mtreinish added a commit that referenced this pull request May 8, 2023
…10086)

* Fix interaction graph vf2 scoring to include 1q component

In #9148 a bug was introduced into the vf2 scoring code. In that PR the
vf2 passes were changed to treat standalone qubits as a special case to
improve the algorithmic efficiency of the pass. However, that PR
broke the scoring algorithm so that it was no longer factoring in the 1q
component of the interaction graph when scoring a layout. This meant
that when scoring a potential layout only the 2q error rates were been
factored into the score and the pass was potentially selecting worse
performing qubits. This commit fixes this error and ensures the scoring
is looking at all the error rates.

* Update qiskit/transpiler/passes/layout/vf2_utils.py

(cherry picked from commit 0e44c5e)

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
king-p3nguin pushed a commit to king-p3nguin/qiskit-terra that referenced this pull request May 22, 2023
* Fix interaction graph vf2 scoring to include 1q component

In Qiskit#9148 a bug was introduced into the vf2 scoring code. In that PR the
vf2 passes were changed to treat standalone qubits as a special case to
improve the algorithmic efficiency of the pass. However, that PR
broke the scoring algorithm so that it was no longer factoring in the 1q
component of the interaction graph when scoring a layout. This meant
that when scoring a potential layout only the 2q error rates were been
factored into the score and the pass was potentially selecting worse
performing qubits. This commit fixes this error and ensures the scoring
is looking at all the error rates.

* Update qiskit/transpiler/passes/layout/vf2_utils.py
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 stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants