-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Don't rerun goals if none of their vars have changed #141500
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
Conversation
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
perf perf PERF (to the tune of teeth teeth TEETH) @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
[PERF] Don't rerun goals if none of their vars have changed r? `@ghost` Alternative to #141488. I'm pretty sure that we don't need to re-run the goal at all if the inputs don't change... 🤔
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (4c02404): 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 0.8%, 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 (secondary -5.4%)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: 777.23s -> 776.477s (-0.10%) |
2d718c1
to
ca34794
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
[PERF] Don't rerun goals if none of their vars have changed r? `@ghost` Alternative to #141488. I'm pretty sure that we don't need to re-run the goal at all if the inputs don't change... 🤔
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (7e9d4c6): 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 0.8%, secondary -3.3%)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 (secondary -0.1%)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: 775.592s -> 776.167s (0.07%) |
@@ -24,6 +24,12 @@ pub struct OpaqueTypeStorageEntries { | |||
duplicate_entries: usize, | |||
} | |||
|
|||
impl rustc_type_ir::inherent::OpaqueTypeStorageEntries for OpaqueTypeStorageEntries { | |||
fn needs_reevaluation(self, canonicalized: usize) -> bool { |
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.
ew but also i dont think we need a better API For now.
@@ -53,10 +53,10 @@ where | |||
{ | |||
/// Canonicalizes the goal remembering the original values | |||
/// for each bound variable. | |||
pub(super) fn canonicalize_goal<T: TypeFoldable<I>>( | |||
pub(super) fn canonicalize_goal( |
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.
didnt need to be this generic :>
( | ||
Certainty::Yes, | ||
NestedNormalizationGoals( | ||
goals.into_iter().map(|(s, g, _)| (s, g)).collect(), |
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.
we could actually canonicalize these keys i think, which may prevent a rerun in the parent query
@@ -660,6 +733,8 @@ where | |||
// looking at the "has changed" return from evaluate_goal, | |||
// because we expect the `unconstrained_rhs` part of the predicate | |||
// to have changed -- that means we actually normalized successfully! | |||
// FIXME: Do we need to eagerly resolve here? Or should we check | |||
// if the cache key has any changed vars? | |||
let with_resolved_vars = self.resolve_vars_if_possible(goal); |
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 resolve call feels strange -- we should probably be checking if any of the vars changed at all?
Minor improvement in syn. Some of the non new-solver scenarios are back to neutral; not sure what to make of those, but whatever. I think this is fine to be reviewed now. |
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.
👍
naming-wise I am not totally happy yet 🤔 CanonicalGoalCacheKey
seems somewhat... misleading/unhelpful
GoalStalledOn
maybe? also, add a comment to that struct :3
) -> ( | ||
Result<(HasChanged, Certainty), NoSolution>, | ||
Result<(HasChanged, Certainty, CanonicalGoalCacheKey<Self::Interner>), NoSolution>, |
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.
can you move (HasChanged, Certainty, CanonicalGoalCacheKey<Self::Interner>)
into a struct.
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.
Unlike the one below, this one actually does clean up a lot 👍
@@ -115,7 +116,7 @@ where | |||
|
|||
pub(super) search_graph: &'a mut SearchGraph<D>, | |||
|
|||
nested_goals: Vec<(GoalSource, Goal<I, I::Predicate>)>, | |||
nested_goals: Vec<(GoalSource, Goal<I, I::Predicate>, Option<CanonicalGoalCacheKey<I>>)>, |
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.
same with this tuple
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.
For a single use? I don't really feel like that's really beneficial. Notably, this isn't the same tuple of (Goal, Option<CacheKey>)
that's stored in the fulfillment context.
fec620e
to
21ba021
Compare
I introduced a new Threw another random commit into the PR (5893b58) b/c I didn't want to open a totally separate PR for just a one liner. |
5893b58
to
24a77c5
Compare
… new solver is more complete Just a totally unrelated nitpick I'm folding into the PR, since it's code I'd like for us to prune when the new solver lands.
24a77c5
to
f0bcb0e
Compare
@bors r=lcnr |
@bors rollup=never |
f0bcb0e
to
e2215a8
Compare
@bors r=lcnr |
🌲 The tree is currently closed for pull requests below priority 10. This pull request will be tested once the tree is reopened. |
add additional `TypeFlags` fast paths Some crates, e.g. `diesel`, have items with a lot of where-clauses (more than 150). In these cases checking the `TypeFlags` of the whole `param_env` can be very beneficial. This adds `fn fold_clauses` to mirror the existing `fn visit_clauses` and then uses this in folders which fold `ParamEnv`s. Split out from #141451, depends on #141500. r? `@compiler-errors`
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 9c0bcb5 (parent) -> 40d2563 (this PR) Test differencesShow 2 test diffs2 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 40d2563ea200f9327a8cb8b99a0fb82f75a7365c --output-dir test-dashboard And then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
Finished benchmarking commit (40d2563): comparison URL. Overall result: ✅ improvements - no action needed@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 -0.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 (secondary -9.1%)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: 777.056s -> 778.13s (0.14%) |
r? @ghost
Alternative to #141488. I'm pretty sure that we don't need to re-run the goal at all if the inputs don't change... 🤔