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

Treat Reset like Measure in ConstrainedReschedule #11756

Merged
merged 7 commits into from
Apr 25, 2024

Conversation

hunterkemeny
Copy link
Contributor

Summary

fixes #10354 ConstrainedReschedule raises an error with reset

Details and comments

Reset and Measure (mid-circuit) both provide duration data from the backend, but this is untrustworthy. To reflect this, I added RuntimeWarnings in qiskit/transpiler/passes/scheduling/base_scheduler.py.

That Reset reports duration data is not recognized in ConstrainedReschedule, leading to the error in Issue #10354. Thus, I added the same handling for Reset in ConstrainedReschedule as is used for Measure.

@hunterkemeny hunterkemeny requested a review from a team as a code owner February 8, 2024 18:11
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core
  • @nkanazawa1989

@mtreinish mtreinish added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Feb 8, 2024
@coveralls
Copy link

coveralls commented Feb 8, 2024

Pull Request Test Coverage Report for Build 8070375077

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • -4 of 13 (69.23%) changed or added relevant lines in 2 files are covered.
  • 466 unchanged lines in 57 files lost coverage.
  • Overall coverage increased (+0.1%) to 89.291%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/transpiler/passes/scheduling/base_scheduler.py 8 9 88.89%
qiskit/transpiler/passes/scheduling/alignments/reschedule.py 1 4 25.0%
Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/expr.rs 1 93.81%
qiskit/circuit/controlflow/control_flow.py 1 95.0%
qiskit/circuit/library/standard_gates/global_phase.py 1 95.83%
qiskit/circuit/library/standard_gates/rx.py 1 98.55%
qiskit/circuit/library/standard_gates/ry.py 1 98.51%
qiskit/circuit/library/standard_gates/ryy.py 1 97.3%
qiskit/circuit/library/standard_gates/rz.py 1 98.46%
qiskit/circuit/library/standard_gates/rzz.py 1 97.06%
qiskit/circuit/library/standard_gates/swap.py 1 98.08%
qiskit/circuit/library/standard_gates/u3.py 1 98.9%
Totals Coverage Status
Change from base Build 7830061937: 0.1%
Covered Lines: 59130
Relevant Lines: 66222

💛 - Coveralls

Copy link
Contributor

@nkanazawa1989 nkanazawa1989 left a comment

Choose a reason for hiding this comment

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

Thanks @hunterkemeny for adding support for reset instruction. Since Qiskit is assumed to be vendor agnostic (I'm not sure if this can be true for low level operations like a scheduling), the warning message should be more generic. I added some suggestions but feel free to update if you have better wording.

Let me confirm your intention. As you may notice ConstrainedReschedule is not a BaseScheduler subclass where you added the user warnings. This means user will never see the message when they only run the rescheduler. In principle rescheduler doesn't work without scheduling, so you are expecting the user will see the message at first scheduling step, then no additional error will raise in rescheduler, right?

qiskit/transpiler/passes/scheduling/base_scheduler.py Outdated Show resolved Hide resolved
qiskit/transpiler/passes/scheduling/base_scheduler.py Outdated Show resolved Hide resolved
qiskit/transpiler/passes/scheduling/base_scheduler.py Outdated Show resolved Hide resolved
Copy link
Contributor

@nkanazawa1989 nkanazawa1989 left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good to me.

@nkanazawa1989 nkanazawa1989 added this pull request to the merge queue Apr 25, 2024
Merged via the queue into Qiskit:main with commit 607bee8 Apr 25, 2024
12 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConstrainedReschedule raises an error with reset
5 participants