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

Fix handling of BackendV1 simulators in PassManagerConfig.from_backend #9719

Merged
merged 2 commits into from
Mar 3, 2023

Conversation

mtreinish
Copy link
Member

Summary

This commit fixes two small oversights that would appear when calling PassManagerConfig.from_backend() with a simulator BackendV1 backend. The handling of optional fields in the BackendProperties and PulseDefaults objects for BackendV1 backends was missing that a BackendProperties object's gates field could be None and that the defaults() method could return None in the absense of any pulse calibrations (both of which typically only are True for simulators). In these cases this would cause an error constructing the InstructionDurations object and the InstructionScheduleMap object respectively. This fixes the handling of these edge cases so that PassManagerConfig.from_backend() will work with any BackendV1 based backend.

Details and comments

Fixes #8546
Fixes #9265

@mtreinish mtreinish added stable backport potential The bug might be minimal and/or import enough to be port to stable Changelog: Bugfix Include in the "Fixed" section of the changelog mod: transpiler Issues and PRs related to Transpiler labels Mar 3, 2023
@mtreinish mtreinish added this to the 0.23.3 milestone Mar 3, 2023
@mtreinish mtreinish requested a review from a team as a code owner March 3, 2023 20:07
@qiskit-bot
Copy link
Collaborator

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

This commit fixes two small oversights that would appear when calling
PassManagerConfig.from_backend() with a simulator BackendV1 backend.
The handling of optional fields in the BackendProperties and
PulseDefaults objects for BackendV1 backends was missing that a
BackendProperties object's gates field could be None and that the
defaults() method could return None in the absense of any pulse
calibrations (both of which typically only are True for simulators). In
these cases this would cause an error constructing the
InstructionDurations object and the InstructionScheduleMap object
respectively. This fixes the handling of these edge cases so that
PassManagerConfig.from_backend() will work with any BackendV1 based
backend.

Fixes Qiskit#8546
Fixes Qiskit#9265
@mtreinish mtreinish force-pushed the fix-backend-v1-pm-config-from branch from 6d40c29 to 78ef8e8 Compare March 3, 2023 20:34
@coveralls
Copy link

Pull Request Test Coverage Report for Build 4327089103

  • 14 of 14 (100.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.02%) to 85.336%

Files with Coverage Reduction New Missed Lines %
qiskit/transpiler/passes/synthesis/unitary_synthesis.py 1 95.04%
Totals Coverage Status
Change from base Build 4324247929: -0.02%
Covered Lines: 67895
Relevant Lines: 79562

💛 - Coveralls

Copy link
Member

@1ucian0 1ucian0 left a comment

Choose a reason for hiding this comment

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

simple and straightforward. Thanks!

@mergify mergify bot merged commit 35feded into Qiskit:main Mar 3, 2023
mergify bot pushed a commit that referenced this pull request Mar 3, 2023
#9719)

This commit fixes two small oversights that would appear when calling
PassManagerConfig.from_backend() with a simulator BackendV1 backend.
The handling of optional fields in the BackendProperties and
PulseDefaults objects for BackendV1 backends was missing that a
BackendProperties object's gates field could be None and that the
defaults() method could return None in the absense of any pulse
calibrations (both of which typically only are True for simulators). In
these cases this would cause an error constructing the
InstructionDurations object and the InstructionScheduleMap object
respectively. This fixes the handling of these edge cases so that
PassManagerConfig.from_backend() will work with any BackendV1 based
backend.

Fixes #8546
Fixes #9265

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 35feded)
mergify bot added a commit that referenced this pull request Mar 4, 2023
#9719) (#9725)

This commit fixes two small oversights that would appear when calling
PassManagerConfig.from_backend() with a simulator BackendV1 backend.
The handling of optional fields in the BackendProperties and
PulseDefaults objects for BackendV1 backends was missing that a
BackendProperties object's gates field could be None and that the
defaults() method could return None in the absense of any pulse
calibrations (both of which typically only are True for simulators). In
these cases this would cause an error constructing the
InstructionDurations object and the InstructionScheduleMap object
respectively. This fixes the handling of these edge cases so that
PassManagerConfig.from_backend() will work with any BackendV1 based
backend.

Fixes #8546
Fixes #9265

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 35feded)

Co-authored-by: Matthew Treinish <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
king-p3nguin pushed a commit to king-p3nguin/qiskit-terra that referenced this pull request May 22, 2023
Qiskit#9719)

This commit fixes two small oversights that would appear when calling
PassManagerConfig.from_backend() with a simulator BackendV1 backend.
The handling of optional fields in the BackendProperties and
PulseDefaults objects for BackendV1 backends was missing that a
BackendProperties object's gates field could be None and that the
defaults() method could return None in the absense of any pulse
calibrations (both of which typically only are True for simulators). In
these cases this would cause an error constructing the
InstructionDurations object and the InstructionScheduleMap object
respectively. This fixes the handling of these edge cases so that
PassManagerConfig.from_backend() will work with any BackendV1 based
backend.

Fixes Qiskit#8546
Fixes Qiskit#9265

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog mod: transpiler Issues and PRs related to Transpiler stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PassManagerConfig.from_backend fails with AerSimulator generating preset pass manager for simulators fails
4 participants