6

[WIP] Build `rustc` with a single CGU on x64 Linux by Kobzol · Pull Request #107...

 7 months ago
source link: https://github.com/rust-lang/rust/pull/107651
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

[WIP] Build rustc with a single CGU on x64 Linux #107651

Conversation

Contributor

Follow-up attempt to #87650. I wonder if anything changed with the addition of LTO.

I also enabled a single CGU only for the actual build of the compiler on CI, so that we can better see the perf. effects on the bootstrap benchmark.

Collaborator

r? @pietroalbini

(rustbot has picked a reviewer for you, use r? to override)

Contributor

Author

rustbot

added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.

labels

Feb 3, 2023

This comment has been minimized.

rustbot

added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label

Feb 3, 2023

Contributor

⌛ Trying commit 96c912abfc4b44ce5f8fca252500880ffba28d3e with merge 2a203d5ea41b38173f8e09d32d989d0c26770e28...

Contributor

☀️ Try build successful - checks-actions
Build commit: 2a203d5ea41b38173f8e09d32d989d0c26770e28 (2a203d5ea41b38173f8e09d32d989d0c26770e28)

This comment has been minimized.

Collaborator

Finished benchmarking commit (2a203d5ea41b38173f8e09d32d989d0c26770e28): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Benchmarking 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 @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.9% [0.2%, 3.1%] 68
Regressions ❌
(secondary)
4.7% [0.5%, 27.2%] 57
Improvements ✅
(primary)
-1.1% [-4.1%, -0.2%] 71
Improvements ✅
(secondary)
-1.7% [-7.6%, -0.5%] 121
All ❌✅ (primary) -0.1% [-4.1%, 3.1%] 139

Max RSS (memory usage)

Results

Cycles

Results

rustbot

added perf-regression Performance regressions

and removed S-waiting-on-perf Status: Waiting on a perf run to be completed.

labels

Feb 4, 2023

Contributor

This seems to perform similarly to #107560, which make sense since that compiles most crates with 1 CGU. It's an overall improvement, but with some regressions. It does seem like there's some problem with ThinLTO + PGO for match-stress, but that is a stress test and not terribly important.

Kobzol reacted with thumbs up emoji

Contributor

Author

The CI time hit is also not that terrible, 8600s (I saw a recent master commit had 8000s), not sure what's the average recently (@Mark-Simulacrum ).

We can get that time down, too. LLVM rebuild time can be lowered, and we can also speedup rustc builds - e.g. we don't need to build with 1 CGU when we do LLVM PGO/BOLT, and I think that we can also skip LTO/1 CGU when building stage 1 (we'd need to modify bootstrap though).

Contributor

Building with 1 CGU would be useful to make the --emit options better match the CI builds too.

Contributor

I did some local benchmarks to test 16 CGUs (Before) vs. 1 CGU (After) with ThinLTO:

BenchmarkBeforeAfter
TimeTime%
🟣 clap:check:unchanged0.4631s0.4475s💚 -3.37%
🟣 hyper:check:unchanged0.1528s0.1472s💚 -3.65%
🟣 regex:check:unchanged0.3433s0.3370s💚 -1.83%
🟣 syn:check:unchanged0.6308s0.6065s💚 -3.84%
🟣 syntex_syntax:check:unchanged1.8294s1.7532s💚 -4.16%
Total3.4193s3.2914s💚 -3.74%
Summary1.0000s0.9663s💚 -3.37%
BenchmarkBeforeAfter
TimeTime%
🟣 clap:check1.6721s1.5579s💚 -6.83%
🟣 hyper:check0.2592s0.2418s💚 -6.69%
🟣 regex:check0.9330s0.8702s💚 -6.74%
🟣 syn:check1.4963s1.3939s💚 -6.85%
🟣 syntex_syntax:check5.8074s5.3920s💚 -7.15%
Total10.1681s9.4558s💚 -7.00%
Summary1.0000s0.9315s💚 -6.85%

Contributor

Author

This comment has been minimized.

rustbot

added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label

May 17, 2023

Contributor

⌛ Trying commit 96c912abfc4b44ce5f8fca252500880ffba28d3e with merge 0b5019f4e7c7c5e8190c0d4e9686840a7a3cfc00...

Contributor

💔 Test failed - checks-actions

This comment has been minimized.

bors

added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

labels

May 17, 2023

Contributor

Author

This comment has been minimized.

Contributor

☀️ Try build successful - checks-actions
Build commit: 146169d35b066f541a24c7489cd7ef4397300cf5 (146169d35b066f541a24c7489cd7ef4397300cf5)

This comment has been minimized.

Collaborator

Finished benchmarking commit (146169d35b066f541a24c7489cd7ef4397300cf5): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Benchmarking 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 @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.7% [0.3%, 2.0%] 31
Regressions ❌
(secondary)
1.7% [0.6%, 2.4%] 16
Improvements ✅
(primary)
-1.3% [-4.1%, -0.3%] 96
Improvements ✅
(secondary)
-1.7% [-3.7%, -0.5%] 122
All ❌✅ (primary) -0.8% [-4.1%, 2.0%] 127

Max RSS (memory usage)

Results

Cycles

Results

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 629.118s -> 625.733s (-0.54%)
Artifact size: 316.16 MiB -> 271.45 MiB (-14.14%)

Kobzol and lnicola reacted with hooray emoji

Contributor

Author

@bors try

Trying with LLVM 16.

Contributor

⌛ Trying commit a47a9eb with merge 3cdcb31...

rustbot

added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label

Sep 15, 2023

Contributor

Author

@bors try

Contributor

⌛ Trying commit dba68fa with merge a3b1fd2...

This comment has been minimized.

This comment has been minimized.

Contributor

💔 Test failed - checks-actions

This comment has been minimized.

Contributor

☔ The latest upstream changes (presumably #115959) made this pull request unmergeable. Please resolve the merge conflicts.

Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

bors

merged commit 871407a into

rust-lang:master

Oct 1, 2023

18 of 23 checks passed

rustbot

added this to the 1.75.0 milestone

Oct 1, 2023

Member

How did this get merged by bors? There's no r+.

Member

This draft PR contains a single commit ca59652 which was merged in #115554

lnicola and Kobzol reacted with thumbs up emoji

Kobzol

deleted the ci-single-cgu branch

October 1, 2023 15:31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Labels
A-testsuite Area: The testsuite used to check the correctness of rustc perf-regression Performance regressions S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects

None yet

Milestone

1.75.0

Development

Successfully merging this pull request may close these issues.

None yet

10 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK