-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Enable outline-atomics by default on more AArch64 platforms
#144938
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
Merged
Merged
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
Collaborator
|
r? @ChrisDenton rustbot has assigned @ChrisDenton. Use |
Collaborator
|
These commits modify compiler targets. |
Contributor
Author
|
Whoops r? @ghost |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
rust-bors bot
added a commit
that referenced
this pull request
Aug 5, 2025
[experiment] enable outline-atomics on more aarch64 platforms try-job: arm-android try-job: dist-android try-job: dist-x86_64-freebsd try-job: dist-aarch64-windows-gnullvm try-job: dist-aarch64-apple try-job: aarch64-msvc-1 try-job: aarch64-msvc-2 try-job: dist-aarch64-msvc
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
rust-bors bot
added a commit
that referenced
this pull request
Aug 5, 2025
[experiment] enable outline-atomics on more aarch64 platforms try-job: arm-android try-job: dist-android try-job: dist-x86_64-freebsd try-job: dist-aarch64-windows-gnullvm try-job: dist-aarch64-apple try-job: aarch64-msvc-1 try-job: aarch64-msvc-2 try-job: dist-aarch64-msvc
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
a25e101 to
e20add7
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
rust-bors bot
added a commit
that referenced
this pull request
Sep 5, 2025
Enable outline-atomics by default on more aarch64 platforms try-job: aarch64-apple try-job: aarch64-msvc-1 try-job: aarch64-msvc-2 try-job: arm-android try-job: dist-android try-job: dist-aarch64-windows-gnullvm try-job: dist-aarch64-apple try-job: dist-aarch64-msvc try-job: dist-various try-job: dist-x86_64-freebsd
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Windows has a similar flag `/forceInterlockedFunctions`, which uses names such as `_InterlockedAdd64_rel`.
Per LLVM commit c5e7e64 ("[AArch64][Clang][Linux] Enable out-of-line atomics by default.") [1], Clang enables these on Android. Thus, do the same in Rust. [1]: llvm/llvm-project@c5e7e649d537067de
Clang has done this by default since LLVM commit 1a963d3 ("[Driver] Make -moutline-atomics default for aarch64-fuchsia targets"), [1], so do the same here. [1]: llvm/llvm-project@1a963d3
Clang has recently started doing this, as of LLVM commit 5d774ec8d183
("[Driver] Enable outline atomics for OpenBSD/aarch64") [1]. Thus, do
the same here.
[1]: llvm/llvm-project@5d774ec
4401f9c to
66c150c
Compare
This was referenced Dec 4, 2025
Contributor
Author
|
@bors2 try |
rust-bors bot
added a commit
that referenced
this pull request
Dec 4, 2025
Enable `outline-atomics` by default on more AArch64 platforms try-job: aarch64-msvc-* try-job: arm-android try-job: dist-android try-job: dist-aarch64-windows-gnullvm try-job: dist-aarch64-msvc try-job: dist-various-* try-job: test-various
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Contributor
Author
Contributor
Author
|
@bors2 try |
This comment has been minimized.
This comment has been minimized.
rust-bors bot
added a commit
that referenced
this pull request
Dec 4, 2025
Enable `outline-atomics` by default on more AArch64 platforms try-job: aarch64-msvc-* try-job: arm-android try-job: dist-android try-job: dist-aarch64-llvm-mingw try-job: dist-aarch64-msvc try-job: dist-various-* try-job: test-various
davidtwco
approved these changes
Dec 9, 2025
Member
|
@bors r+ rollup |
Collaborator
bors
added a commit
that referenced
this pull request
Dec 9, 2025
Rollup of 5 pull requests Successful merges: - #144938 (Enable `outline-atomics` by default on more AArch64 platforms) - #146579 (Handle macro invocation in attribute during parse) - #149400 (unstable proc_macro tracked::* rename/restructure) - #149664 (attempt to fix unreachable code regression ) - #149806 (Mirror `ubuntu:24.04` on ghcr) Failed merges: - #149789 (Cleanup in the attribute parsers) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
that referenced
this pull request
Dec 9, 2025
Rollup of 5 pull requests Successful merges: - #144938 (Enable `outline-atomics` by default on more AArch64 platforms) - #146579 (Handle macro invocation in attribute during parse) - #149400 (unstable proc_macro tracked::* rename/restructure) - #149664 (attempt to fix unreachable code regression ) - #149806 (Mirror `ubuntu:24.04` on ghcr) Failed merges: - #149789 (Cleanup in the attribute parsers) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Dec 10, 2025
Rollup merge of #144938 - tgross35:more-outline-atomics, r=davidtwco Enable `outline-atomics` by default on more AArch64 platforms The baseline Armv8.0 ISA doesn't have atomics instructions, but in practice most hardware is at least Armv8.1-A (2014), which includes single-instruction atomics as part of the LSE feature. As a performance optimization for these cases, GCC and LLVM have the `-moutline-atomics` flag to turn atomic operations into calls to symbols like `__aarch64_cas1_acq`. These can do runtime feature detection and use the LSE instructions if available, falling back to more portable load-exclusive/store-exclusive loops. Since the recent 3b50253 ("compiler-builtins: plumb LSE support for aarch64 on linux") our builtins support this LSE optimization, and since 6936bb9 ("Dynamically enable LSE for aarch64 rust provided intrinsics"), std will set the flag as part of its startup code. The first commit in this PR configures this to work on all platforms built with `outline-atomics`, not just Linux. Thus, enable `outline-atomics` by default on Android, OpenBSD, Windows, and Fuchsia platforms that don't have LSE in the baseline. The feature is already enabled on Linux. Platform-specific details are included in each commit message. The current implementation can still be accessed by setting `-Ctarget-feature=-outline-atomics`. Setting `-Ctarget-feature=+lse` or a relevant CPU will use the single-instruction atomics without the call overhead. https://rust.godbolt.org/z/dsdrzszoe Link: https://learn.arm.com/learning-paths/servers-and-cloud-computing/lse/intro/ Original Clang outline-atomics benchmarks: https://reviews.llvm.org/D91157#2435844 try-job: aarch64-msvc-* try-job: arm-android try-job: dist-android try-job: dist-aarch64-llvm-mingw try-job: dist-aarch64-msvc try-job: dist-various-* try-job: test-various
github-actions bot
pushed a commit
to rust-lang/compiler-builtins
that referenced
this pull request
Dec 11, 2025
Rollup of 5 pull requests Successful merges: - rust-lang/rust#144938 (Enable `outline-atomics` by default on more AArch64 platforms) - rust-lang/rust#146579 (Handle macro invocation in attribute during parse) - rust-lang/rust#149400 (unstable proc_macro tracked::* rename/restructure) - rust-lang/rust#149664 (attempt to fix unreachable code regression ) - rust-lang/rust#149806 (Mirror `ubuntu:24.04` on ghcr) Failed merges: - rust-lang/rust#149789 (Cleanup in the attribute parsers) r? `@ghost` `@rustbot` modify labels: rollup
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)
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The baseline Armv8.0 ISA doesn't have atomics instructions, but in
practice most hardware is at least Armv8.1-A (2014), which includes
single-instruction atomics as part of the LSE feature. As a performance
optimization for these cases, GCC and LLVM have the
-moutline-atomicsflagto turn atomic operations into calls to symbols like
__aarch64_cas1_acq.These can do runtime feature detection and use the LSE instructions if
available, falling back to more portable load-exclusive/store-exclusive
loops.
Since the recent 3b50253 ("compiler-builtins: plumb LSE support
for aarch64 on linux") our builtins support this LSE optimization, and
since 6936bb9 ("Dynamically enable LSE for aarch64 rust provided
intrinsics"), std will set the flag as part of its startup code. The first
commit in this PR configures this to work on all platforms built with
outline-atomics, not just Linux.Thus, enable
outline-atomicsby default on Android, OpenBSD, Windows,and Fuchsia platforms that don't have LSE in the baseline. The feature is
already enabled on Linux. Platform-specific details are included in each
commit message.
The current implementation can still be accessed by setting
-Ctarget-feature=-outline-atomics. Setting-Ctarget-feature=+lseora relevant CPU will use the single-instruction atomics without the call
overhead. https://rust.godbolt.org/z/dsdrzszoe
Link: https://learn.arm.com/learning-paths/servers-and-cloud-computing/lse/intro/
Original Clang outline-atomics benchmarks: https://reviews.llvm.org/D91157#2435844
try-job: aarch64-msvc-*
try-job: arm-android
try-job: dist-android
try-job: dist-aarch64-llvm-mingw
try-job: dist-aarch64-msvc
try-job: dist-various-*
try-job: test-various