-
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
[WIP] make nightly compilers able to parallelize #101566
Conversation
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 9201feb16c93bd27499fb0625495e7f6bf447bfd with merge 49d1d103e085e772150709059f0bbb75c5a37a89... |
#[cfg(not(parallel_compiler))] | ||
static mut SHARED: bool = false; | ||
#[cfg(parallel_compiler)] | ||
static mut SHARED: bool = true; |
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 use the unstable SyncUnsafeCell<T>
instead of static mut
for both versions? This would be a great place to test it out.
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.
Thanks, will try it!
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.
is it ever mutated ?
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.
not for now, but I think we should change it based on -Z threads=n
option in a early stage of compilation
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 use SyncUnsafeCell<T>
now
static THREADS_COUNTER: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0); | ||
|
||
fn next() -> u32 { | ||
THREADS_COUNTER.fetch_add(1, SeqCst) |
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 can be Relaxed
instead
☀️ Try build successful - checks-actions |
Queued 49d1d103e085e772150709059f0bbb75c5a37a89 with parent 44adfcc, future comparison URL. |
Finished benchmarking commit (49d1d103e085e772150709059f0bbb75c5a37a89): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking 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 a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
Footnotes |
Well, the refactored implementation of
We only need to decide whether |
If I'm not mistaken, the proposed code is using some sort of higher-kinded type (HKT) feature. The generic associated type feature is close to being |
Let me try if we can solve the above mentioned problem with GAT. |
The pattern can be achieved with GATs: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=c087b818a1f98c23bf6df235c193e9cf |
9201feb
to
0ecf80c
Compare
Since std::sync::Mutex was optimized not long ago, let's try using it first |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 0ecf80ccd388abf402c417ffad6ce2cafd864bed with merge d7be50832a0dcadf25609eb8b25f87da3e05dbb3... |
☀️ Try build successful - checks-actions |
Queued d7be50832a0dcadf25609eb8b25f87da3e05dbb3 with parent e6ce562, future comparison URL. |
Finished benchmarking commit (d7be50832a0dcadf25609eb8b25f87da3e05dbb3): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking 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 a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
Footnotes |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit f925ea0 with merge da328d6533d0dfe64e6cfd676472a6b2057b2aa9... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (da328d6533d0dfe64e6cfd676472a6b2057b2aa9): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking 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 a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
|
Introduce `DynSend` and `DynSync` auto trait for parallel compiler part of parallel-rustc rust-lang#101566 This PR introduces `DynSend / DynSync` trait and `FromDyn / IntoDyn` structure in rustc_data_structure::marker. `FromDyn` can dynamically check data structures for thread safety when switching to parallel environments (such as calling `par_for_each_in`). This happens only when `-Z threads > 1` so it doesn't affect single-threaded mode's compile efficiency. r? `@cjgillot`
(1) Switch serial/parallel at runtime(refactor With methods above, under 8 threads, |
We have solved perf problem under multi-threads at current, and will finish the work under single thread this month. |
#117435 has enabled parallel rustc on nightly. |
Yea, we should close this now |
Try to complete the work of #59667. Refactor data structures such as
Lock
to make parallel compilation available while minimizing regressions and remaining thread safety.