-
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
Support symbolicating zstd-compressed ELF sections #130417
base: master
Are you sure you want to change the base?
Support symbolicating zstd-compressed ELF sections #130417
Conversation
This requires bumping backtrace to rust-lang/backtrace-rs@4f3acf7 which includes support for symbolicating from newer Android APK formats, as well as for using zstd-compressed ELF sections for debuginfo. It also requires compiling ruzstd, a zstd decompressor written in Rust. This can combine with rust-lld's support for zstd-compressed debuginfo for overall smaller debuginfo sections.
Need to know the impacts this has on the stats of our toolchain and binaries before we do this. @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…h-zstd, r=<try> Support symbolicating zstd-compressed ELF sections This requires bumping backtrace to rust-lang/backtrace-rs@4f3acf7 which includes support for symbolicating from newer Android APK formats, as well as for using zstd-compressed ELF sections for debuginfo. It also requires compiling ruzstd, a zstd decompressor written in Rust. This can combine with rust-lld's support for zstd-compressed debuginfo for overall smaller debuginfo sections.
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (cba0a0a): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking 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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never 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)Results (primary 1.2%, secondary 1.0%)This 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.
CyclesResults (primary 5.5%, secondary 8.5%)This 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 sizeResults (primary 6.0%, secondary 13.9%)This 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: 758.794s -> 759.241s (0.06%) |
Mmyeah that's pretty brutal. |
@khuey Do you think we can get away with enabling the zstd-compressed debuginfo by default when building the Rust toolchain, at least? Not necessarily every binary. |
I'm not sure I understand the question. |
Rereading that now that I'm fully awake ... If the concern here is the artifact size at the end I think we could turn on zstd compression for debug info for the dist rustc binaries. Really people shouldn't need more than backtraces anyways, and since backtrace-rs supports zstd now we should be good I think? If people are going to do profiling/etc (with other tools that may not support zstd-compressed debug info) I'd assume they'd build from source but maybe I'm wrong about that. |
7cd48bd
to
43eed9e
Compare
43eed9e
to
6fb058e
Compare
yeah that's what I'm thinking myself. |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…h-zstd, r=<try> Support symbolicating zstd-compressed ELF sections This requires bumping backtrace to rust-lang/backtrace-rs@4f3acf7 which includes support for symbolicating from newer Android APK formats, as well as for using zstd-compressed ELF sections for debuginfo. It also requires compiling ruzstd, a zstd decompressor written in Rust. This can combine with rust-lld's support for zstd-compressed debuginfo for overall smaller debuginfo sections.
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
uh. |
…h-zstd, r=<try> Support symbolicating zstd-compressed ELF sections This requires bumping backtrace to rust-lang/backtrace-rs@4f3acf7 which includes support for symbolicating from newer Android APK formats, as well as for using zstd-compressed ELF sections for debuginfo. It also requires compiling ruzstd, a zstd decompressor written in Rust. This can combine with rust-lld's support for zstd-compressed debuginfo for overall smaller debuginfo sections.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (e7fc2c2): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking 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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never 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)Results (primary 4.0%, secondary 0.7%)This 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.
CyclesResults (primary 5.0%, secondary 6.3%)This 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 sizeResults (primary 2.2%, secondary 10.6%)This 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: 759.275s -> 761.352s (0.27%) |
less awful, but still pretty... |
The size increases were baked in when using the bindings to libzstd.so was refused months ago. |
dynamically linking in libzstd.so would also be unacceptable. |
I haven't had much time to look at this but I did take a brief glance and I found this surprising:
It's not limited to ruzstd either
These compression crates are implementation details of backtrace, right? Why are their symbols leaking out of libstd.so? Some of these symbols are things like Display::fmt impls for errors in ruzstd. I picked one of them (HuffmanTableError's) and verified that it's not actually called by anything in libstd.so, so if it weren't exported it would presumably be discarded by the linker. |
I suppose it's possible that Display::fmt impls are hanging around because they're still referred to by a vtable, but it still doesn't seem like they should be exposed from libstd.so. There are also symbols like ruzstd::blocks::sequence_section::CompressionModes::of_mode that show up that definitely wouldn't be in a vtable. |
I don't think such considerations are used to limit exported symbols at the moment. It is possible to use those crates, so their public API is exported: #![feature(rustc_private)]
extern crate ruzstd;
use ruzstd::blocks::sequence_section::*;
fn main() {
let _ = CompressionModes::of_mode as fn(_) -> _;
} |
Just stripping out the Display impls on the error types in ruzstd (which backtrace-rs doesn't even use anyways, since it immediate .ok()s the return values) recovers about 24% of the size increase in libstd.so. |
That seems more than a little crazy. |
I think we can get the size increase in libstd.so to about 140k, but lower than that seems unachievable. |
I mean, I'm most concerned about the helloworld impact. |
Basically, right now, even if they don't actually need zstd decoding ability (because the binary contains no such debuginfo sections), they will still compile it in. It's bothersome because if we're creating the binary we definitely know the answer to that question... |
Libc or another system library used by the program may use zstd compressed sections. Or it may be compressed by post-processing of the executable. |
ah, true, I forgot about libc... bothersome. |
I haven't actually tested helloworld locally but I would expect the size impact there to be bounded above by the impact on libstd.so. That generally tracks with the perf results above (helloworld increased by about 84k above, presumably the linker can GC more stuff once libstd is statically linked in). As bjorn3 pointed out there's really no way to know that we won't use zstd compression since it can be applied to shared libraries or even the binary itself after the fact. |
This requires bumping backtrace to rust-lang/backtrace-rs@4f3acf7 which includes support for symbolicating from newer Android APK formats, as well as for using zstd-compressed ELF sections for debuginfo.
It also requires compiling ruzstd, a zstd decompressor written in Rust.
This can combine with rust-lld's support for zstd-compressed debuginfo for overall smaller debuginfo sections.
r? @ghost