-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Modify preset pass managers for control-flow support #8830
Changes from all commits
921139e
b935ae9
a363da7
ff05b66
3fc8cc6
f1a0bba
5e31bc5
097f63b
6160b16
a53a4a3
b500c57
66ed532
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -262,12 +262,15 @@ def _unroll_condition(property_set): | |
sched = plugin_manager.get_passmanager_stage( | ||
"scheduling", scheduling_method, pass_manager_config, optimization_level=2 | ||
) | ||
init = common.generate_error_on_control_flow( | ||
"The optimizations in optimization_level=2 do not yet support control flow." | ||
) | ||
Comment on lines
+265
to
+267
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We technically could get a level2 pm that given the assumptions made in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was treating us as "supporting" an optimisation level if the defaults will work - for O2, you have to override everything that actually makes it O2 back to what's in O1, so I think it's better to reject There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess at O1, now that routing and layout are both Sabre by default there's an argument that we're kind of just doing that internally too, I suppose. I was still thinking in terms of the old O1 that had dense/stochastic as its default. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with this for now, to a certain degree if people want to get more complicated maybe they should just be using custom pass managers. We just will have to document clearly in the release note that |
||
if init_method is not None: | ||
init = plugin_manager.get_passmanager_stage( | ||
init += plugin_manager.get_passmanager_stage( | ||
"init", init_method, pass_manager_config, optimization_level=2 | ||
) | ||
else: | ||
init = unroll_3q | ||
elif unroll_3q is not None: | ||
init += unroll_3q | ||
|
||
return StagedPassManager( | ||
init=init, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
fixes: | ||
- | | ||
Nesting a :class:`.FlowController` inside another in a :class:`.PassManager` | ||
could previously cause some transpiler passes to become "forgotten" during | ||
transpilation, if the passes returned a new :class:`.DAGCircuit` rather than | ||
mutating their input. Nested :class:`.FlowController`\ s will now affect | ||
the transpilation correctly. |
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.
Couldn't we just use
"layout_method"
etc for L99-L103? Besides the_CONTROL_FLOW_STATES
lookup this is just used for the error message and*_method
works fine for the error message too.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.
I think I did this just because one of the possible error messages is "the entire {stage} stage is not supported", and that's weird with
scheduling_method
.