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

Fixed bug in OptimizeSwapBeforeMeasure #11413

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

border-b
Copy link
Contributor

Summary

Fixed an issue with the :class:~.OptimizeSwapBeforeMeasure pass where it would incorrectly optimize circuits involving swap and measure instructions. This commit fixes the bug by changingDAGCircuit.successorstoDAGCircuit.descendants. Also, added a couple of extra tests to ensure that the bug is fixed.

Details and comments

The original issue in #11195 could not be reproduced after the fix as it produced a ValueError.

@border-b border-b requested a review from a team as a code owner December 14, 2023 11:09
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Dec 14, 2023
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

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

  • @Qiskit/terra-core

@border-b border-b marked this pull request as draft December 14, 2023 11:16
@border-b border-b marked this pull request as ready for review December 14, 2023 11:20
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

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

  • @Qiskit/terra-core

@coveralls
Copy link

Pull Request Test Coverage Report for Build 7208145798

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 11 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.002%) to 87.536%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 5 91.41%
crates/qasm2/src/parse.rs 6 96.67%
Totals Coverage Status
Change from base Build 7203025354: -0.002%
Covered Lines: 59761
Relevant Lines: 68270

💛 - Coveralls

@jakelishman jakelishman added stable backport potential The bug might be minimal and/or import enough to be port to stable Changelog: Bugfix Include in the "Fixed" section of the changelog mod: transpiler Issues and PRs related to Transpiler labels Dec 14, 2023
@jakelishman jakelishman added this to the 0.45.2 milestone Dec 14, 2023
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

This is excellent, thank you very much! Great, clear tests.

@jakelishman jakelishman added this pull request to the merge queue Dec 14, 2023
Merged via the queue into Qiskit:main with commit 3551c7c Dec 14, 2023
13 checks passed
mergify bot pushed a commit that referenced this pull request Dec 14, 2023
* fixed bug in OptimizeSwapBeforeMeasure #11195

* fix lint issue

(cherry picked from commit 3551c7c)
github-merge-queue bot pushed a commit that referenced this pull request Dec 14, 2023
* fixed bug in OptimizeSwapBeforeMeasure #11195

* fix lint issue

(cherry picked from commit 3551c7c)

Co-authored-by: Seemanta Bhattacharjee <[email protected]>
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 Community PR PRs from contributors that are not 'members' of the Qiskit repo mod: transpiler Issues and PRs related to Transpiler stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants