Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Add translation stage to IBM backend and update DD to use #483

Merged
merged 11 commits into from
Feb 9, 2023

Conversation

taalexander
Copy link
Contributor

@taalexander taalexander commented Jan 19, 2023

Summary

This PR builds on #480 and #420 to enable translation plugins for provider backends by default. This is a powerful feature that will solve usability issues with new-style control-flow.

As this is based on #420 for reviewing purposes look at - https://github.com/Qiskit/qiskit-ibm-provider/pull/483/files/4b446b04e25912f0de6a45a49e37532ed896a4bc..25f35228c0aad6ce3000fca7fc4aca2261c27a75

Details and comments

Currently the plugin is named ibm_dynamic_circuits but applies transformations that are generally good for IBM backends. The IBMBackend currently does not differentiate between dynamic/non-dynamic circuit backends but this might be desirable in the long run. Perhaps, in the near term we could rename ibm_dynamic_circuits to ibm or something along these lines (or keep both and have them be identical).

@taalexander taalexander force-pushed the taa-add-get-translation-stage branch from f17fbcd to 3521936 Compare January 26, 2023 19:46
@coveralls
Copy link

coveralls commented Jan 26, 2023

Pull Request Test Coverage Report for Build 4139093156

  • 0 of 1 (0.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 50.205%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit_ibm_provider/ibm_backend.py 0 1 0.0%
Totals Coverage Status
Change from base Build 4137388290: 0.1%
Covered Lines: 2935
Relevant Lines: 5846

💛 - Coveralls

@taalexander taalexander force-pushed the taa-add-get-translation-stage branch from 3521936 to 4771006 Compare February 1, 2023 17:58
Comment on lines 777 to +779
def get_translation_stage_plugin(self) -> str:
"""Return the default translation stage plugin name for IBM backends."""
return "ibm_backend"
return "ibm_dynamic_circuits"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think doing this might cause problems for users who are using c_if but dynamic=False - the new plugin will convert the operations at optimisation levels 0 and 1, but then I think the job will fail went sent off to the next step in the pipeline?

I'm actually not sure what the solution is here, since dynamic=True and dynamic=False are handled by the same IBMBackend instance. We don't know if the user intends to set dynamic=True until Backend.run is called so get_translation_stage_plugin can't know it.

Copy link
Contributor Author

@taalexander taalexander Feb 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nobody can use c_if with dynamic=False AFAIK? The only other solution would be to set a different type of backend that is returned to the user from the provider?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can they not? I thought the old paths had some amount of support for it for like conditional resets? You'd know better than me - if c_if wouldn't have worked before, then I don't think there's any issue with this change.

Copy link
Contributor Author

@taalexander taalexander Feb 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yah, the old path doesn't support this (outside of simulators I suppose, in which case the simulators support the conversion regardless). The old path does support resets/MCM but these are unaffected.

@taalexander taalexander force-pushed the taa-add-get-translation-stage branch from dc303bd to 8f4f41a Compare February 5, 2023 17:46
@kt474 kt474 added this to the 0.3.0 milestone Feb 6, 2023
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor typos aside, this looks good to me.

I actually reviewed this offline with a

git diff thomas/dd-scf..thomas/taa-add-get-translation-stage

because the PR history has both branches, and GitHub doesn't offer great tools to separate the commits now that there's some date overlap between the two.

@taalexander taalexander force-pushed the taa-add-get-translation-stage branch from 8f4f41a to 9f3b880 Compare February 9, 2023 22:47
@taalexander taalexander force-pushed the taa-add-get-translation-stage branch from 9f3b880 to f8598ca Compare February 9, 2023 22:48
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Thanks for all the changes!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants