-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Querify MonoItem collection #132566
Querify MonoItem collection #132566
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
33b7f29
to
785a96b
Compare
Querify mir collection Factored out of rust-lang#131650, these changes are required for post-mono MIR opts but I want to benchmark them on their own so that I can tune the implementation. r? ghost
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
785a96b
to
7155c30
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…try> Querify mir collection Factored out of rust-lang#131650, these changes are required for post-mono MIR opts but I want to benchmark them on their own so that I can tune the implementation. r? ghost
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (292dbc9): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -7.7%, secondary -5.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary -11.4%, secondary -24.6%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 780.261s -> 782.209s (0.25%) |
7155c30
to
1add34f
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…try> Querify mir collection Factored out of rust-lang#131650, these changes are required for post-mono MIR opts but I want to benchmark them on their own so that I can tune the implementation. r? ghost
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #132843) made this pull request unmergeable. Please resolve the merge conflicts. |
054fbd5
to
f6e913b
Compare
Thanks! |
…jgillot Querify MonoItem collection Factored out of rust-lang#131650. These changes are required for post-mono MIR opts, because the previous implementation would load the MIR for every Instance that we traverse (as well as invoke queries on it). The cost of that would grow massively with post-mono MIR opts because we'll need to load new MIR for every Instance, instead of re-using the `optimized_mir` for every Instance with the same DefId. So the approach here is to add two new queries, `items_of_instance` and `size_estimate`, which contain the specific information about an Instance's MIR that MirUsedCollector and CGU partitioning need, respectively. Caching these significantly increases the size of the query cache, but that's justified by our improved incrementality (I'm sure walking all the MIR for a huge crate scales quite poorly). This also changes `MonoItems` into a type that will retain the traversal order (otherwise we perturb a bunch of diagnostics), and will also eliminate duplicate findings. Eliminating duplicates removes about a quarter of the query cache size growth. The perf improvements in this PR are inflated because rustc-perf uses `-Zincremental-verify-ich`, which makes loading MIR a lot slower because MIR contains a lot of Spans and computing the stable hash of a Span is slow. And the primary goal of this PR is to load less MIR. Some squinting at `collector profile_local perf-record +stage1` runs suggests the magnitude of the improvements in this PR would be decreased by between a third and a half if that flag weren't being used. Though this effect may apply to the regressions too since most are incr-full and this change also causes such builds to encode more Spans.
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
@bors retry msvc debuginfo issue |
☀️ Test successful - checks-actions |
Finished benchmarking commit (ee4a56e): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowOur benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -7.9%, secondary -4.7%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary -11.7%, secondary -18.6%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 788.926s -> 789.102s (0.02%) |
…lly, r=<try> Querify should_codegen_locally I think this has a very strong interaction with rust-lang#132566, and may not be justifiable without that PR, so marking this as blocked until that is merged.
Visiting for weekly perf triage
@rustbot label: +perf-regression-triaged |
…lly, r=<try> Querify should_codegen_locally I think this has a very strong interaction with rust-lang#132566, and may not be justifiable without that PR, so marking this as blocked until that is merged.
Factored out of #131650. These changes are required for post-mono MIR opts, because the previous implementation would load the MIR for every Instance that we traverse (as well as invoke queries on it). The cost of that would grow massively with post-mono MIR opts because we'll need to load new MIR for every Instance, instead of re-using the
optimized_mir
for every Instance with the same DefId.So the approach here is to add two new queries,
items_of_instance
andsize_estimate
, which contain the specific information about an Instance's MIR that MirUsedCollector and CGU partitioning need, respectively. Caching these significantly increases the size of the query cache, but that's justified by our improved incrementality (I'm sure walking all the MIR for a huge crate scales quite poorly).This also changes
MonoItems
into a type that will retain the traversal order (otherwise we perturb a bunch of diagnostics), and will also eliminate duplicate findings. Eliminating duplicates removes about a quarter of the query cache size growth.The perf improvements in this PR are inflated because rustc-perf uses
-Zincremental-verify-ich
, which makes loading MIR a lot slower because MIR contains a lot of Spans and computing the stable hash of a Span is slow. And the primary goal of this PR is to load less MIR. Some squinting atcollector profile_local perf-record +stage1
runs suggests the magnitude of the improvements in this PR would be decreased by between a third and a half if that flag weren't being used. Though this effect may apply to the regressions too since most are incr-full and this change also causes such builds to encode more Spans.