(Simply|Strongly)? Happens Before
C++20以降のメモリモデル規定で重要な二項関係:
-
happens before
- フルスペック仕様(
consume
考慮あり)、非推移的
- フルスペック仕様(
-
simply happens before
-
consume
操作のない世界において推移的
-
-
strongly happens before
- 全てが
seq_cst
操作の世界において推移的
- 全てが
C++17では simply happens before 相当仕様が strongly happens before と呼ばれていた。C++20で名称変更。
Paper
Repairing Sequential Consistency in C/C++11
Common Compiler Optimisations are Invalid in the C11 Memory Model and what we can do about it
WG21
P0668R5: Revising the C++ memory model
Summarizing, we continue to have, as we did before:
(plain) happens-before
The fundamental relation used to reason about data races
strong happens before
The ordering relation usually promised by libraries to ensure usability and composability in all contextsThe simply-happens-before relation is an atifact of our definition. In the absence of
- memory_order_consume, and
- mixed use of both acquire/release and seq_cst operations on the same location
all three definitions coincide.
LWG3941. §[atomics.order] inadvertently prohibits widespread implementation techniques
(https://wg21.cmeerw.net/lwg/issue3941)
The problem here is an error during the attempt to simplify and translate plv.mpi-sws.org/scfix/paper.pdf to standardese. There is no known issue with the underlying paper.