-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Add parallel front end robustness test to ui tests #132051
base: master
Are you sure you want to change the base?
Conversation
r? @wesleywiser rustbot has assigned @wesleywiser. Use |
Some changes occurred in src/tools/compiletest cc @jieyouxu |
r? jieyouxu |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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 for the PR, this seems like a good improvement in test coverage for parallel front-end.
Could you please split the changes into at least two more-or-less atomic commits? I.e.
- Commit 1 implements compiletest changes.
- Commit 2 updates the tests.
As for the changes themselves, I noticed:
- Many tests don't have much context (no explanation about what they're trying to check, no brief summary, no backlinks to issues). Are these just basic smoke tests for parallel frontend? If it seems overkill to add such comments to the individual tests, could you leave a basic SUMMARY.md inside
tests/ui/parallel-frontend
to summarize the categories of tests and what issues they're intending to check? This is so that if anyone ever tries to debug why the tests failed/passed, they can have some clues as guidance. The summaries don't have to be super detailed, but even a brief sentence for test intention can go a long way.
Please also refer to individual review comments. If you have any questions about bootstrap/compiletest/general test infra, I might be able to help.
// Repeated testing due to instability in multithreaded environments. | ||
for _ in 0..50 { | ||
proc_res = self.compile_test(should_run, emit_metadata); | ||
self.check_no_compiler_crash(&proc_res, false); | ||
} |
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.
Question: this is going to be expensive as running 50 times involves not only spawning multiple processes, but also more expensive is the compiling itself. Do we have any local benchmarks to see how much longer the test will take w/ the extra 49 runs compared to just running once? I'm not suggesting we shouldn't do this -- we should -- but I would like to have more info on the impact of this on test time and then make an informed decision to accept the cost.
Context: I'm primarily thinking about some tests that might take a long time to compile, e.g. tests that have deep recursive types.
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 haven't found a good benchmark yet, from what I've observed so far these tests don't noticeably extend the test time though. I think we can keep this comment until we get more information later
tests/ui/parallel-rustc/cache-after-waiting-issue-111528.stderr
Outdated
Show resolved
Hide resolved
Thanks for the reviewing! I gonna make the changes soon |
c6c447c
to
1a125e5
Compare
Just resubmitted the commits. Since these tests are used to test ice problems such as deadlock, we don't actually care about the error messages output. I deleted all error output to simplify the function and review |
This comment has been minimized.
This comment has been minimized.
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, the other parts look fine, just one question
// Use a single thread for efficiency and a deterministic error message order | ||
rustc.arg("-Zthreads=1"); | ||
|
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.
Question: though if we no longer have the -Z threads=1
, would other non-parallel tests potentially become flaky? Or is the parallel front-end currently such that by default is only -Z threads=1
? Or rather, is that an intended feature (that we may discover some ui tests being flaky and thus expose bugs in current parallel rustc infra?)
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.
The thread of parallel front end is always 1 only if users pass -Zthreads=n
mannually. On the other hand, the user can easily break the limit by passing the -Z threads
option(Later option will reset the previous one, we may need to improve on this), so this code doesn't make much sense.
Defaulting the number of threads to be greater than 1 is intended but will not be implemented for a short time. When we do, I think we still don't need to manually limit -Z threads=1
in test suit, but change the it to fit the output of a multithreaded environment.
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.
The thread of parallel front end is always 1 only if users pass
-Zthreads=n
mannually. On the other hand, the user can easily break the limit by passing the-Z threads
option(Later option will reset the previous one, we may need to improve on this), so this code doesn't make much sense.
Sorry to clarify, you mean the number of threads used by parallel front end is only not 1 if the user overrides it, right?
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.
But that makes sense to me.
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, at the moment
//@ compile-flags: -Z threads=50 | ||
|
||
#![feature(generic_const_exprs)] | ||
//~^ WARNING |
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.
Nit: stray warning?
Also, we may want to open a #t-compiler thread (and maybe in libs/bootstrap) for awareness (esp. for reviewers) about parallel rustc tests and what to do if they ever encounter a related ICE. |
☔ The latest upstream changes (presumably #132317) made this pull request unmergeable. Please resolve the merge conflicts. |
CPU: Intel® Core™ i7-8700 × 12 `tests/ui/parallel-rustc/query-cycle-issue-129912.rs` failed
|
1a125e5
to
979f18e
Compare
This comment has been minimized.
This comment has been minimized.
a968aaa
to
e8f1918
Compare
@SparrowLii this PR is still blocked on #137731 merging first, then this PR will need to rebase right? |
Do we need a new directive, or does this make sense as a dedicated test suite instead?
So if this is only for new, dedicated tests, the opt-in directive mechanism may be less interesting than having a different dedicated test suite: the This would allow for easy expansion in the future, for example:
Maybe it could also be interesting to be able to configure the iteration count without rebuilding compiletest, maybe an env var to control this for the entire suite. Maybe a directive could also be useful per test, I don't know. These would allow one to crank up the number of iterations if they need to try to reproduce a particular issue: locally I've had to do this increase over the 50 iterations count in the PR, to reproduce some of the known deadlocks more easily. I guess it could allow CI some control to spend more or less time in these tests as well if we want to expand coverage (though the question of how to reliably test and benchmark the parallel compiler is a different thorny issue altogether). What do you think @SparrowLii and @jieyouxu? |
I would be fine with some kind of
Yes. I do agree that a separate test suite could be better to serve the purposes of parallel front-end specifically and not have to special-case a ui test subdir or shoehorn existing ui test suite to cater to parallel front-end tests. In a sense, this is also forwards-compatible. Once we are sufficiently confident in the parallel front-end to be very likely to not cause new test failures, we can adjust the existing ui test suite to also run with a configuration similar to the new
Yes, that sounds like a use case one might want to handle. For instance, you may even want to configure this via |
I agree. Parallel front end testing is very different from the current UI test cases. We should build a dedicated test suite so that it will not be abused in other UI tests in the future or make the UI test suite more and more bloated. I think we can create a new |
Resume one waiter at once in deadlock handler When multiple query loop errors occur in the code, only one waiter should be resumed at a time to avoid waking up multiple waiters at the same time and causing deadlock due to thread grabbing. This fixes the UI failures in rust-lang#132051 cc `@Zoxc` `@cjgillot` `@nnethercote` `@bjorn3` `@Kobzol` Zulip discussion [here](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fwg-parallel-rustc/topic/Deadlocks.20and.20Rayon) Edit: We can't reproduce these bugs with the existing test suits, so we keep them until we merge rust-lang#132051 UPDATES rust-lang#129912 UPDATES rust-lang#120757 UPDATES rust-lang#129911
Rollup merge of rust-lang#137731 - SparrowLii:waiter, r=nnethercote Resume one waiter at once in deadlock handler When multiple query loop errors occur in the code, only one waiter should be resumed at a time to avoid waking up multiple waiters at the same time and causing deadlock due to thread grabbing. This fixes the UI failures in rust-lang#132051 cc `@Zoxc` `@cjgillot` `@nnethercote` `@bjorn3` `@Kobzol` Zulip discussion [here](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fwg-parallel-rustc/topic/Deadlocks.20and.20Rayon) Edit: We can't reproduce these bugs with the existing test suits, so we keep them until we merge rust-lang#132051 UPDATES rust-lang#129912 UPDATES rust-lang#120757 UPDATES rust-lang#129911
☔ The latest upstream changes (presumably #138058) made this pull request unmergeable. Please resolve the merge conflicts. |
update #118698
update #113349
Most of the issues of parallel front end are not reproducible, and are even fixed in compiler updates (#124423 is no longer reproducible after I updated the master branch)
This PR add all testable issues to UI tests to verify their irreproducibility. If no problems occur, and no feedback from other CI testing was received within a certain period of time, we can close the source PR