-
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
catch unwind in parallel mode during wfcheck #97307
Conversation
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
@@ -339,7 +339,10 @@ cfg_if! { | |||
t: T, | |||
for_each: impl Fn(T::Item) + Sync + Send, | |||
) { | |||
t.into_par_iter().for_each(for_each) | |||
let ps: Vec<_> = t.into_par_iter().map(|i| catch_unwind(AssertUnwindSafe(|| for_each(i)))).collect(); |
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.
Does rayon support .collect::<Result<Vec<()>, Box<dyn Any + Send>>()
? That would be faster than iterating over all elements to check if any is Err
I think.
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 indeed need to iterate over all elements, not just know if any of them is Err
. Because the err message will be output during the iteration. This is relatively consistent with the behavior in serial mode.
related PR here: #68171. I think I can refer to it for a more complete fix. |
@SparrowLii Does this PR fix the ICEs when using the parallel compiler with more than one thread ? (I would expect not, but you never know) |
I don't think this PR will solve any ICE issues, it just solves the inconsistency of parallel and non-parallel output in some scenarios. |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 17483adc0ac961d5feba244218ffee7a9968f538 with merge e94ecbb4ae5fb516fe84f4b81e08b1faa86a3800... |
☀️ Try build successful - checks-actions |
Queued e94ecbb4ae5fb516fe84f4b81e08b1faa86a3800 with parent ee9726c, future comparison URL. |
Finished benchmarking commit (e94ecbb4ae5fb516fe84f4b81e08b1faa86a3800): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesThis benchmark run did not return any relevant results for this metric. 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. @bors rollup=never Footnotes |
Let's merge this as is, and we'll optimize if the need arises. |
📌 Commit ec137f2 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (2f3ddd9): comparison url. Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results
CyclesThis benchmark run did not return any relevant results for this metric. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
Update #75760
When performing wfcheck, from the test results, the parallel mode will stop all checks when an
item
's check failed, (e.g. the first ui test failure raised from here)while the serial mode will output eachitem
's check result viacatch_unwind
. This leads to inconsistencies in the final output of the two mode.In my local environment, this modification prevents the following ui tests from failing when set
parallel-compiler = true
inconfig.toml
: