-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 support for QuantumCircuit.layout to qpy #10148
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit adds the missing support for QuantumCircuit.layout to the qpy format. This necessitates bumping the QPY format version to 8 to accomodate the extra data needed for representing the details of the layout. The tricky piece with representing the 3 TranspileLayout attributes is representing the virtual bits in the initial layout because there is no guarantee that the input circuit's registers are in the output circuit (typically they are not when transpile() is used). Fixes Qiskit#10112
mtreinish
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: qpy
Related to QPY serialization
labels
May 23, 2023
One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 5489994589
💛 - Coveralls |
mtreinish
changed the title
[WIP] Add support for QuantumCircuit.layout to qpy
Add support for QuantumCircuit.layout to qpy
May 24, 2023
mtreinish
commented
May 26, 2023
jlapeyre
reviewed
Jun 1, 2023
Co-authored-by: John Lapeyre <jlapeyre@users.noreply.github.com>
Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
mtreinish
commented
Jun 6, 2023
jakelishman
previously approved these changes
Jul 7, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One mostly nit-pick comment, but otherwise I'm still happy with the state of this.
#10392 will need updating after this PR merges to fix documentation conflicts only, but that's not a big deal.
jakelishman
approved these changes
Jul 7, 2023
mergify bot
pushed a commit
that referenced
this pull request
Jul 7, 2023
* Add support for QuantumCircuit.layout to qpy This commit adds the missing support for QuantumCircuit.layout to the qpy format. This necessitates bumping the QPY format version to 8 to accomodate the extra data needed for representing the details of the layout. The tricky piece with representing the 3 TranspileLayout attributes is representing the virtual bits in the initial layout because there is no guarantee that the input circuit's registers are in the output circuit (typically they are not when transpile() is used). Fixes #10112 * Fix handling of empty layout * Expand test coverage * Fix lint * Add qpy compat tests * Fix compat tests * Add release notes * Adjust layout creation to be register independent * Finish docs * Only check layout in compat tests with circuits * Fix typos * Fix doc typo in qiskit/qpy/__init__.py Co-authored-by: John Lapeyre <jlapeyre@users.noreply.github.com> * Adjust introduction version for layout qpy compat tests * Unify qpy compat test version filter style * Add new line to layout error message * Simplify serialization logic Co-authored-by: Jake Lishman <jake.lishman@ibm.com> * Doc fixes * Improve test coverage * Don't reuse bits between initial layout and circuit in qpy compat tests. * Update qiskit/qpy/__init__.py * Fix test typo * Use a register in compat tests for consistent equality * Update test/python/qpy/test_circuit_load_from_qpy.py --------- Co-authored-by: John Lapeyre <jlapeyre@users.noreply.github.com> Co-authored-by: Jake Lishman <jake.lishman@ibm.com> (cherry picked from commit dbf1230)
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jul 10, 2023
* Add support for QuantumCircuit.layout to qpy This commit adds the missing support for QuantumCircuit.layout to the qpy format. This necessitates bumping the QPY format version to 8 to accomodate the extra data needed for representing the details of the layout. The tricky piece with representing the 3 TranspileLayout attributes is representing the virtual bits in the initial layout because there is no guarantee that the input circuit's registers are in the output circuit (typically they are not when transpile() is used). Fixes #10112 * Fix handling of empty layout * Expand test coverage * Fix lint * Add qpy compat tests * Fix compat tests * Add release notes * Adjust layout creation to be register independent * Finish docs * Only check layout in compat tests with circuits * Fix typos * Fix doc typo in qiskit/qpy/__init__.py Co-authored-by: John Lapeyre <jlapeyre@users.noreply.github.com> * Adjust introduction version for layout qpy compat tests * Unify qpy compat test version filter style * Add new line to layout error message * Simplify serialization logic Co-authored-by: Jake Lishman <jake.lishman@ibm.com> * Doc fixes * Improve test coverage * Don't reuse bits between initial layout and circuit in qpy compat tests. * Update qiskit/qpy/__init__.py * Fix test typo * Use a register in compat tests for consistent equality * Update test/python/qpy/test_circuit_load_from_qpy.py --------- Co-authored-by: John Lapeyre <jlapeyre@users.noreply.github.com> Co-authored-by: Jake Lishman <jake.lishman@ibm.com> (cherry picked from commit dbf1230) Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
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: qpy
Related to QPY serialization
stable backport potential
The bug might be minimal and/or import enough to be port to stable
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This commit adds the missing support for QuantumCircuit.layout to the qpy format. This necessitates bumping the QPY format version to 8 to accommodate the extra data needed for representing the details of the layout. The tricky piece with representing the 3 TranspileLayout attributes is representing the virtual bits in the initial layout because there is no guarantee that the input circuit's registers are in the output circuit (typically they are not when transpile() is used).
Details and comments
TODO:
Add test coverage for layout with standalone qubits (no associated register)Fixes #10112