Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
5.1k stars 2.34k forks source link

Fix an edge case in Sabre's release valve (backport #13114) #13130

Closed mergify[bot] closed 2 weeks ago

mergify[bot] commented 2 weeks ago

Summary

Fixes #13081.

Details and comments

If a Sabre trial does not find a set of Swaps to route nodes, the "release valve" adds Swaps to route the two-qubit gate in between the the closest two qubits. In rare cases, this leads to more than one gate being routable, which was not handled correctly previously.

As I understand it this should only ever occur if the release-valve adds a single swap and we have a scenario like

A - B - A - B  --apply swap--> A - A - B - B

If more than one swap gate is applied it should not be possible that two gates are routable, so the code now only checks for a second routable gate if we insert a single swap. If someone can find a counterexample we can change the code to check for any routable gate after the release valve 🙂


This is an automatic backport of pull request #13114 done by Mergify.

qiskit-bot commented 2 weeks ago

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:

coveralls commented 2 weeks ago

Pull Request Test Coverage Report for Build 10811797234

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/accelerate/src/sabre/route.rs 9 22 40.91%
<!-- Total: 13 26 50.0% -->
Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 5 92.48%
crates/qasm2/src/parse.rs 12 97.15%
<!-- Total: 17 -->
Totals Coverage Status
Change from base Build 10811747175: -0.03%
Covered Lines: 66875
Relevant Lines: 74506

💛 - Coveralls