-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Implement opt-bisect-limit for MIR #152474
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
base: main
Are you sure you want to change the base?
Conversation
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
| /// | ||
| /// Used by `-Zmir-opt-bisect-limit` to assign an index to each | ||
| /// optimization-pass execution candidate during this compilation. | ||
| pub mir_opt_bisect_eval_count: AtomicUsize, |
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.
We used to have optimization fuel in the session, but removed it in #115293
| limit: usize, | ||
| pass: &P, | ||
| ) -> bool | ||
| static MIR_OPT_BISECT_COUNT: AtomicUsize = AtomicUsize::new(0); |
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.
This is actually worse. This now not only breaks incr comp, but also breaks running multiple rustc sessions in the same process. Optimization fuel is not really compatible with incr comp. Perhaps we should just warn against enabling incr comp when optimization fuel is used?
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.
We used to have optimization fuel in the session, but removed it in #115293
So, with this comment, should we remove the counter from Session while not making this feature broken when running multiple sessions in the same process?
Perhaps we should just warn against enabling incr comp when optimization fuel is used?
Thanks, this makes sense. I'll also add a warning when -Zmir-opt-bisect-limit is used together with incremental compilation.
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.
should we remove the counter from Session while not making this feature broken when running multiple sessions in the same process?
If so, I would like to know some possible ways to achieve it.
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.
It should definitively not be a static. Putting it in the Session breaks incr comp, but I don't think there is any easy way around that.
This reverts commit f9621f3.
closes: #150910
Enable bisecting MIR optimization passes to enhance debuggability.
discussions on zulip: https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/MIR.20dump.20the.20pass.20names/with/573219207
Check it works
Sample code
Output
r? @saethlin