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.

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.

Based on #144938 which needs to land first (this PR is only meant to cover the final commit).

try-job: dist-x86_64-freebsd

Build outline atomic symbols on all targets that have `outline-atomics`
enabled, rather than only on Linux. Since this is no longer OS-specific,
also rename the module.
Change the gating and link sections to enable this for any platforms
that enable `outline-atomics`, rather than only Linux. Additionally, no
longer run this if LSE is available, since in this case the outline
versions will never be called.
@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
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.

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.
@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)

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.

3 participants