-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Restore #![no_builtins]
crates participation in LTO.
#113923
Conversation
This comment has been minimized.
This comment has been minimized.
5896550
to
beaa1ea
Compare
This comment has been minimized.
This comment has been minimized.
beaa1ea
to
e04af60
Compare
Removed opaque pointers for LLVM 14. |
e04af60
to
8799b43
Compare
ping? @pnkfelix |
8799b43
to
c1ec76c
Compare
Rebase and remove the DisableSimplifyLibCalls parameter. |
@rustbot ready |
@bors r+ rollup=never |
⌛ Testing commit c1ec76c with merge f4589297857113e2cc3f6437f112d567b4da3694... |
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
Based on the error message, I believe #78744, #91158 amd rust-lang/cargo#10118 are also not participating in the LTO issue. It show
|
@rustbot author |
TL;DR I renamed An interesting attempt: I can get correct results using LLVM's LTO in lld. "lld" "-flavor" "wasm" "--rsp-quoting=posix" \
"--export" "multer" "--export=__heap_base" "--export=__data_end" \
"-z" "stack-size=1048576" "--stack-first" "--allow-undefined" "--fatal-warnings" "--no-demangle" "--no-entry" \
"main.main.7fc14dcaa7e3fa65-cgu.0.rcgu.lto.input.bc" \
"-o" "main.wasm" "--gc-sections" "--no-entry" "-O3" I investigated along with this result why lld's LTO could be successful. Two issues in LLVM (or maybe not).
|
Finished benchmarking commit (8c2b577): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 673.541s -> 672.846s (-0.10%) |
It seems that linking has become 10-20ms slower and binaries ~260kb bigger. Maybe we no longer gc unused compiler builtins functions? |
Right, those compile-time regressions are really bad :( Lots of ~5% binary size increases, too. What can be done? |
I believe I saw something around symbols being marked as "used". If this is currently linker used, maybe we can downgrade it to compiler used? |
I can verify that this indeed preserves builtin functions. |
This should be the right way to go.
I will start debugging with your analysis this weekend. :) |
Avoid adding builtin functions to `symbols.o` We found performance regressions in rust-lang#113923. The problem seems to be that `--gc-sections` does not remove these symbols. I tested that lld removes these symbols, but ld and gold do not. I found that `used` adds symbols to `symbols.o` at https://github.com/rust-lang/rust/blob/3e202ead604be31f4c1a5798a296953d3159da7e/compiler/rustc_codegen_ssa/src/back/linker.rs#L1786-L1791. The PR removes builtin functions. Note that under LTO, ld still preserves these symbols. (lld will still remove them.) The first commit also fixes rust-lang#118559. But I think the second commit also makes sense.
Avoid adding builtin functions to `symbols.o` We found performance regressions in rust-lang#113923. The problem seems to be that `--gc-sections` does not remove these symbols. I tested that lld removes these symbols, but ld and gold do not. I found that `used` adds symbols to `symbols.o` at https://github.com/rust-lang/rust/blob/3e202ead604be31f4c1a5798a296953d3159da7e/compiler/rustc_codegen_ssa/src/back/linker.rs#L1786-L1791. The PR removes builtin functions. Note that under LTO, ld still preserves these symbols. (lld will still remove them.) The first commit also fixes rust-lang#118559. But I think the second commit also makes sense.
…enkov Revert rust-lang#113923 Per [#t-compiler/meetings > [weekly] 2024-01-11](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11) discussion, revert rust-lang#113923. Also revert associated rust-lang#118568. The PR rust-lang#113923 causes the regression issue rust-lang#118609. We need more time to find a proper solution. Discussions start at [412365838](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11/near/412365838) and continue to [412369643](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11/near/412369643). Fixes rust-lang#118609. r? compiler
…llaumeGomez Rollup of 6 pull requests Successful merges: - rust-lang#119817 (Remove special-casing around `AliasKind::Opaque` when structurally resolving in new solver) - rust-lang#119819 (Check rust lints when an unknown lint is detected) - rust-lang#119872 (Give me a way to emit all the delayed bugs as errors (add `-Zeagerly-emit-delayed-bugs`)) - rust-lang#119877 (Add more information to `visit_projection_elem`) - rust-lang#119884 (Rename `--env` option flag to `--env-set`) - rust-lang#119885 (Revert rust-lang#113923) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#119885 - DianQK:revert-pr-113923, r=petrochenkov Revert rust-lang#113923 Per [#t-compiler/meetings > [weekly] 2024-01-11](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11) discussion, revert rust-lang#113923. Also revert associated rust-lang#118568. The PR rust-lang#113923 causes the regression issue rust-lang#118609. We need more time to find a proper solution. Discussions start at [412365838](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11/near/412365838) and continue to [412369643](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11/near/412369643). Fixes rust-lang#118609. r? compiler
[beta] Revert rust-lang#113923 Per [#t-compiler/meetings > [weekly] 2024-01-11](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11) discussion, revert rust-lang#113923. Also revert associated rust-lang#118568. The PR rust-lang#113923 causes the regression issue rust-lang#118609. We need more time to find a proper solution. Discussions start at [412365838](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11/near/412365838) and continue to [412369643](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-01-11/near/412369643). Fixes rust-lang#118609. Same as rust-lang#119885 but backported to beta. r? compiler
Since rust-lang/rust#113923 no_builtins crates participate in LTO too.
Since rust-lang/rust#113923 no_builtins crates participate in LTO too.
After #113716, we can make
#![no_builtins]
crates participate in LTO again.#![no_builtins]
with LTO does not result in undefined references to the error. I believe this type of issue won't happen again.Fixes #72140. Fixes #112245. Fixes #110606. Fixes #105734. Fixes #96486. Fixes #108853. Fixes #108893. Fixes #78744. Fixes #91158. Fixes rust-lang/cargo#10118. Fixes rust-lang/compiler-builtins#347.
The
nightly-2023-07-20
version does not always reproduce problems due to changes in compiler-builtins, core, and user code. That's why this issue recurs and disappears.Some issues were not tested due to the difficulty of reproducing them.
r? pnkfelix
cc @bjorn3 @japaric @alexcrichton @Amanieu