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 UnitarySynthesis pass bug when target contains global gates (backport #13651) #13656

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jan 13, 2025

Summary

While working on #12850 I realized that the UnitarySynthesis Rust implementation would sometimes append non-2q-gates to the basis set and panic over the dimension mismatch. I had assumed that target.operation_names_for_qargs(Some(&qubits)) would only return gates whose number of qubits matched len(qubits), but this assumption is incorrect. It will return any gate with some overlap with the provided qargs, independently of the number of qubits of the gate. This bug would come up often when the target contained global gates.

I believe that the fix is as simple as making sure the 2q basis contains only 2q gates, at least for the cases I found.

Details and comments


This is an automatic backport of pull request #13651 done by [Mergify](https://mergify.com).

…3651)

* Confirm 2q basis gate candidates are in fact 2-qubit gates. Add test using target with global gates.

* Add reno

* Apply Matt's suggestion

Co-authored-by: Matthew Treinish <[email protected]>

* Add semicolon

* Apply Shelly's suggestion

---------

Co-authored-by: Matthew Treinish <[email protected]>
(cherry picked from commit d041d5b)
@mergify mergify bot requested a review from a team as a code owner January 13, 2025 17:11
@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 following people are relevant to this code:

  • @Qiskit/terra-core

@github-actions github-actions bot added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Jan 13, 2025
@github-actions github-actions bot added this to the 1.3.2 milestone Jan 13, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 12752410944

Details

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • 14 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.01%) to 88.921%

Files with Coverage Reduction New Missed Lines %
crates/accelerate/src/two_qubit_decompose.rs 1 91.96%
crates/qasm2/src/parse.rs 6 97.62%
crates/qasm2/src/lex.rs 7 91.98%
Totals Coverage Status
Change from base Build 12709260875: -0.01%
Covered Lines: 79159
Relevant Lines: 89022

💛 - Coveralls

@alexanderivrii alexanderivrii added this pull request to the merge queue Jan 14, 2025
Merged via the queue into stable/1.3 with commit c68c835 Jan 14, 2025
20 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants