-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
base: master
Are you sure you want to change the base?
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.
Finished benchmarking commit (381511a): 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.8%, secondary -5.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.
CyclesResults (primary -11.0%, secondary -22.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.005s -> 780.627s (0.08%) |
Awesome results! ~10-15% icount reduction on debug cargo builds is an incredible improvement. It does seem to grow the query cache/depgraph metadata on disk by 10-20%, but that is IMO acceptable for such a large incremental win. |
1add34f
to
501c099
Compare
This comment has been minimized.
This comment has been minimized.
501c099
to
da167a0
Compare
da167a0
to
ca0ebaa
Compare
r? compiler |
|
||
fn extend(&mut self, iter: impl IntoIterator<Item = Spanned<MonoItem<'tcx>>>) { | ||
for item in iter { | ||
self.push(item.clone()); |
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.
clone
is useless (item is Copy
anyway)
The job Click to see the possible cause of the failure (guessed by this bot)
|
Ouch. Not sure what to do about that now that the item needs to live in a different crate. |
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.