-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Build rustc and codegen backends with -Zno-embed-metadata #151061
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
base: main
Are you sure you want to change the base?
Conversation
While this won't change much for rustc and rustc-dev, it should make codegen backends a bit smaller by omitting their crate metadata. In addition it should reduce disk usage while compiling.
This comment has been minimized.
This comment has been minimized.
Build rustc and codegen backends with -Zno-embed-metadata
| if matches!(mode, Mode::Std) { | ||
| if matches!(mode, Mode::Std | Mode::Rustc | Mode::Codegen) { | ||
| cargo.arg("-Zno-embed-metadata"); | ||
| } |
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.
Maybe we could move this into run_cargo as that is the only function which supports -Zno-embed-metadata currently?
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.
Yeah, it would be nice, we could then do some asserts, e.g. that you are not using OnlyRlib (although it's tricky - OnlyDylib is in theory also not valid for -Zno-embed-metadata, but it works if the thing you build doesn't need to be linked to through normal Rust means).
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.
OnlyDylib is only used for codegen backends, which don't need the crate metadata. I've moved the -Zno-embed-metadata to run_cargo.
|
And the baseline to compare the disk space against for try builds: @bors try |
Build rustc and codegen backends with -Zno-embed-metadata
This comment has been minimized.
This comment has been minimized.
|
r? @Kobzol |
6e25c8e to
b6605c3
Compare
|
For the try build it saves 2GB or 4% of the total space the build takes (46GB -> 44GB). Hoped it would be a bit more, but still not bad I think. And maybe it gives a higher relative saving when not collecting PGO profiles? @rustbot ready |
|
Let's do a full try build to see the codegen backend savings (we can compare them with the parent commit, should be enough), and also run perf., just in case. @bors try jobs=dist-x86_64-linux @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Build rustc and codegen backends with -Zno-embed-metadata try-job: dist-x86_64-linux
|
For cg_clif the |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (2cbe7f7): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (secondary -1.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 2.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 476.337s -> 475.884s (-0.10%) |
|
Before: After: And no other components seem to have changed their size. Yeah, pretty nice, a solid ~10%! |
| if matches!(mode, Mode::Std) { | ||
| if matches!(mode, Mode::Std | Mode::Rustc | Mode::Codegen) { | ||
| cargo.arg("-Zno-embed-metadata"); | ||
| } |
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.
Yeah, it would be nice, we could then do some asserts, e.g. that you are not using OnlyRlib (although it's tricky - OnlyDylib is in theory also not valid for -Zno-embed-metadata, but it works if the thing you build doesn't need to be linked to through normal Rust means).
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
I can't reproduce the CI failure locally. Could it be related to rust-lang/cargo#16503? |
|
Possibly, although my first guess is that we are not copying rustc .rmeta files somewhere in bootstrap. |
While this won't change much for rustc and rustc-dev, it should make codegen backends a bit smaller by omitting their crate metadata. In addition it should reduce disk usage while compiling.
Follow up to #145343