Skip to content

Commit b86ef12

Browse files
committed
Specify that atomic_ref member operations with workitem scope are UB.
Addresses #1004.
1 parent b1fb5a4 commit b86ef12

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

adoc/chapters/programming_interface.adoc

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20687,6 +20687,10 @@ The [code]#sycl::atomic_ref# class has a template parameter
2068720687
scope for the atomic operations.
2068820688
Most member functions also provide an optional parameter that allows the
2068920689
application to override this default.
20690+
A member function must not be invoked with [code]#memory_scope::work_item#,
20691+
whether by using the default scope or by explicitly specifying a scope.
20692+
If a member function is invoked with [code]#memory_scope::work_item# the
20693+
behavior is undefined.
2069020694

2069120695
The [code]#sycl::atomic_ref# class also has a template parameter
2069220696
[code]#AddressSpace#, which allows the application to make an assertion about
@@ -20813,6 +20817,8 @@ void store(T operand, memory_order order = default_write_order,
2081320817
This function is only supported for 64-bit data types on devices that have
2081420818
[code]#aspect::atomic64#.
2081520819

20820+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
20821+
2081620822
a@
2081720823
[source]
2081820824
----
@@ -20832,6 +20838,8 @@ T load(memory_order order = default_read_order, memory_scope scope =
2083220838
or [code]#memory_order::seq_cst#. This function is only supported for
2083320839
64-bit data types on devices that have [code]#aspect::atomic64#.
2083420840

20841+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
20842+
2083520843
a@
2083620844
[source]
2083720845
----
@@ -20851,6 +20859,8 @@ T exchange(T operand, memory_order order = default_read_modify_write_order,
2085120859
This function is only supported for 64-bit data types on devices that have
2085220860
[code]#aspect::atomic64#.
2085320861

20862+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
20863+
2085420864
a@
2085520865
[source]
2085620866
----
@@ -20873,6 +20883,8 @@ successful. The [code]#failure# memory order of this atomic operation must be
2087320883
This function is only supported for 64-bit data types on devices that have
2087420884
[code]#aspect::atomic64#.
2087520885

20886+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
20887+
2087620888
a@
2087720889
[source]
2087820890
----
@@ -20894,6 +20906,7 @@ if (order == memory_order::acq_rel) {
2089420906
}
2089520907
return compare_exchange_weak(expected, desired, success, failure, scope);
2089620908
----
20909+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
2089720910

2089820911
a@
2089920912
[source]
@@ -20916,6 +20929,8 @@ successful. The [code]#failure# memory order of this atomic operation must be
2091620929
This function is only supported for 64-bit data types on devices that have
2091720930
[code]#aspect::atomic64#.
2091820931

20932+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
20933+
2091920934
a@
2092020935
[source]
2092120936
----
@@ -20959,6 +20974,8 @@ T fetch_add(T operand, memory_order order = default_read_modify_write_order,
2095920974
value of the referenced object. This function is only supported for 64-bit
2096020975
data types on devices that have [code]#aspect::atomic64#.
2096120976

20977+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
20978+
2096220979
a@
2096320980
[source]
2096420981
----
@@ -20992,6 +21009,8 @@ T fetch_sub(T operand, memory_order order = default_read_modify_write_order,
2099221009
value of the referenced object. This function is only supported for 64-bit
2099321010
data types on devices that have [code]#aspect::atomic64#.
2099421011

21012+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
21013+
2099521014
a@
2099621015
[source]
2099721016
----
@@ -21026,6 +21045,8 @@ T fetch_and(T operand, memory_order order = default_read_modify_write_order,
2102621045
for 64-bit data types on devices that have
2102721046
[code]#aspect::atomic64#.
2102821047

21048+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
21049+
2102921050
a@
2103021051
[source]
2103121052
----
@@ -21046,6 +21067,8 @@ T fetch_or(T operand, memory_order order = default_read_modify_write_order,
2104621067
for 64-bit data types on devices that have
2104721068
[code]#aspect::atomic64#.
2104821069

21070+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
21071+
2104921072
a@
2105021073
[source]
2105121074
----
@@ -21066,6 +21089,8 @@ T fetch_xor(T operand, memory_order order = default_read_modify_write_order,
2106621089
for 64-bit data types on devices that have
2106721090
[code]#aspect::atomic64#.
2106821091

21092+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
21093+
2106921094
a@
2107021095
[source]
2107121096
----
@@ -21086,6 +21111,8 @@ T fetch_min(T operand, memory_order order = default_read_modify_write_order,
2108621111
for 64-bit data types on devices that have
2108721112
[code]#aspect::atomic64#.
2108821113

21114+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
21115+
2108921116
a@
2109021117
[source]
2109121118
----
@@ -21099,6 +21126,8 @@ T fetch_max(T operand, memory_order order = default_read_modify_write_order,
2109921126
for 64-bit data types on devices that have
2110021127
[code]#aspect::atomic64#.
2110121128

21129+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
21130+
2110221131
|====
2110321132

2110421133

@@ -21120,6 +21149,8 @@ T fetch_add(T operand, memory_order order = default_read_modify_write_order,
2112021149
value of the referenced object. This function is only supported for 64-bit
2112121150
data types on devices that have [code]#aspect::atomic64#.
2112221151

21152+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
21153+
2112321154
a@
2112421155
[source]
2112521156
----
@@ -21139,6 +21170,8 @@ T fetch_sub(T operand, memory_order order = default_read_modify_write_order,
2113921170
value of the referenced object. This function is only supported for 64-bit
2114021171
data types on devices that have [code]#aspect::atomic64#.
2114121172

21173+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
21174+
2114221175
a@
2114321176
[source]
2114421177
----
@@ -21158,6 +21191,8 @@ T fetch_min(T operand, memory_order order = default_read_modify_write_order,
2115821191
original value of the referenced object. This function is only supported for
2115921192
64-bit data types on devices that have [code]#aspect::atomic64#.
2116021193

21194+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
21195+
2116121196
a@
2116221197
[source]
2116321198
----
@@ -21170,6 +21205,8 @@ T fetch_max(T operand, memory_order order = default_read_modify_write_order,
2117021205
original value of the referenced object. This function is only supported for
2117121206
64-bit data types on devices that have [code]#aspect::atomic64#.
2117221207

21208+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
21209+
2117321210
|====
2117421211

2117521212

@@ -21192,6 +21229,8 @@ T* fetch_add(ptrdiff_t operand,
2119221229
value of the referenced object. This function is only supported for 64-bit
2119321230
pointers on devices that have [code]#aspect::atomic64#.
2119421231

21232+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
21233+
2119521234
a@
2119621235
[source]
2119721236
----
@@ -21226,6 +21265,8 @@ T* fetch_sub(ptrdiff_t operand,
2122621265
value of the referenced object. This function is only supported for 64-bit
2122721266
pointers on devices that have [code]#aspect::atomic64#.
2122821267

21268+
The behavior is undefined if scope is [code]#memory_scope::work_item#.
21269+
2122921270
a@
2123021271
[source]
2123121272
----

0 commit comments

Comments
 (0)