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

Update Target to use CalibrationEntry to create inst map #9597

Merged
merged 5 commits into from
Feb 17, 2023

Conversation

nkanazawa1989
Copy link
Contributor

Summary

This PR fixes a bug that InstructionScheduleMap.has_custom_gate() always return True when the inst map is created by Target.instruction_schedule_map.

In previous implementation, .get_schedule() method is called via InstructionProperties.calibration, which generates a schedule from PulseQobjDef, to create an inst map. In this PR, Target.instruction_schedule_map is updated to bypass get_schedule call to keep PulseQobjDef un-parsed.

Fix #9595

Details and comments

InstructionProperties._calibration is updated to only store CalibrationEntry, which was previously Union[CalibrationEntry, Schedule, ScheduleBlock].

InstructionProperties._calibration now only takes CalibrationEntry and use this instance to create an inst map.
@nkanazawa1989 nkanazawa1989 added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Feb 16, 2023
@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:

@coveralls
Copy link

coveralls commented Feb 16, 2023

Pull Request Test Coverage Report for Build 4204268420

  • 19 of 19 (100.0%) changed or added relevant lines in 2 files are covered.
  • 6 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.03%) to 85.276%

Files with Coverage Reduction New Missed Lines %
qiskit/extensions/quantum_initializer/squ.py 2 80.0%
src/sabre_swap/layer.rs 4 97.32%
Totals Coverage Status
Change from base Build 4198131484: 0.03%
Covered Lines: 67244
Relevant Lines: 78855

💛 - Coveralls

@mtreinish mtreinish added the stable backport potential The bug might be minimal and/or import enough to be port to stable label Feb 16, 2023
@mtreinish mtreinish added this to the 0.23.2 milestone Feb 16, 2023
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

Overall this fix LGTM, thanks for the speedy fix! Just a couple small comments iinline mostly about the release notes and tests

test/python/transpiler/test_target.py Show resolved Hide resolved
qiskit/pulse/instruction_schedule_map.py Outdated Show resolved Hide resolved
nkanazawa1989 and others added 2 commits February 17, 2023 19:39
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the quick updates

@mergify mergify bot merged commit ecb6f9a into Qiskit:main Feb 17, 2023
mergify bot pushed a commit that referenced this pull request Feb 17, 2023
* Bug fix for InstructionScheduleMap.has_custom_gate.

InstructionProperties._calibration now only takes CalibrationEntry and use this instance to create an inst map.

* Fix repr not to call .calibration

* Review comment

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Remove getattr

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit ecb6f9a)
mergify bot added a commit that referenced this pull request Feb 17, 2023
* Bug fix for InstructionScheduleMap.has_custom_gate.

InstructionProperties._calibration now only takes CalibrationEntry and use this instance to create an inst map.

* Fix repr not to call .calibration

* Review comment

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Remove getattr

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit ecb6f9a)

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
@nkanazawa1989 nkanazawa1989 deleted the fix/inst-map-from-target branch December 11, 2023 16:23
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 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.

Target.instruction_schedule_map().has_custom_gate() always returns True
4 participants