29.7 Properties of Valid Executions
29.7.1 Valid Chosen Reads
A
- For each
ReadSharedMemory orReadModifyWriteSharedMemory event R ofSharedDataBlockEventSet (execution), do- Let chosenValueRecord be the element of execution.[[ChosenValues]] whose [[Event]] field is R.
- Let chosenValue be chosenValueRecord.[[ChosenValue]].
- Let readValue be
ValueOfReadEvent (execution, R). - Let chosenLen be the number of elements in chosenValue.
- Let readLen be the number of elements in readValue.
- If chosenLen ≠ readLen, then
- Return
false .
- Return
- If chosenValue[i] ≠ readValue[i] for some
integer i in theinterval from 0 (inclusive) to chosenLen (exclusive), then- Return
false .
- Return
- Return
true .
29.7.2 Coherent Reads
A
- For each
ReadSharedMemory orReadModifyWriteSharedMemory event R ofSharedDataBlockEventSet (execution), do- Let Ws be execution.[[ReadsBytesFrom]](R).
- Let byteLocation be R.[[ByteIndex]].
- For each element W of Ws, do
- If execution.[[HappensBefore]] contains (R, W), then
- Return
false .
- Return
- If there exists a
WriteSharedMemory orReadModifyWriteSharedMemory event V that has byteLocation in its range such that the pairs (W, V) and (V, R) are in execution.[[HappensBefore]], then- Return
false .
- Return
- Set byteLocation to byteLocation + 1.
- If execution.[[HappensBefore]] contains (R, W), then
- Return
true .
29.7.3 Tear Free Reads
A
- For each
ReadSharedMemory orReadModifyWriteSharedMemory event R ofSharedDataBlockEventSet (execution), do- If R.[[NoTear]] is
true , thenAssert : The remainder of dividing R.[[ByteIndex]] by R.[[ElementSize]] is 0.- For each event W such that execution.[[ReadsFrom]] contains (R, W) and W.[[NoTear]] is
true , do- If R and W have equal ranges and there exists an event V such that V and W have equal ranges, V.[[NoTear]] is
true , W is not V, and execution.[[ReadsFrom]] contains (R, V), then- Return
false .
- Return
- If R and W have equal ranges and there exists an event V such that V and W have equal ranges, V.[[NoTear]] is
- If R.[[NoTear]] is
- Return
true .
An event's [[NoTear]] field is
Intuitively, this requirement says when a memory range is accessed in an aligned fashion via an
29.7.4 Sequentially Consistent Atomics
For a
- For each pair (E, D) in execution.[[HappensBefore]], (E, D) is in memory-order.
-
For each pair (R, W) in execution.[[ReadsFrom]], there is no
WriteSharedMemory orReadModifyWriteSharedMemory event V inSharedDataBlockEventSet (execution) such that V.[[Order]] isseq-cst , the pairs (W, V) and (V, R) are in memory-order, and any of the following conditions are true.- execution.[[SynchronizesWith]] contains the pair (W, R), and V and R have equal ranges.
- The pairs (W, R) and (V, R) are in execution.[[HappensBefore]], W.[[Order]] is
seq-cst , and W and V have equal ranges. - The pairs (W, R) and (W, V) are in execution.[[HappensBefore]], R.[[Order]] is
seq-cst , and V and R have equal ranges.
Note 1 This clause additionally constrains
seq-cst events on equal ranges. -
For each
WriteSharedMemory orReadModifyWriteSharedMemory event W inSharedDataBlockEventSet (execution), if W.[[Order]] isseq-cst , then it is not the case that there is an infinite number ofReadSharedMemory orReadModifyWriteSharedMemory events inSharedDataBlockEventSet (execution) with equal range that is memory-order before W.Note 2
A
While memory-order includes all events in
29.7.5 Valid Executions
A
- The
host provides ahost-synchronizes-with Relation for execution.[[HostSynchronizesWith]]. - execution.[[HappensBefore]] is a
strict partial order . - execution has valid chosen reads.
- execution has coherent reads.
- execution has tear free reads.
- execution has sequentially consistent atomics.
All programs have at least one valid execution.