-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
<atomic>: ARM64 should use LDAR and STLR for weaker than full SC #83
Comments
I see there are intrinsics for ARM64 https://docs.microsoft.com/en-us/cpp/intrinsics/arm64-intrinsics?view=vs-2019 |
There are no ARM devices we target with ldar or stlr. |
Can't ARM64 device run 32-bit ARM code directly? Or it doesn't make sense? |
Yes, but I don't think ARM is doing the Intel-like thing where they bring all the features to 32 bit. (Unlike ia32 -> amd64, there are significant perf reasons to move to aarch64 in basically all cases, such as the doubled register count.) |
Are there plans to incorporate LDAR/STLR for full SC at some point? Otherwise it seems like developers targeting ARM64 with MSVC should avoid std::atomic and roll their own. |
We can't under the current ABI, that's what I meant by:
LDAR/STLR only provide full SC when used together, they don't provide it when used with any other form of barriers. |
I get that you don't want (or can't have) an ABI break, but doesn't having a slow seq_cst implementation devalue the class significantly? We were sold a future where seq_cst would be fast enough that we could ignore relaxed atomics and their pitfalls. |
All the developers on this project want an ABI break very much :D.
Yep! But nothing can be done about it now since intrinsics to ask the compiler for LDAR and STLR didn't exist when arm64 first shipped (locking our ABI) |
Can you clarify what "ABI break" means in this case? |
If you have an .obj with a function like:
compiled with VS 2017, the function
compiled with VS2022 and we changed
Just being in the same application isn't an issue; you could have |
So the problem happens only if we mix |
Yes, but std::atomic has no means of distinguishing between A and B. atomic<int> in the .obj from 2017 must remain the same when used from an .obj in 2021. (That’s kind of the whole meaning of ABI stability) |
According to ARM experts, we can't change our existing load + barrier without an ABI break for full SC support, but we can do so for the plain acquire_release orderings.
The text was updated successfully, but these errors were encountered: