Open tamird opened 2 years ago
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.
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.)
The standard library docs for AtomicU128
, etc. still point to #32976 instead of here.
What do you mean?
(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).
Apologies, I must have accidentally followed a link to somebody else's stale docs.
the trait bound std::sync::atomic::AtomicU128: mymod::_::_serde::Deserialize<'_>
is not satisfied. Where to fill an issue for that?
Now that https://github.com/rust-lang/rust/pull/120820/ has been merged, there are multiple T1 targets that support 128-bit atomics: x86_64-apple-darwin
, x86_64-pc-windows-msvc
and, x86_64-pc-windows-gnu
.
as well as a few lower-tier targets such as aarch64-unknown-linux-musl
, arm64e-apple-darwin
and aarch64-unknown-uefi
.
@m-ou-se @Amanieu Are there any remaining blockers for this that need to be addressed?
This will stabilize AtomicI128
and AtomicU128
for AArch64 and x86_64 Windows/Apple targets. Notably, AtomicI128
is not available on x86_64 Linux targets because they target a version of x86_64 without cmpxchg16b. On those targets, you can check for support at runtime and use the cmpxchg16b intrinsic.
@rfcbot fcp merge
Team member @Amanieu has proposed to merge this. The next step is review by the rest of the tagged team members:
No concerns currently listed.
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!
See this document for info about what commands tagged team members can give me.
@Amanieu Is this serving as a precedent for APIs that only work on a subset of targets?
To be clear, I'm all for exposing target-specific APIs wherever appropriate. I want to make sure we apply the policy this FCP is implying consistently. :)
Atomic types are already target-specific: AtomicU64
isn't available on some 32-bit targets for example. This isn't making things worse except that this difference is now noticeable on more common platforms.
:bell: This is now entering its final comment period, as per the review above. :bell:
AtomicI128
is not available on x86_64 Linux targets because they target a version of x86_64 without cmpxchg16b.
That's disappointing. Where can I learn more about this constraint and/or ideas for resolving it?
IIRC, the issue is that the Linux kernel, unlike Mac and Windows, does not require cmpxchg16b
. It was suggested that we could split the x86_64
Linux targets in two, one targeting a higher baseline than the other. But that's a compiler issue, not a libs issue.
The final comment period, with a disposition to merge, as per the review above, is now complete.
As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.
This will be merged soon.
As for the correctness of the current implementations:
-C target-{feature,cpu}
are used, I believe inline assembly would have been required to reproduce this in Rust. [^1]
I think this is a potential stabilization blocker.As for future 128-bit atomic support on other targets (not stabilization blockers):
x86_64_{v2,v3}-*
. I believe this has been discussed several times in the past), then these x86_64 Linux targets could also support 128-bit atomics (without manually doing CPU feature detection or using a library that provide 128-bit atomics in such a way).powerpc64le-*
targets) also supports 128-bit atomics, but the implementation by LLVM is still broken.[^1]: However, if future LLVM changes code generation to address performance issues with some chips (like https://github.com/taiki-e/portable-atomic/pull/89), it may be easily reproduced using Rust alone.
Interestingly, in the online documentation the types don't show up at all
Reported as #130474
- Since LLVM 18 (llvm/llvm-project@c568927), 128-bit atomics are fully supported on s390x. (However, the current minimum external LLVM version is 17.)
I'm updating the minimum to LLVM 18 in #130487.
We can try updating the s390x target spec separately though, after we make sure it's not also broken. :)
Since generic Atomic<T>
is in the process of being added (tracking issue), would it make sense to stabilise this as just Atomic<u128>
and Atomic<i128>
, rather than stabilising AtomicU128
and AtomicI128
only to have them made obsolete by Atomic<T>
shortly afterwards?
Tracking https://github.com/rust-lang/rfcs/pull/1543.
Seems related to https://github.com/rust-lang/rust/issues/56071. See also https://github.com/rust-lang/rust/pull/57425 which stabilized other atomic integer widths.