-
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
Improve SabreSwap error message on unexpanded circuits #9909
Conversation
`SabreSwap` requires that the input circuit is exactly the same size as the system implied by the coupling map, since this is used internally in Rust for the virtual-to-physical mapping. Failure to ensure this can lead to panics in the Rust code. This commit catches the failure case (for free) in Python space, and attempts to help the user work out what they needed.
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:
|
Pull Request Test Coverage Report for Build 4612257839
💛 - Coveralls |
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.
LGTM, this is straightforward enough. I was going to ask that we wait until after #9840 to ensure the conditions match in the case of disjoint coupling map. But I don't think it'll be an issue because layout should work and also at least in the preset pass managers we don't ever run this pass in practice. It does remind me that for #9840 after I rebase it I should probably add a release note for layout pass authors about the disconnected coupling maps and how to handle them.
I'd actually forgotten that we had #9840 on the go when I wrote this. Yeah, for sure we can revisit the error messages as part of that too. |
`SabreSwap` requires that the input circuit is exactly the same size as the system implied by the coupling map, since this is used internally in Rust for the virtual-to-physical mapping. Failure to ensure this can lead to panics in the Rust code. This commit catches the failure case (for free) in Python space, and attempts to help the user work out what they needed.
`SabreSwap` requires that the input circuit is exactly the same size as the system implied by the coupling map, since this is used internally in Rust for the virtual-to-physical mapping. Failure to ensure this can lead to panics in the Rust code. This commit catches the failure case (for free) in Python space, and attempts to help the user work out what they needed.
Summary
SabreSwap
requires that the input circuit is exactly the same size as the system implied by the coupling map, since this is used internally in Rust for the virtual-to-physical mapping. Failure to ensure this can lead to panics in the Rust code. This commit catches the failure case (for free) in Python space, and attempts to help the user work out what they needed.Details and comments
This was prompted by a discussion in Slack about the confusing error, though I've done approximately the same thing myself before and got confused.