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

Add function to easily generate preset pass managers #8125

Merged
merged 8 commits into from
Jun 3, 2022

Conversation

mtreinish
Copy link
Member

Summary

This commit adds a new function, generate_preset_pass_managers(), which
is used to quickly generate the preset pass manager for manual
interaction. Prior to this new function there were lower level functions
which are used to generate the individual pass manager objects for each
optimization level but they are hidden behind an abstraction object,
PassManagerConfig which is the only input. This makes it harder to work
with because the user has to manually remember to generate the config
object prior to creating the pass manager. Similarly this new function
simplifies the creation of preset pass managers by having a single entry
point instead of 4 for each optimization level.

Details and comments

This commit adds a new function, generate_preset_pass_managers(), which
is used to quickly generate the preset pass manager for manual
interaction. Prior to this new function there were lower level functions
which are used to generate the individual pass manager objects for each
optimization level but they are hidden behind an abstraction object,
PassManagerConfig which is the only input. This makes it harder to work
with because the user has to manually remember to generate the config
object prior to creating the pass manager. Similarly this new function
simplifies the creation of preset pass managers by having a single entry
point instead of 4 for each optimization level.
@mtreinish mtreinish added the Changelog: New Feature Include in the "Added" section of the changelog label Jun 1, 2022
@mtreinish mtreinish added this to the 0.21 milestone Jun 1, 2022
@mtreinish mtreinish requested a review from chriseclectic June 1, 2022 20:17
@mtreinish mtreinish requested a review from a team as a code owner June 1, 2022 20:17
@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

@mtreinish
Copy link
Member Author

We should make sure that this doesn't get included in the release without #8109. If #8109 doesn't get included this function won't work with BackendV2 instances.

@coveralls
Copy link

coveralls commented Jun 1, 2022

Pull Request Test Coverage Report for Build 2429289079

  • 71 of 73 (97.26%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 84.4%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/transpiler/target.py 36 38 94.74%
Totals Coverage Status
Change from base Build 2428105405: 0.01%
Covered Lines: 54648
Relevant Lines: 64749

💛 - Coveralls

mtreinish added 4 commits June 2, 2022 11:21
If a user manually specifies a Target object to use as the compilation
target we still need to generate the old data structures to trigger
some passes to run. We also want the properties of the target to
supersede those in a specified backend if it's manually specified. This
commit corrects the handling of this so the manually specified target is
the source of truth when specified.
@mtreinish mtreinish requested a review from Cryoris June 2, 2022 15:38
Copy link
Contributor

@Cryoris Cryoris left a comment

Choose a reason for hiding this comment

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

Overall LGTM! I left some picky comments on the docstring (since we're touching it anyways, why not 😛) and do we want to add tests for target_to_backend_properties? Maybe that's not necessary since it's implicitly tested in the test_with_no_backend test 🙂

qiskit/transpiler/preset_passmanagers/__init__.py Outdated Show resolved Hide resolved
qiskit/transpiler/preset_passmanagers/__init__.py Outdated Show resolved Hide resolved
qiskit/transpiler/preset_passmanagers/__init__.py Outdated Show resolved Hide resolved
qiskit/transpiler/preset_passmanagers/__init__.py Outdated Show resolved Hide resolved
qiskit/transpiler/preset_passmanagers/__init__.py Outdated Show resolved Hide resolved
qiskit/transpiler/preset_passmanagers/__init__.py Outdated Show resolved Hide resolved
@Cryoris Cryoris merged commit 43e4a72 into Qiskit:main Jun 3, 2022
@mtreinish mtreinish deleted the generate-preset-pm branch June 3, 2022 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants