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 bugs with VF2Layout pass and Qiskit Aer 0.13 #11585

Merged
merged 7 commits into from
Jun 10, 2024

Conversation

chriseclectic
Copy link
Member

@chriseclectic chriseclectic commented Jan 17, 2024

Summary

Qiskit Aer 0.13 is incompatible with the pass manager generated by generate_preset_pass_manager due to bugs with how VF2Layout pass handles its Target, which does not contain a coupling map or qargs.

Details and comments

This fixes these so that VF2 will only use the target generated coupling map if it is not None, and doesn't error from trying to iterate over target.qargs that are also None in these cases.

@chriseclectic chriseclectic 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 Jan 17, 2024
@chriseclectic chriseclectic requested a review from a team as a code owner January 17, 2024 18:09
@qiskit-bot
Copy link
Collaborator

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

  • @Qiskit/terra-core

@coveralls
Copy link

coveralls commented Jan 17, 2024

Pull Request Test Coverage Report for Build 9426638631

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 5 of 5 (100.0%) changed or added relevant lines in 2 files are covered.
  • 51 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.004%) to 89.581%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 4 92.62%
qiskit/circuit/random/utils.py 5 95.69%
crates/qasm2/src/parse.rs 12 97.15%
qiskit/circuit/quantumcircuit.py 30 95.84%
Totals Coverage Status
Change from base Build 9410059639: -0.004%
Covered Lines: 62446
Relevant Lines: 69709

💛 - Coveralls

Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

I think this is fine as a workaround for this issue. It really is a weird edge case where you're giving it a target which doesn't have any constraints and then specifying with a lower priority argument the constraints to use. But that being said I think is probably safe from an interface perspective and won't have any backwards compatibility implications that I can think of.

The only things that I think are missing here are a unittest or two to cover this case and a release note to document the fix as it is an extension of the API semantics on the pass.

qiskit/transpiler/passes/layout/vf2_layout.py Outdated Show resolved Hide resolved
@mtreinish mtreinish changed the title Fix bugs with V2FLayout pass and Qiskit Aer 0.13 Fix bugs with VF2Layout pass and Qiskit Aer 0.13 Jan 17, 2024
@1ucian0 1ucian0 added the affects extended support This issue (also) affects extended support label May 30, 2024
@1ucian0
Copy link
Member

1ucian0 commented May 30, 2024

This also seems to affect stable/0.46.

@1ucian0
Copy link
Member

1ucian0 commented Jun 4, 2024

@Mergifyio backport stable/0.46 stable/1.1

Copy link
Contributor

mergify bot commented Jun 4, 2024

backport stable/0.46 stable/1.1

✅ Backports have been created

@1ucian0 1ucian0 changed the base branch from main to stable/0.46 June 7, 2024 10:31
@1ucian0 1ucian0 changed the base branch from stable/0.46 to main June 7, 2024 10:31
Copy link
Contributor

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

I think this would be a good fix to include in the upcoming 1.1.1 release. @chriseclectic do you have time to add the required unit tests and release note within the next week/couple of weeks?

@1ucian0
Copy link
Member

1ucian0 commented Jun 7, 2024

I'm adding the test and reno in few minutes done

Copy link
Contributor

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

LGTM, I left a small suggestion for the reno.

releasenotes/notes/fix-vf2-aer-a7306ce07ea81700.yaml Outdated Show resolved Hide resolved
1ucian0 and others added 2 commits June 8, 2024 07:55
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
@1ucian0 1ucian0 added this pull request to the merge queue Jun 10, 2024
Merged via the queue into Qiskit:main with commit 2b847b8 Jun 10, 2024
15 checks passed
mergify bot pushed a commit that referenced this pull request Jun 10, 2024
* Fix bugs with V2FLayout pass and Qiskit Aer 0.13

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

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* test

* Update releasenotes/notes/fix-vf2-aer-a7306ce07ea81700.yaml

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

* long lines

---------

Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
(cherry picked from commit 2b847b8)
mergify bot pushed a commit that referenced this pull request Jun 10, 2024
* Fix bugs with V2FLayout pass and Qiskit Aer 0.13

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

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* test

* Update releasenotes/notes/fix-vf2-aer-a7306ce07ea81700.yaml

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

* long lines

---------

Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
(cherry picked from commit 2b847b8)
github-merge-queue bot pushed a commit that referenced this pull request Jun 10, 2024
* Fix bugs with V2FLayout pass and Qiskit Aer 0.13

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

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* test

* Update releasenotes/notes/fix-vf2-aer-a7306ce07ea81700.yaml

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

* long lines

---------

Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
(cherry picked from commit 2b847b8)

Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>
github-merge-queue bot pushed a commit that referenced this pull request Jun 10, 2024
* Fix bugs with V2FLayout pass and Qiskit Aer 0.13

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

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* test

* Update releasenotes/notes/fix-vf2-aer-a7306ce07ea81700.yaml

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

* long lines

---------

Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
(cherry picked from commit 2b847b8)

Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>
Procatv pushed a commit to Procatv/qiskit-terra-catherines that referenced this pull request Aug 1, 2024
* Fix bugs with V2FLayout pass and Qiskit Aer 0.13

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

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* test

* Update releasenotes/notes/fix-vf2-aer-a7306ce07ea81700.yaml

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

* long lines

---------

Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects extended support This issue (also) affects extended support 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.

6 participants