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 handling of global ideal gates for target build_coupling_map() #8977

Merged
merged 3 commits into from
Oct 31, 2022

Conversation

mtreinish
Copy link
Member

Summary

This commit fixes the handling of the build_coupling_map() method so that it correctly handles edge cases around a mix of ideal globally available gates and gates that have qubit/connectivity constraints. Previously, the method would incorrectly treat the presence of a globally defined ideal gate as meaning there were no connectivity constraints, even if that global gate was only on 1 qubit. While if the gate operates on two qubits this is correct behavior.

Details and comments

Fixes #8971

This commit fixes the handling of the `build_coupling_map()` method so
that it correctly handles edge cases around a mix of ideal globally
available gates and gates that have qubit/connectivity constraints.
Previously, the method would incorrectly treat the presence of a
globally defined ideal gate as meaning there were no connectivity
constraints, even if that global gate was only on 1 qubit. While if the
gate operates on two qubits this is correct behavior.

Fixes Qiskit#8971
@mtreinish 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 labels Oct 20, 2022
@mtreinish mtreinish added this to the 0.22.1 milestone Oct 20, 2022
@mtreinish mtreinish requested a review from a team as a code owner October 20, 2022 19:30
@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

coveralls commented Oct 20, 2022

Pull Request Test Coverage Report for Build 3362090799

  • 9 of 13 (69.23%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.1%) to 84.454%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/transpiler/target.py 9 13 69.23%
Files with Coverage Reduction New Missed Lines %
qiskit/transpiler/target.py 1 94.7%
Totals Coverage Status
Change from base Build 3360743212: 0.1%
Covered Lines: 62190
Relevant Lines: 73638

💛 - Coveralls

Copy link
Member

@1ucian0 1ucian0 left a comment

Choose a reason for hiding this comment

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

Just a small comment. Maybe a test case is missing?

Copy link
Member

@1ucian0 1ucian0 left a comment

Choose a reason for hiding this comment

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

LGTM

@1ucian0 1ucian0 merged commit f6a343b into Qiskit:main Oct 31, 2022
mergify bot pushed a commit that referenced this pull request Oct 31, 2022
…8977)

* Fix handling of global ideal gates for target build_coupling_map()

This commit fixes the handling of the `build_coupling_map()` method so
that it correctly handles edge cases around a mix of ideal globally
available gates and gates that have qubit/connectivity constraints.
Previously, the method would incorrectly treat the presence of a
globally defined ideal gate as meaning there were no connectivity
constraints, even if that global gate was only on 1 qubit. While if the
gate operates on two qubits this is correct behavior.

Fixes #8971

* Add test for single qarg non-ideal case

(cherry picked from commit f6a343b)
mergify bot added a commit that referenced this pull request Oct 31, 2022
…8977) (#9040)

* Fix handling of global ideal gates for target build_coupling_map()

This commit fixes the handling of the `build_coupling_map()` method so
that it correctly handles edge cases around a mix of ideal globally
available gates and gates that have qubit/connectivity constraints.
Previously, the method would incorrectly treat the presence of a
globally defined ideal gate as meaning there were no connectivity
constraints, even if that global gate was only on 1 qubit. While if the
gate operates on two qubits this is correct behavior.

Fixes #8971

* Add test for single qarg non-ideal case

(cherry picked from commit f6a343b)

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 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.

Transpilation does not take place if an instruction with {None: None} properties is added to the target
5 participants