-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 a default optimization level to generate_preset_pass_manager #12150
Merged
mtreinish
merged 14 commits into
Qiskit:main
from
mtreinish:default-generate-preset-pass-manager
Jul 26, 2024
+121
−30
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8191110
Add a default optimization level to generate_preset_pass_manager
mtreinish 439a390
Merge remote-tracking branch 'origin/main' into default-generate-pres…
mtreinish 34e9ee4
Update transpile()'s default opt level to match
mtreinish 82c776b
Update more tests expecting optimization level 1
mtreinish 6071496
Merge branch 'main' of https://github.com/Qiskit/qiskit into default-…
ElePT c64b356
* Set optimization level to 1 in test_approximation_degree.
ElePT 77ac770
Set optimization_level=1 in layout-dependent tests.
ElePT 479ac9f
Merge branch 'main' of https://github.com/Qiskit/qiskit into default-…
ElePT 8ed8d5e
Expand upgrade note explanation on benefits of level 2
mtreinish e24cd84
Merge branch 'main' into default-generate-preset-pass-manager
ElePT 4106d3d
Merge branch 'main' of https://github.com/Qiskit/qiskit into default-…
ElePT 8eed81b
Merge branch 'main' of https://github.com/Qiskit/qiskit into default-…
ElePT ae3523f
Merge branch 'default-generate-preset-pass-manager' of https://github…
ElePT 8198182
Apply Elena's reno suggestions
ElePT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
releasenotes/notes/default-level-2-generate-preset-passmanager-ec758ddc896ae2d6.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
features_transpiler: | ||
- | | ||
The ``optimization_level`` argument for the :func:`.generate_preset_pass_manager` function is | ||
now optional. If it's not specified it will default to using optimization level 2. As the argument | ||
is now optional, the first positional argument has been expanded to enable passing a :class:`.Target` | ||
or a :class:`.BackendV2` as the first argument for more convenient construction. For example:: | ||
from qiskit.transpiler.preset_passmanager import generate_preset_pass_manager | ||
from qiskit.providers.fake_provider import GenericBackendV2 | ||
backend = GenericBackendV2(100) | ||
generate_preset_pass_manager(backend.Target) | ||
will construct a default pass manager for the 100 qubit :class`.GenericBackendV2` instance. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I'd rather this function not support any positional arguments.
I think we want a more ergonomic API on top of this function eventually anyways, e.g. #12161, so it seems too kludgy to me to try and make this accept a target positionally here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#12161 is actually what I'm not sure we want to do. Adding a 3rd API with different semantics to do what we already have two interfaces for seems like a mistake to me. If people really want a different name I feel like we really should just alias it (but I still don't think it's worth it). But adding yet another entrypoint to accomplish the same thing feels like a mistake. If people are complaining about the ergonomics of the existing interface I feel like we should just evolve it in-place instead of diverging it again and requiring people to learn yet another thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's unfortunate that we've ended up here, but I think the right thing to do for users is to make it so the common patterns
{transpile,generate_preset_pass_manager}({backend,target}, optimization_level=2)
work the same in both forms. It ends up in an ugly signature for us, but we can tidy that up in place and potentially fix the signature properly for Qiskit 2.0+.