-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
get rid of tcx
in deadlock handler when parallel compilation
#98570
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
Thanks @SparrowLii. That's a great solution. |
Sure, made the corresponding changes. #[Edit] It's a bit difficult to remove it from the |
This comment has been minimized.
This comment has been minimized.
Umm.. seems that Just reverted the last change |
compiler/rustc_query_impl/src/lib.rs
Outdated
@@ -26,7 +26,7 @@ use rustc_span::Span; | |||
#[macro_use] | |||
mod plumbing; | |||
pub use plumbing::QueryCtxt; | |||
use rustc_query_system::query::*; | |||
pub use rustc_query_system::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.
Why is this pub
required?
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 need to use try_collect_active_jobs
and deadlock
in rustc_interface::util::handle_deadlock
. We can add pub use rustc_query_system::query::{deadlock, QueryContext}
instead of pub the all thing here.
@bors r+ rollup=never |
📌 Commit fbca21e has been approved by |
If you're going to do significant work in An alternative way to fix #94654 would be to extend |
☀️ Test successful - checks-actions |
Finished benchmarking commit (8c52a83): comparison url. Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
This is a very obscure and hard-to-trace problem that affects thread scheduling. If we copy
tcx
to the deadlock handler thread, it will perform unpredictable behavior and cause very weird problems when executingtry_collect_active_jobs
(For example, the deadlock handler thread suddenly preempts the content of the blocked worker thread and executes the unknown judgment branch, like #94654).Fortunately we can avoid this behavior by precomputing
query_map
. This change fixes the following ui tests failure on my environment when setparallel-compiler = true
:Updates #75760
Fixes #94654