-
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
Fix transpile() with a Target containing an ideal Measure #8995
Fix transpile() with a Target containing an ideal Measure #8995
Conversation
This commit fixes an oversight in the transpile() function when running with a Target (either directly or via a backend) that contains a Measurement operation that is ideal (either globally or locally) with no properties defined. This was not handled correctly in the function used to convert a Target to a BackendProperties payload for passes that are not yet target aware and this would cause an exception to be raised. This commit fixes this edge case and excludes readout properties from the generated BackendProperties in this case. Fixes Qiskit#8969
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 3342757244
💛 - 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, thank you for the quick fix. I left one minor comment inline. It's a nitpick, so not worth blocking the merge.
if not props_list: | ||
qubit_props = {} | ||
break |
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.
This may be a too small nitpick in the original code, but these lines suggest we cannot mix ideal Measures and real Measures (if do that, real Measures will be silently converted to ideal Measures here, right?). Warning here (or allowing the mixture) might be nice. That said, I don't think of any practical use case of such a mixture, so I'm fine with keeping the code as is until we encounter any concrete issue.
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.
That's a good point, I do think it's unlikely in practice for there to be mixed ideal and real measurements but we should try to support that especially since it's possible combination and allowed in the target. The only reason we have to special case measurement here is because it's special in BackendProperties
.
This commit fixes an oversight in the transpile() function when running with a Target (either directly or via a backend) that contains a Measurement operation that is ideal (either globally or locally) with no properties defined. This was not handled correctly in the function used to convert a Target to a BackendProperties payload for passes that are not yet target aware and this would cause an exception to be raised. This commit fixes this edge case and excludes readout properties from the generated BackendProperties in this case. Fixes #8969 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 72ba2ee)
) This commit fixes an oversight in the transpile() function when running with a Target (either directly or via a backend) that contains a Measurement operation that is ideal (either globally or locally) with no properties defined. This was not handled correctly in the function used to convert a Target to a BackendProperties payload for passes that are not yet target aware and this would cause an exception to be raised. This commit fixes this edge case and excludes readout properties from the generated BackendProperties in this case. Fixes #8969 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 72ba2ee) Co-authored-by: Matthew Treinish <[email protected]>
Summary
This commit fixes an oversight in the transpile() function when running with a Target (either directly or via a backend) that contains a Measurement operation that is ideal (either globally or locally) with no properties defined. This was not handled correctly in the function used to convert a Target to a BackendProperties payload for passes that are not yet target aware and this would cause an exception to be raised. This commit fixes this edge case and excludes readout properties from the generated BackendProperties in this case.
Details and comments
Fixes #8969