Skip to content

Conversation

@tgross35
Copy link
Contributor

@tgross35 tgross35 commented Dec 4, 2025

Many aarch64 targets without LSE in the baseline enable the
outline-atomics feature, which uses runtime detection of LSE for its
faster atomic ops. This provides nontrivial performance improvements on
most hardware from the past decade, at a small cost to anything pre-LSE.

This matches what Clang does 1.

Context: #144938

try-job: dist-x86_64-freebsd

@rustbot rustbot added A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 4, 2025
@tgross35 tgross35 force-pushed the freebsd-outline-atomics branch from fbeeee2 to baebc7a Compare December 4, 2025 08:58
@tgross35 tgross35 added the O-freebsd Operating system: FreeBSD label Dec 4, 2025
@tgross35 tgross35 marked this pull request as ready for review December 4, 2025 09:19
@tgross35
Copy link
Contributor Author

tgross35 commented Dec 4, 2025

This will make FreeBSD act the same as most other targets after #144938, which also has some more details (as does the Zulip discussion).

Cc target maintainers @asomers @MikaelUrankar, I split this off in case you would like to verify that this works since Clang doesn't have this enabled. Basically that means running some atomic ops with a debugger and making sure it uses the LSE fast path (details). Might be worth pinging some FreeBSD arm maintainers even if they don't work on Rust, in case they want to verify this or consider doing the same in Clang?

@bors2 try

@rustbot
Copy link
Collaborator

rustbot commented Dec 4, 2025

These commits modify compiler targets.
(See the Target Tier Policy.)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 4, 2025

r? @ibraheemdev

rustbot has assigned @ibraheemdev.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rust-bors bot added a commit that referenced this pull request Dec 4, 2025
Enable `outline-atomics` by default on AArch64 FreeBSD

try-job: dist-x86_64-freebsd
@rust-bors

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Dec 4, 2025

☀️ Try build successful (CI)
Build commit: d958a4b (d958a4b01d15d8f9e1cdf450fea6a6bcc7d0aced, parent: 556beb9ec72360512d0294eb0855c92fb2c20c88)

@brad0
Copy link
Contributor

brad0 commented Dec 16, 2025

Clang does not currently have this enabled on FreeBSD (search for IsAArch64OutlineAtomicsDefault there) but there doesn't seem to be any specific reason not. Thus, enable it here.

This comment is not true. I commited this 3 months ago.

[Driver] Enable outline atomics for FreeBSD/aarch64

Many aarch64 targets without LSE in the baseline enable the
`outline-atomics` feature, which uses runtime detection of LSE for its
faster atomic ops. This provides nontrivial performance improvements on
most hardware from the past decade, at a small cost to anything pre-LSE.

This matches what Clang does [1].

[1]: llvm/llvm-project@e24f901
@tgross35 tgross35 force-pushed the freebsd-outline-atomics branch from baebc7a to 383053e Compare December 16, 2025 22:07
@rustbot
Copy link
Collaborator

rustbot commented Dec 16, 2025

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.

@tgross35
Copy link
Contributor Author

Clang does not currently have this enabled on FreeBSD (search for IsAArch64OutlineAtomicsDefault there) but there doesn't seem to be any specific reason not. Thus, enable it here.

This comment is not true. I commited this 3 months ago.

[Driver] Enable outline atomics for FreeBSD/aarch64

Thanks for the link. This was split from #144938, the commit message predates the LLVM commit.

Any objections here then?

@tgross35
Copy link
Contributor Author

r? @davidtwco as you handled the others

@rustbot rustbot assigned davidtwco and unassigned ibraheemdev Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) O-freebsd Operating system: FreeBSD 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants