-
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
Ensure value is on the on-disk cache before returning from ensure()
.
#108820
Conversation
r? @TaKO8Ki (rustbot has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit add6a8420e4f417e4c82d159d91669eb053bb8a1 with merge 089156c8708f6aa6054e63459ce1726976130c3a... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (089156c8708f6aa6054e63459ce1726976130c3a): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking 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 a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit d71f87699257e1483f1058cb010c12b9c9c2e204 with merge c6f196f3b9487da4c5134007caf9c459ccea2f3e... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (c6f196f3b9487da4c5134007caf9c459ccea2f3e): comparison URL. Overall result: no relevant changes - no action neededBenchmarking 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. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
|
/// | ||
/// This version verifies that the computed result exists in the cache before returning. | ||
#[inline(always)] | ||
pub fn ensure_with_value(self) -> TyCtxtEnsureWithValue<'tcx> { |
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.
What do you think about flipping the defaults just to nudge people in the right direction? So renaming ensure
to ensure_without_checking_incremental_cache
and renaming ensure_with_value
to ensure
.
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.
There are currently 126 uses of ensure()
in the codebase, and only <13 have a link with stealing a query result.
Most of them are in rustc_hir_analysis and rustc_interface as ways to drive analysis.
I can rename both to ensure_unchanged
(current behaviour, to drive analyses) and ensure_with_value
(new behaviour, for steal
) to make everything explicit.
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.
oof that's gonna be very verbose...
let's land this and I'll think about it a bit more
7df1ad6
to
e955ec0
Compare
@bors r=oli-obk |
☀️ Test successful - checks-actions |
Finished benchmarking commit (f41927f): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesThis benchmark run did not return any relevant results for this metric. |
The current logic for
ensure()
a query just checks that the node is green in the dependency graph.However, a lot of places use
ensure()
to prevent the query from being called later. This is the case before stealing a query result.If the query is actually green but the value is not available in the on-disk cache,
ensure
would return, but a subsequent call to the full query would run the code, and attempt to read from a stolen value.This PR conforms the query system to the usage by checking whether the queried value is loadable from disk before returning.
Sadly, I can't manage to craft a proper test...
Should fix all instances of "attempted to read from stolen value".