Enable ThinLTO for rustc on x86_64-apple-darwin by lqd · Pull Request #103647 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation17 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

lqd

Member

@lqd lqd commented

Oct 27, 2022

• Loading

Local measurements seemed to show an improvement on a couple benchmarks, so I'd like to test real CI builds, and see if the builder doesn't timeout with the expected slight increase in build times.

Let's start with x64 rustc ThinLTO, and then figure out the file structure to configure LLVM ThinLTO. Maybe we'll then try aarch64 builds since that also looked good locally.

@lqd

@rustbot 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

Oct 27, 2022

@lqd

@bors

⌛ Trying commit 39bf1507ecf95e4f5b066de65cf9929a7650e1c3 with merge b4d23f6f6fd8602735600f2aa54e884005c277e8...

@bors

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

@lqd

The job completed in 2h57 which is maybe too close to a timeout ? Looking at the first couple pages of successful CI jobs, the range was from 2h16 to 2h45.

@lqd

(I've removed the CI hacks)

The only x86 darwin system I have access to is pretty noisy (old iMac), making the majority of the rustc-perf benchmarks to be avoided.

So I've tried the longer benchmarks, on full clean builds (not only the leaf crate like the perf collector does) it seems that on this machine the ThinLTOed rustc b4d23f6f6fd8602735600f2aa54e884005c277e8 is generally faster than the baseline 0da281b6068a7d889ae89a9bd8991284cc9b7535 by 1-2%. (Sometimes more, e.g. diesel-1.4.8, image-0.24.1 or keccak on check builds).

Two things would be interesting to know:

For the two questions above, I'll r? @Mark-Simulacrum to have your thoughts if that's OK.

@lqd lqd marked this pull request as ready for review

October 31, 2022 19:42

@lqd lqd changed the title[perf] Enable ThinLTO for rustc on x86_64-apple-darwin Enable ThinLTO for rustc on x86_64-apple-darwin

Oct 31, 2022

@lqd lqd mentioned this pull request

Nov 4, 2022

30 tasks

@Mark-Simulacrum

I'm not too worried about claiming this is a win for Macs if it was a win for Linux; that seems like a pretty reasonable claim in my eyes. Especially if we can have some validation on noisier machines.

That said I think making this switch will probably bring too high a cost at this time, given that these runners dominate our runtimes. It's a little bit annoying in the sense that making the change for just beta or similar might drive down our runtimes on nightly and give more room for this kind of optimization... I think if we don't see headroom through other ways (e.g., different CI runners, optimizations to the things running in them, etc) then it might be worth trying that. It feels relatively safe as a beta-exclusive (i.e. not on nightly or stable), since beta sees very little usage anyway.

@lqd

That makes sense, thanks a bunch.

I'll mark this blocked for now rather than close it outright (but feel free to do so if you prefer): so that we can revisit in the future and decide which of the two paths to take then.

@lqd lqd added S-blocked

Status: Blocked on something else such as an RFC or other implementation work.

and removed S-waiting-on-author

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

labels

Nov 7, 2022

@lqd

With the new osx builders from #105212, I believe we should now have the capacity to enable this change: @rustbot label -S-blocked

What do you think @Mark-Simulacrum, can we land this ?
@rustbot ready

@rustbot rustbot removed the S-blocked

Status: Blocked on something else such as an RFC or other implementation work.

label

Dec 7, 2022

@Mark-Simulacrum

Let's merge this, mostly so that we can get some data gathered on what the hit is. We'll reconsider if it is a significant increase that begins to drive the slowest builds again. For the record:

image

So looks like we're around 1 hour per apple dist builder right now.

@bors r+

@bors

📌 Commit 3a085f7 has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Dec 8, 2022

@bors

⌛ Testing commit 3a085f7 with merge 32d70cc436f06f18c510b2e964db6f7c21b5bbf3...

@bors

@bors bors added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

and removed S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

labels

Dec 8, 2022

@ehuss

@bors retry

Failed to update toolstate
(has been fixed)

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Dec 8, 2022

@rust-log-analyzer

This comment was marked as resolved.

@bors

@bors

@rust-timer

Finished benchmarking commit (bdb07a8): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

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) - - 0
Regressions ❌ (secondary) 3.0% [3.0%, 3.0%] 1
Improvements ✅ (primary) -0.9% [-0.9%, -0.9%] 1
Improvements ✅ (secondary) - - 0
All ❌✅ (primary) -0.9% [-0.9%, -0.9%] 1

Cycles

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

@lqd lqd deleted the osx-x64-lto branch

December 12, 2022 07:06

@lqd lqd mentioned this pull request

Dec 13, 2022

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request

Dec 13, 2022

@Dylan-DPC

Revert "enable ThinLTO for rustc on x86_64-apple-darwin dist builds"

Apparently ThinLTO on x64 mac can regress some of the ICEs' output. This reverts rust-lang#103647 to allow for investigation, and fixes rust-lang#105637 in the meantime.

bors added a commit to rust-lang-ci/rust that referenced this pull request

Dec 13, 2022

@bors

Revert "enable ThinLTO for rustc on x86_64-apple-darwin dist builds"

Apparently ThinLTO on x64 mac can regress some of the ICEs' output. This reverts rust-lang#103647 to allow for investigation, and helps with rust-lang#105637 in the meantime.

@lqd lqd mentioned this pull request

Dec 13, 2022

Aaron1011 pushed a commit to Aaron1011/rust that referenced this pull request

Jan 6, 2023

@bors

Enable ThinLTO for rustc on x86_64-apple-darwin

Local measurements seemed to show an improvement on a couple benchmarks, so I'd like to test real CI builds, and see if the builder doesn't timeout with the expected slight increase in build times.

Let's start with x64 rustc ThinLTO, and then figure out the file structure to configure LLVM ThinLTO. Maybe we'll then try aarch64 builds since that also looked good locally.

wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request

Mar 20, 2023

@he32

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request

Apr 8, 2023

@he32

Pkgsrc changes:

Upstream changes:

Version 1.68.2 (2023-03-28)

Version 1.68.1 (2023-03-23)

Version 1.68.0 (2023-03-09)

Language

Compiler

Libraries

Stabilized APIs

These APIs are now stable in const contexts:

Cargo

Misc

Compatibility Notes

nternal Changes

These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.

Version 1.67.0 (2023-01-26)

Language

Compiler

Added and removed targets:

Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.

Libraries

Stabilized APIs

These APIs are now stable in const contexts:

Compatibility Notes

Internal Changes

These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.

Labels

A-testsuite

Area: The testsuite used to check the correctness of rustc

merged-by-bors

This PR was explicitly merged by bors.

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

T-infra

Relevant to the infrastructure team, which will review and decide on the PR/issue.