-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Try mark no_hash queries as green after execution
#150156
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
base: main
Are you sure you want to change the base?
Conversation
|
rustbot has assigned @petrochenkov. Use |
|
My first idea was to add a special "locked" color, but I wasn't sure what was even happening in there because coloring races currently are considered to be normal anyway. |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Allow green-red query coloring race
This comment has been minimized.
This comment has been minimized.
|
I ran rustc incremental builds as described in reproduction steps section for several hours with |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (bb5a19e): comparison URL. Overall result: ❌ regressions - please read the text belowBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -3.5%, secondary -1.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 3.0%, secondary 3.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 479.055s -> 481.828s (0.58%) |
|
As usual, it would be nice to split the work into a few parts (especially given the perf regressions):
But it may be better to wait for a high level design review from Zoxc or cjgillot before doing that. @rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
Could you elaborate how this can happen? Key reconstructibility is not supposed to change. I agree with @petrochenkov's suggestion to split pure reactors from the actual change. Parallelism and atomic are hard enough to make review as easy as possible. |
3 similar comments
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
When some thread fails to mark some node green, it won't immediately mark that node red. It will try force the deepest possible node it can (aka one with the reconstructible key). While you are forcing a parent of that node you will execute that problematic child query you were unable to mark green (due to red dependencies) or force directly (due to unreconstructible key). That problematic query node could be marked as green if its computed result didn't change. But meanwhile another thread may try mark that parent node green as well too and so could now succeed, even tho the first thread is executing that query and will try mark it red if that query has rust/compiler/rustc_query_system/src/dep_graph/graph.rs Lines 739 to 742 in b115ea2
But I suggest that's not really true. If And yes, |
0b6923b to
2fe32a3
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
no_hash queries as green after execution
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Try mark `no_hash` queries as green after execution
|
Seems like no node coloring race is required after all. |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (4b1294d): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 473.958s -> 475.113s (0.24%) |
|
@rustbot ready |
| // This is a red node: it existed in the previous compilation, its query | ||
| // was re-executed, but it has a different result from before. | ||
| #[cfg(debug_assertions)] | ||
| if !feed && !cx.is_eval_always(key.kind) { |
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.
| if !feed && !cx.is_eval_always(key.kind) { | |
| if cfg!(debug_assertions) && !feed && !cx.is_eval_always(key.kind) { |
Nit: so the code is at least type checked in all build modes.
|
(Leaving this to @cjgillot to review.) |
Fixes #150018
Fixes #142778
Fixes #141540
This PR allows parallel front-end's green-red node coloring processes in the query dep graph to race.Recall that whenever one thread tries to mark query node green and then fails to reconstruct a subquery's key to force it, parent query is tried to be forced or executed too. The subquery could be marked green by the thread during execution the parent query because key is now present. Other thread during this process is able to mark green parent query itself. And so after some time the first thread finishes the execution and finds in its place a green node. This is bad forno_hashqueries since those are conservatively presumed to be red but actually queries must be deterministic anyway and sono_hashnodes should be colored green if its deps are green too after its execution finishes.As such we can consider green color to be "stronger" that the red color and thus former would replace the latter.TODO: update rustc-dev-guide query docs and rustc comments on
no_hashmodifierI have left some refactor-ish changes I did during my dirty debugging. Let me know if you would want those to be redone or removed.Steps to reproduce
Quote from #150018, more details there: