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 CheckMap with control-flow builder nested conditionals #10395

Merged

Conversation

jakelishman
Copy link
Member

@jakelishman jakelishman commented Jul 6, 2023

Summary

The recursion inside the CheckMap pass was based on a custom DAGCircuit.compose solution, rather than the more standard qubit-argument-binding setup we normally use. This did not pass in the clbit ordering to the composition, which could cause it to fail to map nested conditional statements.

Instead, we can just enter each DAG naturally, and use the regular wire map to access the physical indices being referred to.

Details and comments

Fix #10394.

The recursion inside the `CheckMap` pass was based on a custom
`DAGCircuit.compose` solution, rather than the more standard
qubit-argument-binding setup we normally use.  This did not pass in the
clbit ordering to the composition, which could cause it to fail to map
nested conditional statements.

Instead, we can just enter each DAG naturally, and use the regular wire
map to access the physical indices being referred to.
@jakelishman jakelishman added Changelog: Bugfix Include in the "Fixed" section of the changelog mod: transpiler Issues and PRs related to Transpiler labels Jul 6, 2023
@jakelishman jakelishman added this to the 0.25.0 milestone Jul 6, 2023
@jakelishman jakelishman requested a review from a team as a code owner July 6, 2023 13:04
@qiskit-bot
Copy link
Collaborator

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 5475798121

  • 13 of 13 (100.0%) changed or added relevant lines in 1 file are covered.
  • 10 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.006%) to 85.975%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 4 90.89%
crates/qasm2/src/parse.rs 6 97.58%
Totals Coverage Status
Change from base Build 5465425279: -0.006%
Covered Lines: 71546
Relevant Lines: 83217

💛 - Coveralls

@mtreinish mtreinish modified the milestones: 0.25.0, 0.24.2 Jul 6, 2023
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.

@kevinhartman kevinhartman added this pull request to the merge queue Jul 6, 2023
@jakelishman jakelishman added the stable backport potential The bug might be minimal and/or import enough to be port to stable label Jul 6, 2023
Merged via the queue into Qiskit:main with commit 163875e Jul 6, 2023
mergify bot pushed a commit that referenced this pull request Jul 6, 2023
The recursion inside the `CheckMap` pass was based on a custom
`DAGCircuit.compose` solution, rather than the more standard
qubit-argument-binding setup we normally use.  This did not pass in the
clbit ordering to the composition, which could cause it to fail to map
nested conditional statements.

Instead, we can just enter each DAG naturally, and use the regular wire
map to access the physical indices being referred to.

(cherry picked from commit 163875e)
github-merge-queue bot pushed a commit that referenced this pull request Jul 6, 2023
…#10397)

The recursion inside the `CheckMap` pass was based on a custom
`DAGCircuit.compose` solution, rather than the more standard
qubit-argument-binding setup we normally use.  This did not pass in the
clbit ordering to the composition, which could cause it to fail to map
nested conditional statements.

Instead, we can just enter each DAG naturally, and use the regular wire
map to access the physical indices being referred to.

(cherry picked from commit 163875e)

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
@jakelishman jakelishman deleted the fix-checkmap-nested-conditional branch July 6, 2023 21:40
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 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
None yet
Development

Successfully merging this pull request may close these issues.

CheckMap can raise exceptions with nested classical conditions
5 participants