Skip to content
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

Merged
merged 1 commit into from
Jun 27, 2022

Conversation

SparrowLii
Copy link
Member

@SparrowLii SparrowLii commented May 23, 2022

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 each item's check result via catch_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 in config.toml:

    [ui] src/test\ui\associated-types\defaults-cyclic-fail-1.rs
    [ui] src/test\ui\associated-types\defaults-cyclic-fail-2.rs
    [ui] src/test\ui\associated-types\hr-associated-type-bound-2.rs
    [ui] src/test\ui\associated-types\impl-wf-cycle-1.rs
    [ui] src/test\ui\associated-types\impl-wf-cycle-2.rs
    [ui] src/test\ui\issues\issue-20413.rs
    [ui] src/test\ui\parallel_test\defaults-cyclic-fail-para.rs

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 23, 2022
@rust-highfive
Copy link
Collaborator

r? @estebank

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 23, 2022
@@ -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();
Copy link
Member

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.

Copy link
Member Author

@SparrowLii SparrowLii May 23, 2022

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.

@SparrowLii
Copy link
Member Author

related PR here: #68171. I think I can refer to it for a more complete fix.

@lqd
Copy link
Member

lqd commented May 24, 2022

@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)

@SparrowLii
Copy link
Member Author

SparrowLii commented May 24, 2022

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.

@estebank
Copy link
Contributor

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 24, 2022
@bors
Copy link
Contributor

bors commented May 24, 2022

⌛ Trying commit 17483adc0ac961d5feba244218ffee7a9968f538 with merge e94ecbb4ae5fb516fe84f4b81e08b1faa86a3800...

@bors
Copy link
Contributor

bors commented May 24, 2022

☀️ Try build successful - checks-actions
Build commit: e94ecbb4ae5fb516fe84f4b81e08b1faa86a3800 (e94ecbb4ae5fb516fe84f4b81e08b1faa86a3800)

@rust-timer
Copy link
Collaborator

Queued e94ecbb4ae5fb516fe84f4b81e08b1faa86a3800 with parent ee9726c, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e94ecbb4ae5fb516fe84f4b81e08b1faa86a3800): comparison url.

Instruction count

  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 🎉 relevant improvements found
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 0 0 0 3 0
mean2 N/A N/A N/A -1.1% N/A
max N/A N/A N/A -1.1% N/A

Max RSS (memory usage)

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: mixed results
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 0 1 0 1 0
mean2 N/A 2.2% N/A -1.1% N/A
max N/A 2.2% N/A -1.1% N/A

Cycles

This 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
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

Footnotes

  1. number of relevant changes 2

  2. the arithmetic mean of the percent change 2

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 24, 2022
@SparrowLii SparrowLii marked this pull request as draft June 27, 2022 07:50
@SparrowLii SparrowLii marked this pull request as ready for review June 27, 2022 08:40
@cjgillot
Copy link
Contributor

Let's merge this as is, and we'll optimize if the need arises.
@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented Jun 27, 2022

📌 Commit ec137f2 has been approved by cjgillot

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 27, 2022
@bors
Copy link
Contributor

bors commented Jun 27, 2022

⌛ Testing commit ec137f2 with merge 2f3ddd9...

@bors
Copy link
Contributor

bors commented Jun 27, 2022

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 2f3ddd9 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 27, 2022
@bors bors merged commit 2f3ddd9 into rust-lang:master Jun 27, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jun 27, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2f3ddd9): comparison url.

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 😿 relevant regressions found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
4.2% 6.3% 2
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) N/A N/A 0

Cycles

This 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

  1. the arithmetic mean of the percent change

  2. number of relevant changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants