After a release operation A is performed on an atomic object M, the longest continuous subsequence of the modification order of M that consists of:
- Writes performed by the same thread that performed A. (until C++20)
- Atomic read-modify-write operations made to M by any thread. Is known as release sequence headed by A.
Q1: Why do we need the concept of release sequence?
Q2: Is the first item removed in C++20?
Q3: Why read-modify-write operations qualify in a release sequence but pure write operations don't?
What's special about relaxed RMWs that lets them form a chain without being an acquire load and release store? Either in computer-architecture terms, or in C++ language formalism? Or to put it another way, how can hardware support release-sequence semantics for atomic RMWs but have pure stores that break connections?
release
store by the same thread starts a new release-sequence, but everything before the previousrelease
store is also before the later one. So that "writes performed by the same thread" guarantee was only relevant forrelaxed
stores, which is indeed weird. Thanks for the WG21 link on the motivation. I'm curious what hypothetical hardware design would be constrained by that; the writeup suggests that there could be some, unless they actually just meant that supporting the RMW-from-other-cores part of release sequences was a burden on current designs. – Legalx.store(x.load(relaxed), relaxed)
would on paper, if that's what you mean. Reads aren't part of the modification order, they just observe a point in it. – Legal