Collect statistics about MIR optimizations#76769
Collect statistics about MIR optimizations#76769tmiasko wants to merge 1 commit intorust-lang:masterfrom
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
This should be part of Session or TyCtxt. There may be multiple rustc sessions running in a single process. (for example when using RLS)
There was a problem hiding this comment.
I experimented with different implementation approaches:
- Statistics definitions are in the context together with their values.
- Statistics definitions are in MIR passes, their values are stored in the context.
- Statistics definitions and values are stored together with MIR passes.
I strongly prefer variants that put statistics definitions together with MIR passes that uses them. In that approach, adding and removing counters is trivial, additionally any unused counters are detected as such during compilation.
Values can be stored in the context if we want to support multiple rustc sessions in a single process, although it requires passing context to all those places where counters are used. But is there any real use-case? Why would you use rustc with debug-assertions and MIR optimizations counters inside the RLS?
There was a problem hiding this comment.
I agree with @bjorn3. We've tried pretty hard to move these sorts of things into Session and TyCtxt to allow running multiple sessions in the same process (both for RLS and eventually for one rustc process compiling multiple crates simultaneously).
Since this is essentially unstable, diagnostic data and doesn't effect the compilation artifacts, it may be worth bending that rule because, as you point out, having the counters defined in their MIR passes is quite nice. I don't personally feel comfortable approving that since this is a cross-cutting concern for the compiler as a whole and there may be others on the compiler team that have strong opinions about breaking that rule.
|
r? @wesleywiser |
b0a81f4 to
9996642
Compare
|
☔ The latest upstream changes (presumably #76659) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels: |
63abbc7 to
511d534
Compare
|
☔ The latest upstream changes (presumably #77430) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels: |
|
@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author |
b5d9534 to
a2293bf
Compare
|
☔ The latest upstream changes (presumably #77796) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels: |
a2293bf to
c833057
Compare
|
☔ The latest upstream changes (presumably #77373) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels: |
For example -Zmir-opt-level=3 -Zmir-opt-stats: