-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Consider building libstd with codegen-units=1 for release artifacts #54872
Comments
To clarify, this is just std? Or would we want std and its dependencies? It does seem plausible that std being built in this fashion would fit into the window of time we have, cc @alexcrichton @rust-lang/infra |
Everything from |
I agree that this has a possibility of making some release-mode Rust programs faster by default as well (as std itself will get more inlining opportunities), although I suspect the number of programs there that get faster is quite small in that almost all perf-sensitive funcitons in libstd are already monomorphized/inlined. I agree though that the amount of time it takes on CI to build libstd/libcore with one CGU should be pretty minimal. @michaelwoerister I don't understand though what you mention is the original motivation for this issue? If you fat-LTO all Rust code together into a staticlib that doesn't matter how many CGUs each of the input crates has, right? It should be compatible with libstd having any number of CGUs, and we'd just need to make sure that the staticlib output is compatible with LLD-based ThinLTO |
@alexcrichton The problem is just that we run into a form of #53912 with a ThinLTO'd libstd because some symbols in there have gone through the ThinLTO mangling before LLD does it a second time. The problem could also be solved by doing some kind of fix-up pass on the IR before emitting it into the staticlib. |
Ah ok, makes sense! We've already got a smattering of weird patches of "randomly patching LLVM IR" to avoid bugs in LLVM so shouldn't be too hard to add another! |
Yes, such a pass will probably be the more stable option in the long run. |
Compile the libstd we distribute with -Ccodegen-unit=1 This PR - adds the `single-codegen-unit-std` option to `config.toml` which allows for setting the CGU count for `libstd` and `libtest` independently of the one for the rest of the compiler, and - sets the new option to `true` for all dist jobs in CI. Fixes #54872. r? @Mark-Simulacrum cc @rust-lang/release
Compile the libstd we distribute with -Ccodegen-unit=1 This PR - adds the `single-codegen-unit-std` option to `config.toml` which allows for setting the CGU count for `libstd` and `libtest` independently of the one for the rest of the compiler, and - sets the new option to `true` for all dist jobs in CI. Fixes #54872. r? @Mark-Simulacrum cc @rust-lang/release
…simulacrum Compile the libstd we distribute with -Ccodegen-unit=1 This PR - adds the `single-codegen-unit-std` option to `config.toml` which allows for setting the CGU count for `libstd` and `libtest` independently of the one for the rest of the compiler, and - sets the new option to `true` for all dist jobs in CI. Fixes rust-lang#54872.
The main reason I'd like to have this is because it would allow fat-LTO'ed staticlibs to be used as input for LLD-based ThinLTO (which is something that Firefox might want to do, if it brings performance wins). It might also improve runtime performance of all Rust programs without incurring as much of a CI cycle time penalty as building everything with
-Ccodegen-units=1
would.cc @rust-lang/release
The text was updated successfully, but these errors were encountered: