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 ignored errors/durations in generate_preset_pass_manager if dt is set (backport #14065) #14098

Merged
merged 1 commit into from
Mar 25, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Mar 25, 2025

Summary

#14056 (comment) reported an unexpected behavior of generate_preset_pass_manager where setting a custom dt would invalidate the backend's gate durations and error rates. This was due to an oversight in #9256 , where a custom target would be built from scratch using Target.from_configuration whenever any loose constraint was set, and any information regarding instruction properties would be lost. This was intentional for coupling_map and basis_gates, as they modify the target gate map, but not necessary for dt, where the target could be kept and simply updated.

This PR fixes this use case, adds a test with vf2 + dt, and modifies the user warning to explicitly communicate what will happen with gate durations and errors if coupling_map or basis_gates are set with a backend.

Details and comments

The changelog is None as #9256 has not been released yet.


This is an automatic backport of pull request #14065 done by [Mergify](https://mergify.com).

…` is set (#14065)

* Fix dt oversight in generate_preset_pass_manager

* Update warning to mention explicitly the invalidation of custom durations and error rates.

* Do not overwrite original backend values inside transpile, iterate over target to reset internal instruction_durations value so that new dt can be taken into account

* One iteration is enough to reset the value of self._instruction_durations

* Estimate duration instead of hardcoding it

* Apply suggestion from Matt's code review

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

* Fix example

* Move cache invalidation to target dt setter.

* Add reno

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
(cherry picked from commit 6ce7788)
@mergify mergify bot requested a review from a team as a code owner March 25, 2025 19:28
@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 following people are relevant to this code:

  • @Qiskit/terra-core

@github-actions github-actions bot added Changelog: Bugfix Include in the "Fixed" section of the changelog Changelog: None Do not include in changelog labels Mar 25, 2025
@github-actions github-actions bot added this to the 2.0.0 milestone Mar 25, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 14068444742

Details

  • 18 of 18 (100.0%) changed or added relevant lines in 3 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.03%) to 88.08%

Files with Coverage Reduction New Missed Lines %
crates/accelerate/src/unitary_synthesis.rs 1 94.79%
crates/qasm2/src/lex.rs 3 92.48%
Totals Coverage Status
Change from base Build 14066610058: 0.03%
Covered Lines: 72745
Relevant Lines: 82590

💛 - Coveralls

@mtreinish mtreinish added this pull request to the merge queue Mar 25, 2025
Merged via the queue into stable/2.0 with commit 254d181 Mar 25, 2025
23 checks passed
@ElePT ElePT removed the Changelog: None Do not include in changelog label Mar 31, 2025
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.

4 participants