-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Optimize try_mark_green and eliminate the lock on dep node colors #57065
Conversation
@bors try |
⌛ Trying commit 84aa34d621f10826957bb64c08699307a3f69fc3 with merge 2897f68c5b419b38ac5e1a32910abe9112ea8a3c... |
☀️ Test successful - status-travis |
Nice @rust-timer build 2897f68c5b419b38ac5e1a32910abe9112ea8a3c |
@rust-timer build 2897f68c5b419b38ac5e1a32910abe9112ea8a3c |
Success: Queued 2897f68c5b419b38ac5e1a32910abe9112ea8a3c with parent fa922ab, comparison URL. |
Finished benchmarking try commit 2897f68c5b419b38ac5e1a32910abe9112ea8a3c |
This is another case where measuring with parallel queries would be useful... |
@michaelwoerister Benchmarks on x86 won't be useful, since the atomic operations lowers to regular load/stores, so this literally just removes the lock on dep node colors. |
I know but that lock can only be really expensive with parallel queries because of contention, right? |
☔ The latest upstream changes (presumably #57607) made this pull request unmergeable. Please resolve the merge conflicts. |
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.
It would have been nice to have a performance comparison for the multi-threaded case but that's complicated and not really worth the effort. The changes already show a small win in single-threaded mode and it can only improve the situation with parallel queries, so let's go ahead and merge.
r=me with the nits addressed.
Great work, @Zoxc!
|
||
debug_assert!(data.colors.borrow().get(prev_dep_node_index).is_none()); | ||
fn try_mark_previous_green<'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.
Could you add a doc comment here? Something like "Try to mark a dep-node green for which we already know that it existed in the previous compilation session".
src/librustc/dep_graph/graph.rs
Outdated
|
||
// We never try to mark inputs as green | ||
// FIXME: Make an debug_assert! | ||
assert!(!dep_node.kind.is_input()); |
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 already do the debug assertion a few lines above. You can just remove this one (and move the comment up).
src/librustc/dep_graph/graph.rs
Outdated
// This DepNode and the corresponding query invocation existed | ||
// in the previous compilation session too, so we can try to | ||
// mark it as green by recursively marking all of its | ||
// dependencies green. |
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.
Could you move this comment into the None
branch of the match
below?
@bors r=michaelwoerister |
📌 Commit 1313678 has been approved by |
Optimize try_mark_green and eliminate the lock on dep node colors Blocked on rust-lang#56614 r? @michaelwoerister
Rollup of 6 pull requests Successful merges: - #56884 (rustdoc: overhaul code block lexing errors) - #57065 (Optimize try_mark_green and eliminate the lock on dep node colors) - #57107 (Add a regression test for mutating a non-mut #[thread_local]) - #57268 (Add a target option "merge-functions", and a corresponding -Z flag (works around #57356)) - #57551 (resolve: Add a test for issue #57539) - #57598 (Add missing unpretty option help message) Failed merges: r? @ghost
Optimize try_mark_green and eliminate the lock on dep node colors Blocked on rust-lang#56614 r? @michaelwoerister
Optimize try_mark_green and eliminate the lock on dep node colors Blocked on rust-lang#56614 r? @michaelwoerister
Optimize try_mark_green and eliminate the lock on dep node colors Blocked on rust-lang#56614 r? @michaelwoerister
Optimize try_mark_green and eliminate the lock on dep node colors Blocked on #56614 r? @michaelwoerister
☀️ Test successful - checks-travis, status-appveyor |
Blocked on #56614
r? @michaelwoerister