Parallel frontend compiler support (perf backend only)#2491
Conversation
from andrew.zhogin@gmail.com: 3ffe80f
as proposed by berykubik@gmail.com in the discussion of the preceding pr
|
Thanks for the PR! Let's revert the last commit; the CI failure shows why we need to have a custom environment variable, so that it will also work with a stable Rust compiler. |
544995b to
4f11ea4
Compare
|
I'm not sure I quite like a separate environment variable for that; don't we have a better mechanism? Also, maybe a collector run shouldn't silently revert to single-threaded scenario in an unsupported version, which it currently does, for my understanding? However, it seems like it's a common behavior in // ...
let profiles = if collector::version_supports_doc(&toolchain.id) {
vec![Profile::Check, Profile::Debug, Profile::Doc, Profile::Opt]
} else {
vec![Profile::Check, Profile::Debug, Profile::Opt]
};
let scenarios = if collector::version_supports_incremental(&toolchain.id) {
Scenario::all()
} else {
Scenario::all_non_incr()
};
let frontend_threads_counts = if collector::version_supports_parallel_frontend(&toolchain.id) {
FrontendThreads::default_opts()
} else {
vec![FrontendThreads(1)]
};
// ...So it might be i'm looking too hard into it... |
|
|
Kobzol
left a comment
There was a problem hiding this comment.
Thanks for separating the PR! Did a first review pass. Adding a new benchmark axis is always cumbersome, as it requires changing many places, and this one is also tricky, because it doesn't have a closed set of values, but is just a number. But in general it looks good, just
Please revert all the site changes, the integration with the frontend and also the job queuing system should be done in a follow-up PR. For now everything on production will just assume frontend count 1.
| benchmark.name, | ||
| profile, | ||
| scenario, | ||
| frontend_threads.par_n(), |
There was a problem hiding this comment.
Let's remove the par_n function, it contains a hardcoded string prefix that is then used in several places. That shouldn't belong in the database module.
| let frontend_threads_counts = if collector::version_supports_parallel_frontend(&toolchain.id) { | ||
| FrontendThreads::default_opts() | ||
| } else { | ||
| vec![FrontendThreads(1)] |
There was a problem hiding this comment.
Hmm, this is tricky, because for the old version that doesn't support the flag, we would either:
- Not pass the
RUSTC_THREAD_COUNTat all (which happens now). That works for the old compiler, but if we change the default thread count in the future, then setting--frontend-threads=1will actually use the default number of threads, which is misleading. - Still try to pass
-Zthreads=1. That will ensure that we are using the right number of threads, but it will break benchmarking on Rust <1.33.0.
I would suggest changing this to always pass the flag. It is better to break benchmarking on Rust <1.33.0, which likely won't be needed in the near future, than to use an unexpected thread count by mistake.
| if self.frontend_threads.0 != 1 { | ||
| cmd.env("RUSTC_THREAD_COUNT", self.frontend_threads.0.to_string()); | ||
| } |
There was a problem hiding this comment.
| if self.frontend_threads.0 != 1 { | |
| cmd.env("RUSTC_THREAD_COUNT", self.frontend_threads.0.to_string()); | |
| } | |
| cmd.env("RUSTC_THREAD_COUNT", self.frontend_threads.0.to_string()); |
|
Thanks for the fast yet sizable review! I'm sorry for calling out for you so early; i'm not sure this pr is quite review-ready. I'll try to resolve what you commented for now and then dive more into how this works! As until now all i did is brainless-ish renaming, lol |
|
To be fair, adding a new benchmark axis mostly involves a lot of brainless-ish renaming :) I think that the PR is mostly good to go, though it will require a couple of follow-up PRs to:
|
although i'm not entirely sure it's all of it - rename `frontend_threads: Vec<_>` -> `frontend_threads_counts: Vec<_>` for consistency
also, a question: should we include frontend_threads into glossary?
- target description to schema.md
|
The dumb part is more or less done, now i'll be dealing with threads argument propagation and fallback legacy paths EDIT: oh, and the |
Supersedes #2421, but only backend (profiler/bencher/database). As said in parent pr, parallel frontend support is implemented as additional dimension with corresponding row added to the database