-
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
Fully serialize AdtDef #91924
Fully serialize AdtDef #91924
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 7f7ed6bdec7b4413223ec7b615ca4150c0ed97a6 with merge d3a40c62879ad9441b6cb79f94c654d32481cd91... |
☀️ Try build successful - checks-actions |
Queued d3a40c62879ad9441b6cb79f94c654d32481cd91 with parent 404c847, future comparison URL. |
Finished benchmarking commit (d3a40c62879ad9441b6cb79f94c654d32481cd91): comparison url. Summary: This change led to very large relevant mixed results 🤷 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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 led 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 |
Surprisingly, this appears to be a net win for disk usage (at least on the few benchmarks I checked). The increase in the query cache size is less than the decrease in the the size of the dep graph (as there are thousands of fewer query executions being performed). |
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 mark adt_def
with cache_on_disk_if { true }
for it to benefit from this serialization?
@@ -117,7 +117,7 @@ impl PartialEq for AdtDef { | |||
// `AdtDef`s are always interned, and this is part of `TyS` equality. | |||
#[inline] | |||
fn eq(&self, other: &Self) -> bool { | |||
ptr::eq(self, other) | |||
self.did == other.did |
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.
Why can't we keep the pointer equality here?
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.
Using pointer equality breaks compilation of stage1 libc: I get errors like:
error[E0308]: mismatched types
--> /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.65/src/int/specialized_div_rem/mod.rs:125:12
|
125 | if let Some(quo) = duo.checked_div(div) {
| ^^^^^^^^^ -------------------- this expression has type `Option<u64>`
| |
| expected enum `Option`, found a different enum `Option`
|
= note: expected enum `Option<u64>`
found enum `Option<_>`
I believe we need a 'normal' PartialEq
impl in order for interning to work properly, and we need interning because current code is relying on pointers to an AdtDef
being unique (since they all currently get allocated through a query).
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 believe we need a 'normal' PartialEq impl in order for interning to work properly
if you have the time, could you try a perf run which only removes the Hash
and Eq
impl and does not touch any queries? Would be great to test that before merging this PR
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 opened #92040 for a perf run with just Hash
and PartialEq
changed
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.
Looking at the perf results, it seems that the performance impact is acceptable.
This avoids needing to invoke the `adt_def` query during the decoding of another query's result.
7f7ed6b
to
70fba90
Compare
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 70fba90 with merge e89932a1d84ef4783a5137927a85447161a9fbb8... |
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
Finished benchmarking commit (017ff4233fce7f99092ad20a3e1be45bf3d8e08a): comparison url. Summary: This change led to very large relevant mixed results 🤷 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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 led 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 |
Caching the |
A significant number of people have been hitting the incremental compilation bug that promoted this PR. I'd like to get this merged soon, so that we can unblock the fix in #91919 The only significant regression is |
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 looks good to me. The regression in webrender is not ideal, but many other benchmarks are improved. The more important thing is that we unblock #91919 though.
@@ -117,7 +117,7 @@ impl PartialEq for AdtDef { | |||
// `AdtDef`s are always interned, and this is part of `TyS` equality. | |||
#[inline] | |||
fn eq(&self, other: &Self) -> bool { | |||
ptr::eq(self, other) | |||
self.did == other.did |
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.
Looking at the perf results, it seems that the performance impact is acceptable.
@bors r+ |
📌 Commit 00ce6dc has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (84f962a): comparison url. Summary: This change led to very large relevant mixed results 🤷 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression |
This avoids needing to invoke the
adt_def
query duringthe decoding of another query's result.
Split out from #91919
See #91696 (comment)