-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
typeck in parallel #113519
typeck in parallel #113519
Conversation
Because |
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 same function iterates over modules serially. Should those call some par_for_each_module
method?
Probably to be decided by looking at profiles.
// FIXME: Parallelize other iterators(e.g. `body_owners` in `check_unused`) instead | ||
// when we implement creating `DefId`s for anon constants during their parents' typeck. | ||
// Since doing so will produce query cycle errors at current. | ||
if cfg!(parallel_compiler) { |
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'm not sure we should have different logic for serial vs parallel compiler.
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.
Actually it doesn't change the logic, because check_unused
will call all typeck
and fetch the used_trait_impl
information in the results. I moved this part into check_unused
to make it look more reasonable.
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 code really belongs in check_crate
, and not in check_unused
. My suggestion was just to remove the if cfg!(parallel_compiler)
, and run this unconditionally.
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 reverts part of #108118. I agree this is reasonable.
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 removed cfg!(parallel_compiler)
and currented some ui tests, since the order of errors during typeck is changed
@@ -494,6 +494,18 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> { | |||
tcx.hir().for_each_module(|module| tcx.ensure().check_mod_item_types(module)) | |||
}); | |||
|
|||
// FIXME: Parallelize other iterators(e.g. `body_owners` in `check_unused`) instead |
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 understand this sentence. Should the FIXME be in `check_unused?
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.
Yea, I moved this part into check_unused
to make it look more reasonable.
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 just add a FIXME above check_unused
now
Thanks for reviewing! If you mean |
b746d7a
to
a88a4fb
Compare
This comment has been minimized.
This comment has been minimized.
a88a4fb
to
47a2662
Compare
47a2662
to
983b4ae
Compare
983b4ae
to
692e5d9
Compare
I don't understand why the clippy test failed suddenly when I fixed the comment |
This comment has been minimized.
This comment has been minimized.
That's a spurious CI bug that I am looking into. |
692e5d9
to
50896c1
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 50896c1 with merge 96389d030446cf91feda468c7b2c7a10ff67e35b... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (96389d030446cf91feda468c7b2c7a10ff67e35b): comparison URL. Overall result: no relevant changes - no 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. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. 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.
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: 656.645s -> 656.709s (0.01%) |
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (7d60819): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. 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.
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: 659.456s -> 656.192s (-0.49%) |
#108118 caused
typeck
to be transferred to the serial part (check_unused
), which made the performance of parallel rustc significantly reduced.This pr re-parallelize this part, which increases the average performance improvement of parallel rustc in
full
andincr-full
scenarios from 14.4% to 23.2%.r? @cjgillot
cc @oli-obk @Zoxc