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 initial_layout in transpile with loose qubits #10153

Merged
merged 1 commit into from
May 24, 2023

Conversation

jakelishman
Copy link
Member

Summary

The previous logic around building a Layout object from an initial_layout was still couched in the "registers own bits" model, so could not cope with loose bits. It's most convenient to just build the mapping ourselves during the parsing, since the logic is quite specific to the form of the initial_layout argument, rather than being something that's inherently tied to the Layout class.

Details and comments

Fix #10125.

The previous logic around building a `Layout` object from an
`initial_layout` was still couched in the "registers own bits" model, so
could not cope with loose bits.  It's most convenient to just build the
mapping ourselves during the parsing, since the logic is quite specific
to the form of the `initial_layout` argument, rather than being
something that's inherently tied to the `Layout` class.
@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 labels May 24, 2023
@jakelishman jakelishman requested a review from a team as a code owner May 24, 2023 13:34
@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 5069356780

  • 11 of 13 (84.62%) changed or added relevant lines in 1 file are covered.
  • 22 unchanged lines in 5 files lost coverage.
  • Overall coverage decreased (-0.04%) to 85.914%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/compiler/transpiler.py 11 13 84.62%
Files with Coverage Reduction New Missed Lines %
qiskit/transpiler/layout.py 1 94.08%
qiskit/transpiler/passes/synthesis/unitary_synthesis.py 1 90.27%
crates/qasm2/src/lex.rs 3 91.39%
qiskit/converters/init.py 5 73.08%
crates/qasm2/src/parse.rs 12 96.65%
Totals Coverage Status
Change from base Build 5069314831: -0.04%
Covered Lines: 71183
Relevant Lines: 82854

💛 - Coveralls

@jakelishman jakelishman added this pull request to the merge queue May 24, 2023
Merged via the queue into Qiskit:main with commit 716b648 May 24, 2023
mergify bot pushed a commit that referenced this pull request May 24, 2023
The previous logic around building a `Layout` object from an
`initial_layout` was still couched in the "registers own bits" model, so
could not cope with loose bits.  It's most convenient to just build the
mapping ourselves during the parsing, since the logic is quite specific
to the form of the `initial_layout` argument, rather than being
something that's inherently tied to the `Layout` class.

(cherry picked from commit 716b648)
mtreinish pushed a commit that referenced this pull request May 24, 2023
The previous logic around building a `Layout` object from an
`initial_layout` was still couched in the "registers own bits" model, so
could not cope with loose bits.  It's most convenient to just build the
mapping ourselves during the parsing, since the logic is quite specific
to the form of the `initial_layout` argument, rather than being
something that's inherently tied to the `Layout` class.

(cherry picked from commit 716b648)

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
@jakelishman jakelishman deleted the fix-transpile-loose-qubits branch May 24, 2023 23:04
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.

transpile fails to count circuit qubits, resulting in LayoutError
5 participants