Skip to content

Tracking issue for integer_atomics (AtomicU128/AtomicI128) #99069

Open

Description

@tamird

Activity

  1. added
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    on Jul 8, 2022
  2. added 3 commits that reference this issue on Jul 9, 2022
  3. RalfJung commented on Jul 9, 2022

    @RalfJung
    Member

    It'd be good to list the APIs that are covered by this tracking issue, and copy any open questions that have been noted in the RFC of the previous tracking issue.

  4. added 2 commits that reference this issue on Jul 26, 2022
  5. kadiwa4 commented on Jul 28, 2022

    @kadiwa4
    Contributor

    The unstable ATOMIC_*_INIT constants can be removed, right? Or should they be stabilized for consistency with the stable ATOMIC_*_INIT constants? (All of them are deprecated.)

  6. eric-seppanen commented on Jan 17, 2023

    @eric-seppanen

    The standard library docs for AtomicU128, etc. still point to #32976 instead of here.

  7. kadiwa4 commented on Jan 17, 2023

    @kadiwa4
    Contributor

    What do you mean?
    image
    (rust 1.66.1)

    Interestingly, in the online documentation the types don't show up at all, whereas they do show up in my local copy (rust-docs from rustup).

  8. eric-seppanen commented on Jan 17, 2023

    @eric-seppanen

    Apologies, I must have accidentally followed a link to somebody else's stale docs.

  9. gitmalong commented on Mar 8, 2023

    @gitmalong

    the trait bound std::sync::atomic::AtomicU128: mymod::_::_serde::Deserialize<'_> is not satisfied. Where to fill an issue for that?

  10. 37 remaining items

  11. taiki-e commented on Apr 2, 2026

    @taiki-e
    Member

    @RalfJung

    The first of those (llvm/llvm-project#81978) is arguably an ABI problem. We need to ensure that for a given Rust target, no matter the target features (and no matter the backend!), we always use the same lowering for these atomic operations.

    This is a bug in the LLVM AArch64 backend, and not a limitation of the AArch64 atomic ABI itself.

    The lowering adopted in GCC and C/C++ Atomics Application Binary Interface Standard for the Arm® 64-bit Architecture is compatible regardless of the target features.

    LLVM's current lowering is the one that was also used in GCC in the past but was replaced with the new one because this issue was found.

    How does LLVM decide whether it uses armv8 vs armv8.4 lowering, when invoked as Rust backend?

    Whether FEAT_LSE2 (lse2 target feature) is available.

  12. tgross35 commented on Apr 2, 2026

    @tgross35
    Member

    On Linux at least it should be using lse2 on most newer hardware via runtime feature detection. This was expanded to other platforms in #144938 but unfortunately needed to be reverted (rust-lang/compiler-builtins#1063 will fix the issue).

  13. taiki-e commented on Apr 2, 2026

    @taiki-e
    Member

    @tgross35 outline-atomics is about FEAT_LSE, not FEAT_LSE2.

  14. folkertdev commented on Jul 9, 2026

    @folkertdev
    Contributor
  15. RalfJung commented on Jul 9, 2026

    @RalfJung
    Member

    Are x86-64 and aarch64 the only targets where 128bit atomics are supported, or are there other targets we have to worry about?

  16. tgross35 commented on Jul 9, 2026

    @tgross35
    Member

    https://github.com/taiki-e/portable-atomic/blob/c8a25378a8dd54ba2450d38f6fe5c5e1c9558ca1/src/imp/atomic128/README.md has a list. It looks like at least rv64, ppc64, and s390x have implementations, all requiring non-baseline target features.

    If we have different confidence levels for different arches, maybe it would be fine to stabilize by arch? That way we can at least provide aarch64 and possibly x86 at the next LLVM bump, and add the others after they've gotten a bit more proven out.

    Cranelift doesn't yet support 128bit atomics. I've had to patch them out when building the standard library for arm64 using cg_clif for this reason: https://github.com/rust-lang/rustc_codegen_cranelift/blob/5bbb9e4f6618aa7c32bde230875fa36608e60bdf/patches/0027-stdlib-128bit-atomic-operations.patch, https://github.com/rust-lang/rustc_codegen_cranelift/blob/5bbb9e4f6618aa7c32bde230875fa36608e60bdf/patches/0027-sysroot_tests-128bit-atomic-operations.patch, https://github.com/rust-lang/rustc_codegen_cranelift/blob/5bbb9e4f6618aa7c32bde230875fa36608e60bdf/src/intrinsics/mod.rs#L862-L877

    Couldn't clif just unset target_has_atomic_load_store = "128"?

  17. bjorn3 commented on Jul 9, 2026

    @bjorn3
    Member

    Couldn't clif just unset target_has_atomic_load_store = "128"?

    No, codegen backends can't change the target spec.

  18. RalfJung commented on Jul 9, 2026

    @RalfJung
    Member

    Codegen backends can already change cfg(target_features), sounds like we should wire something up so they can also adjust the cfgs for atomics.

  19. RalfJung commented on Jul 9, 2026

    @RalfJung
    Member

    The bigger problem is that we currently support mixing crates built with different codegen backends. The distributed std is built with LLVM so the 128bit atomic types will be available downstream even if downstream uses cranelift.

    OTOH I don't think we should block 128bit atomics on cranelift support. I'm fine with waiting a few months for some work-in-progress support on the cranelift side to complete, but blocking indefinitely while our default backend has support would not be great.

  20. taiki-e commented on Jul 17, 2026

    @taiki-e
    Member

    https://github.com/taiki-e/portable-atomic/blob/c8a25378a8dd54ba2450d38f6fe5c5e1c9558ca1/src/imp/atomic128/README.md has a list. It looks like at least rv64, ppc64, and s390x have implementations, all requiring non-baseline target features.

    It is also available in the baseline of s390x and little-endian powerpc64; rustc enables 128-bit atomics for the former (#130558). It is not enabled for the latter due to an LLVM bugs. See my above comment (#99069 (comment)) for more about these targets.

    (By the way, on riscv64, LLVM does not generate 128-bit atomics even when the necessary feature is enabled (due to ABI compatibility). On loongarch64, LLVM generates 128-bit atomics only for a few operations when the necessary feature is enabled, but the implementation is quite incomplete, e.g., failed CAS may return corrupted values.)

  21. added
    T-libsRelevant to the library team, which will review and decide on the PR/issue.
    and removed
    T-libs-api[DEPRECATED; DO NOT USE]
    on Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-atomicArea: Atomics, barriers, and sync primitivesA-concurrencyArea: ConcurrencyC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libsRelevant to the library team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions