Skip to content
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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

ElePT
Copy link
Collaborator

@ElePT ElePT commented Dec 17, 2024

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:

  • motivation: @jyu00 mentioned this was often requested by users, I tried to keep it short and touch on the usefulness of the abstraction level of the primitives
  • Backend primitives as a migration alternative for providers that already implemented backend.run (following the AQT example)
  • Custom primitives as an alternative for providers that want it, or didn't implement backend.run (following the StatevectorSampler and StatevectorEstimator) examples

Please let me know if you have any other take on how the content should look like @javabster, @jyu00.

Co-authored-by: abbycross <across@us.ibm.com>
Co-authored-by: abbycross <across@us.ibm.com>
@qiskit-bot
Copy link
Contributor

One or more of the following people are relevant to this code:

@ElePT ElePT changed the title [WIP] Migration guide for providers to implement V2 primitives Migration guide for providers to implement V2 primitives Dec 18, 2024
# Migrate provider interfaces from `backend.run` to primitives

## Motivation and context

Copy link
Collaborator

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.

docs/migration-guides/external-providers-primitives-v2.mdx Outdated Show resolved Hide resolved
docs/migration-guides/external-providers-primitives-v2.mdx Outdated Show resolved Hide resolved
Comment on lines 20 to 24
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.
Copy link
Collaborator

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`
Copy link
Collaborator

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).

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

6 participants