Skip to content

Commit 0665b69

Browse files
committed
Clarify which atomic operations synchronize
The ISO C++ synchronizes-with relationship does not account for scopes. The scopes do not need to match exactly, but there are restrictions on which pairs of scopes are valid. This is the final part of the clarification for work-item scope atomics; a work-item scope atomic cannot sychronize with the atomic operations performed by other work-items, and so their effects are not guaranteed to be visible to other work-items without some other synchronization taking place.
1 parent 1141414 commit 0665b69

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

adoc/chapters/architecture.adoc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,12 @@ programming and to provide a meaningful way to describe the behavior of
10991099
Potentially concurrent conflicting actions with different memory scopes are
11001100
considered a data race, resulting in undefined behavior.
11011101

1102+
An atomic operation _A_ with scope _S~1~_ can only synchronize with another
1103+
atomic operation _B_ with scope _S~2~_ if:
1104+
1105+
* The work-item which executed _A_ is in both _S~1~_ and _S~2~_; and
1106+
* The work-item which executed _B_ is in both _S~1~_ and _S~2~_.
1107+
11021108
The memory scopes are listed above from narrowest
11031109
([code]#memory_scope::work_item#) to widest ([code]#memory_scope::system#).
11041110

@@ -1119,10 +1125,9 @@ supplied.
11191125
====
11201126
The addition of memory scopes to the {cpp} memory model modifies the definition
11211127
of some concepts from the {cpp} core language.
1122-
For example: the synchronizes-with relationship and sequential consistency must
1123-
be defined in a way that accounts for atomic operations with differing (but
1124-
compatible) scopes, in a manner similar to the <<opencl20, OpenCL 2.0
1125-
specification>>.
1128+
For example: sequential consistency must be defined in a way that accounts for
1129+
atomic operations with differing (but compatible) scopes, in a manner similar to
1130+
the <<opencl20, OpenCL 2.0 specification>>.
11261131
Efforts to formalize the memory model of SYCL are ongoing, and a formal memory
11271132
model will be included in a future version of the SYCL specification.
11281133
====

0 commit comments

Comments
 (0)