qiskit
qiskit copied to clipboard
Add BackendV2Converter class for treating BackendV1 as BackendV2
Summary
This commit adds a new class BackendV2Converter which is a BackendV2 implementation that converts an input BackendV1 object into a BackendV2 implementation. This is useful for users that are supporting working with arbitrary providers so that they can standardize on using the newest access patterns even if a provider is still using BackendV1. Similarly, for qiskit's internal usage, this gives us a path to move all of the transpiler internals to use Target and avoid carrying around duplicate information in the PassManagerConfig for passes that haven't been updated. This will enable us to convert input BackendV1 instances to a target once on initial calling and have the transpiler only ever see a target.
Details and comments
Fixes #8611
Co-authored-by: Kevin Tian [email protected] Co-authored-by: Rathish Cholarajan [email protected]
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
Pull Request Test Coverage Report for Build 3141055024
- 126 of 157 (80.25%) changed or added relevant lines in 3 files are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage decreased (-0.0009%) to 84.466%
| Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
|---|---|---|---|
| qiskit/providers/backend_compat.py | 116 | 147 | 78.91% |
| <!-- | Total: | 126 | 157 |
| Totals | |
|---|---|
| Change from base Build 3139567056: | -0.0009% |
| Covered Lines: | 60079 |
| Relevant Lines: | 71128 |
💛 - Coveralls
Overall I really like this idea. I added several comments. My main questions are
* What would be the best place to host this code? Seems like V1 to V2 conversion is provider-specific.
To do it fully and most effectively yes it is provider specific thing. Ideally every provider would handle this on their own, but at this point not every provider has migrated to BackendV2 so having this generic converter provides some benefits even if the transform can't handle all the nuances of provider doing itself.
* Can we also address missing frequency parameters in #8712 ?
I thought we were talking about expanding the BackendV2 class to support that. I think when we have a defined place for the frequency parameters in BackendV2/Target this converter class should be updated to handle that.