-
Notifications
You must be signed in to change notification settings - Fork 86
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
Migration guide for providers to implement V2 primitives #2496
base: main
Are you sure you want to change the base?
Conversation
…links to other guides/API refs
…ub.com/Qiskit/documentation into EPT/primitives-migration-for-providers
Co-authored-by: abbycross <across@us.ibm.com>
Co-authored-by: abbycross <across@us.ibm.com>
One or more of the following people are relevant to this code: |
30ba7cf
to
ebb7b5b
Compare
# Migrate provider interfaces from `backend.run` to primitives | ||
|
||
## Motivation and context | ||
|
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.
I think the very first paragraph should mention whom this migration guide is for, since it'd be irrelevant to the majority of people that consume IQP docs.
The existing collection of migration guides helps users [transition to the Qiskit Runtime provider](/migration-guides/qiskit-runtime) and | ||
[update their user code to the V2 primitives interface](/migration-guides/v2-primitives) in time for the upcoming removal of `backend.run`. | ||
To complement that, this guide supports external providers (both existing and upcoming) | ||
in implementing their own version of the primitives V2 interface (Estimator or Sampler) that integrates seamlessly into the | ||
standard Qiskit workflow. |
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.
I'd put the links to the migration guides in its own section, so the structure becomes
- why you should implement primitives interface
- how you implement primitives interface
- what you can tell your users
(for example: `execute_workload(QPU)` or `resource.access()`) or local simulator, | ||
as long as the final inputs and outputs conform to the established standards set by the primitive interfaces. | ||
|
||
## If your provider already implemented `backend.run` |
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.
I'm a bit confused by this section... this reads like the target audience is people who use 3rd party providers, and not the providers themselves (e.g. users of IonQProvider
and not IonQ itself).
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.
I am not too set on having this section, to be honest, that's why I mentioned in the PR description that I wanted a second opinion on this approach. I based it on the only kind of external (still mostly IBMers) provider that I know implemented primitives, that is: https://github.com/qiskit-community/qiskit-aqt-provider/tree/master. They based their primitives on the backend primitives as shown in this example, and I thought it might be a good shortcut for other providers too, but I also think it might be too hacky. If you don't think it adds any value, it could be removed.
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.
I think we can point out backend primitives as an example, but don't explicitly say they should use it. It's also to their benefit to optimize for their hardware instead of using an out-of-box implementation.
This section would actually be quite helpful in the existing backend.run
migration guide. If, for example, someone is using backend.run
across Qiskit Runtime + Provider Foo and want to migrate to primitives. They can use this as an example to write to primitives interface even if Foo hasn't migrated yet.
This is a proposal for content to address #2469. After a brief discussion with @jyu00 we agreed that we should focus this migration guide on showing how to implement new primitives for providers. However, I have not been involved in all discussions regarding the vision for this migration (and conversations around backend.run tend to raise a lot of different opinions) so I would appreciate confirmation that the content proposed fits the direction we want to show.
The page is currently in a pretty raw state, missing formatting, API ref links, a review on the titles, capitalization, etc, but I wanted to open a PR as fast as possible to ask for opinions on including the backend primitive wrappers as a tool for provider migration. This idea came from inspecting the only instance I know of external provider beyond the immediate product sphere, which is https://github.com/qiskit-community/qiskit-aqt-provider/tree/master, and subclasses backend primitives to expose their own primitive implementations. Following this, I decided to structure the page as follows:
Please let me know if you have any other take on how the content should look like @javabster, @jyu00.