Skip to content

Reduce the default number of CGUs for incremental. #111666

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

Closed

Conversation

nnethercote
Copy link
Contributor

Because it gives better performance.

r? @ghost

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 17, 2023
@nnethercote
Copy link
Contributor Author

My local measurements suggested that 128 was clearly better than 256, and 64 was slightly better again. Let's see what CI says.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 17, 2023
@bors
Copy link
Collaborator

bors commented May 17, 2023

⌛ Trying commit 5407fe39ae91e062d1d31d69197af4ae351d1f5f with merge 3b2fafd65a7058220b97fb6097fec300c5482372...

@bors
Copy link
Collaborator

bors commented May 17, 2023

☀️ Try build successful - checks-actions
Build commit: 3b2fafd65a7058220b97fb6097fec300c5482372 (3b2fafd65a7058220b97fb6097fec300c5482372)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3b2fafd65a7058220b97fb6097fec300c5482372): 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)
35.5% [0.5%, 226.1%] 7
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.9% [-3.5%, -0.2%] 32
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 5.6% [-3.5%, 226.1%] 39

Max RSS (memory usage)

Results

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.

mean range count
Regressions ❌
(primary)
20.1% [20.1%, 20.1%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.2% [-3.4%, -1.2%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.3% [-3.4%, 20.1%] 5

Cycles

Results

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.

mean range count
Regressions ❌
(primary)
48.2% [1.9%, 220.8%] 5
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.9% [-3.7%, -1.1%] 13
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 12.0% [-3.7%, 220.8%] 18

Binary size

Results

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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.7% [-6.6%, -0.4%] 54
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.7% [-6.6%, -0.4%] 54

Bootstrap: 643.756s -> 643.951s (0.03%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels May 17, 2023
@nnethercote
Copy link
Contributor Author

Instruction counts and cycles should be ignored here. Walltime, max-rss, and binary size are the important metrics.

That one terrible webrender results skews everything badly. It's probably a bit of freak random pathological case, and we can pretty much ignore it because opt builds are non-incremental by default. Also, the secondary benchmarks here probably aren't much use, because they're mostly very small and likely to have just one or two functions, hence one or two code units.

With that in mind, looking at just the primary check/debug/doc incremental cases:

  • walltime is moderately improved
  • max-rss is moderately improved
  • binary size is greatly improved

So overall I think the results are pretty decent, better than they might appear at first glance, and this is worth considering. 256 codegen units (and thus 256 threads) is a lot!

Because it gives better performance.
@nnethercote nnethercote force-pushed the reduce-codegen-units-incr branch from 5407fe3 to a0954f7 Compare May 17, 2023 19:29
@nnethercote
Copy link
Contributor Author

Now let's try 64 CGUs.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 17, 2023
@bors
Copy link
Collaborator

bors commented May 17, 2023

⌛ Trying commit a0954f7 with merge 26269dfb9e9b933270bec418381c5dbf44934013...

@bors
Copy link
Collaborator

bors commented May 17, 2023

☀️ Try build successful - checks-actions
Build commit: 26269dfb9e9b933270bec418381c5dbf44934013 (26269dfb9e9b933270bec418381c5dbf44934013)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (26269dfb9e9b933270bec418381c5dbf44934013): 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)
126.6% [0.5%, 928.4%] 15
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.6% [-5.4%, -0.2%] 50
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 28.0% [-5.4%, 928.4%] 65

Max RSS (memory usage)

Results

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.

mean range count
Regressions ❌
(primary)
7.1% [1.8%, 20.2%] 9
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.6% [-5.0%, -1.2%] 5
Improvements ✅
(secondary)
-3.4% [-3.4%, -3.4%] 2
All ❌✅ (primary) 3.6% [-5.0%, 20.2%] 14

Cycles

Results

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.

mean range count
Regressions ❌
(primary)
159.4% [2.3%, 831.4%] 11
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.0% [-5.7%, -1.5%] 22
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 51.1% [-5.7%, 831.4%] 33

Binary size

Results

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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-4.2% [-12.7%, -0.4%] 69
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -4.2% [-12.7%, -0.4%] 69

Bootstrap: 642.109s -> 643.649s (0.24%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 18, 2023
@nnethercote
Copy link
Contributor Author

Larger benchmarks have more CGUs, and reducing the max number of CGUs means they do more CGU merging, which increases the chance that a small change causes an outsized amount of codegen being redone. That explains the drastic regressions on the incr-patched results for the big benchmarks like cranelift-codegen, webrender, and cargo.

#112441 is an experiment in the other direction -- it disables all CGU merging in incremental builds, effectively setting the CGU limit to infinity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants