Skip to content
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

Enable constant folding across crates (weak linkage + comdat) #114816

Closed
wants to merge 1 commit into from

Conversation

dpaoliello
Copy link
Contributor

@rustbot
Copy link
Collaborator

rustbot commented Aug 14, 2023

r? @TaKO8Ki

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 14, 2023
@rust-log-analyzer

This comment has been minimized.

@tmiasko
Copy link
Contributor

tmiasko commented Aug 14, 2023

@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 Aug 14, 2023
@bors
Copy link
Contributor

bors commented Aug 14, 2023

⌛ Trying commit 0aac118e1d1a266e0df946c9d45ecec205090fff with merge 1683cf3d081d95409f167be3f83bf1751c161e55...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Aug 14, 2023

💔 Test failed - checks-actions

@bors 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 Aug 14, 2023
@rust-log-analyzer

This comment has been minimized.

Some(ConstAllocationDebugHint::CallerLocation) => "callerloc_",
Some(ConstAllocationDebugHint::TypeName) => "typename_",
Some(ConstAllocationDebugHint::VTable) => "vtable_",
None => "alloc_",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a prefix which is clearly unique to rustc (and preferably to a single version of rustc in case staticlibs of different rustc versions are mixed)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: feel free to provide suggestions on the new naming scheme

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@nikic
Copy link
Contributor

nikic commented Aug 18, 2023

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Aug 18, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c9fccbb340b8b5dd74189b8980b0d3b586ca47a6): comparison URL.

Overall result: ❌ regressions - 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)
233.8% [0.4%, 2790.5%] 67
Regressions ❌
(secondary)
19.1% [0.3%, 356.1%] 79
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 233.8% [0.4%, 2790.5%] 67

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)
19.1% [1.1%, 63.7%] 29
Regressions ❌
(secondary)
16.7% [2.1%, 33.9%] 8
Improvements ✅
(primary)
-2.9% [-5.4%, -1.7%] 8
Improvements ✅
(secondary)
-2.8% [-6.6%, -1.1%] 93
All ❌✅ (primary) 14.3% [-5.4%, 63.7%] 37

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)
243.9% [1.3%, 2327.2%] 62
Regressions ❌
(secondary)
23.7% [1.7%, 360.3%] 77
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.1% [-2.1%, -2.1%] 1
All ❌✅ (primary) 243.9% [1.3%, 2327.2%] 62

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)
4.4% [0.0%, 63.4%] 155
Regressions ❌
(secondary)
3.5% [0.0%, 44.4%] 129
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.4% [0.0%, 63.4%] 155

Bootstrap: 633.189s -> 639.354s (0.97%)
Artifact size: 347.08 MiB -> 348.54 MiB (0.42%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Aug 18, 2023
compiler/rustc_codegen_llvm/src/common.rs Outdated Show resolved Hide resolved
tests/codegen/thread-local.rs Outdated Show resolved Hide resolved
@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Aug 18, 2023
@erikdesjardins
Copy link
Contributor

This could use another perf run, which should be much better since it doesn't have the effect of disabling DCE anymore. (I don't have permission)

@workingjubilee
Copy link
Member

@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 Aug 19, 2023
@bors
Copy link
Contributor

bors commented Aug 19, 2023

⌛ Trying commit 30ff300 with merge f923a643d2dec533a4239551e9f4011e0b53bcab...

@bors
Copy link
Contributor

bors commented Aug 19, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f923a643d2dec533a4239551e9f4011e0b53bcab): comparison URL.

Overall result: ❌ regressions - 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)
219.3% [0.3%, 2592.0%] 64
Regressions ❌
(secondary)
10.5% [0.4%, 46.6%] 76
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 219.3% [0.3%, 2592.0%] 64

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)
19.0% [1.0%, 63.6%] 27
Regressions ❌
(secondary)
24.2% [3.6%, 33.2%] 5
Improvements ✅
(primary)
-2.2% [-6.2%, -0.4%] 34
Improvements ✅
(secondary)
-3.1% [-7.5%, -0.7%] 135
All ❌✅ (primary) 7.2% [-6.2%, 63.6%] 61

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)
252.3% [0.9%, 2146.1%] 53
Regressions ❌
(secondary)
15.3% [1.8%, 67.8%] 68
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 252.3% [0.9%, 2146.1%] 53

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)
4.3% [0.0%, 63.4%] 155
Regressions ❌
(secondary)
3.4% [0.0%, 44.5%] 129
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.3% [0.0%, 63.4%] 155

Bootstrap: 633.508s -> 635.971s (0.39%)
Artifact size: 347.19 MiB -> 348.20 MiB (0.29%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 19, 2023
@workingjubilee
Copy link
Member

that's still pretty horrifying, tbh.

@workingjubilee
Copy link
Member

Something must be wrong though: We are not even seeing the reported wins on binary size?

@dpaoliello
Copy link
Contributor Author

Something must be wrong though: We are not even seeing the reported wins on binary size?

My testing was on Windows, where I was seeing minor improvements, whereas the Rust performance report is on Linux.

I can replicate the binary size regressions locally using WSL, so I'm going to dig into what's happening...

@dpaoliello
Copy link
Contributor Author

Looks like it's extra data in the symbol table - if I run strip --strip-unneeded then I'm seeing the binary savings that I would expect on Linux as well.

I'll see if I can figure out how to instruct LLVM not to include these names in the symbol table if debug info isn't enabled.

I've also found that part of the regression comes from building the standard library with debug info enabled, which results in that debug info being in the final binary even if it is built with --release.

@dpaoliello
Copy link
Contributor Author

I'm closing this PR for now: given the build-time regression and binary size regression (for Linux)

@dpaoliello dpaoliello closed this Aug 23, 2023
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-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-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.