-
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
Move DepKind and query TLS to rustc_query_system #86038
Conversation
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 84a156cb46350ea4ca35884c4a910b62343f0677 with merge b1ce53c0cc21a9301621cb4076f77bf3ec601d7b... |
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
Queued b1ce53c0cc21a9301621cb4076f77bf3ec601d7b with parent 9104c89, future comparison URL. |
Finished benchmarking try commit (b1ce53c0cc21a9301621cb4076f77bf3ec601d7b): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
31% diesel-doc regression is red herring: #85993 (comment) |
@@ -28,12 +28,6 @@ pub struct ImplicitCtxt<'a> { | |||
task_deps: Option<&'a Lock<TaskDeps>>, |
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 these Option
s be removed and instead clear the ImplicitContext
in the tls when they would be None
?
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.
I don't think so. The implicitctxt is still required to detect cycles and to print query stack even when the dependencies are ignored.
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.
And the other fields? At least one can be made non-optional, right? I don't see what the difference between no implicitctxt and an empty implicitctxt would be.
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.
Indeed, query should not need to be an option.
a5bfc56
to
a91b82e
Compare
Ping from triage: |
triage: Is this PR experimental? If so, you can replace |
I finally got back to this PR. In this new version, I stop moving the macros to rustc_query_system, and side with @Zoxc's suggestion to make The global pointer to @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 4387490 with merge 0794d7f4f502d8a0e9a4a71f7669e4adda756b81... |
☀️ Try build successful - checks-actions |
Queued 0794d7f4f502d8a0e9a4a71f7669e4adda756b81 with parent febce1f, future comparison URL. |
Finished benchmarking commit (0794d7f4f502d8a0e9a4a71f7669e4adda756b81): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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 Footnotes |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 8b8c12e with merge 8227b19194e5b9a2926d15786b99e6cc9f73389f... |
☀️ Try build successful - checks-actions |
Queued 8227b19194e5b9a2926d15786b99e6cc9f73389f with parent 878c783, future comparison URL. |
Finished benchmarking commit (8227b19194e5b9a2926d15786b99e6cc9f73389f): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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 Footnotes |
/// query. It is updated when | ||
/// executing a new query. | ||
#[derive(Clone, Default)] | ||
struct ImplicitCtxt<'a> { |
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.
You should keep the tcx
field as a *const ()
. That lets you move more of the tls
module intact and the parallel compiler doesn't regress. with_opt
can convert it back in rustc_middle
.
You'll want to add an assertion about GlobalCtxt
being Sync
too, since the type is now erased from ImplicitCtxt
.
// Extend the lifetime of the GlobalCtxt so the new thread can know of it. | ||
// The current thread will not free it, it is deadlocked. | ||
let tcx: &'static GlobalCtxt<'static> = | ||
tls::with(|tcx| &*(*tcx as *const GlobalCtxt<'_>).cast()); |
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 is incorrect since it's only set on one of Rayon's threads. The deadlock handler can be called on any thread. The current state of things is also broken to be fair.
We can not use the Rayon "Task Local Value" either, since the deadlock handler can also be called from a thread with no rustc task is running. My solution to this was to point all threads to a lock which holds the GlobalCtxt
when available. It was reverted in #74969.
Move TLS to rustc_query_system Revival of rust-lang#86038 r? `@ghost`
Move TLS to rustc_query_system Revival of rust-lang#86038 r? `@ghost`
Move TLS to rustc_query_system Revival of rust-lang#86038 r? `@ghost`
r? @ghost