Build rustc and codegen backends with -Zno-embed-metadata#151061
Build rustc and codegen backends with -Zno-embed-metadata#151061bjorn3 wants to merge 2 commits intorust-lang:mainfrom
Conversation
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.
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.
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.
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.
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).
This comment has been minimized.
This comment has been minimized.
|
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. |
|
Maybe we could retry this after #151225? |
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.
14017fc to
158bff0
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
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