1010
1111
1212class AtomicRef :
13- """Analogue to the ``sycl::atomic_ref`` type. An atomic reference is a
14- view into a data container that can be then updated atomically using any of
15- the ``fetch_*`` member functions of the class.
13+ """Analogue to the ``sycl::atomic_ref`` class.
14+
15+ An atomic reference is a view into a data container that can be then updated
16+ atomically using any of the ``fetch_*`` member functions of the class.
1617 """
1718
1819 def __init__ ( # pylint: disable=too-many-arguments
@@ -66,7 +67,6 @@ def fetch_add(self, val):
6667 val : Value to be added to the object referenced by the AtomicRef.
6768
6869 Returns: The original value of the object referenced by the AtomicRef.
69-
7070 """
7171 old = self ._ref [self ._index ].copy ()
7272 self ._ref [self ._index ] += val
@@ -79,10 +79,9 @@ def fetch_sub(self, val):
7979
8080 Args:
8181 val : Value to be subtracted from the object referenced by the
82- AtomicRef.
82+ AtomicRef.
8383
8484 Returns: The original value of the object referenced by the AtomicRef.
85-
8685 """
8786 old = self ._ref [self ._index ].copy ()
8887 self ._ref [self ._index ] -= val
@@ -95,10 +94,9 @@ def fetch_min(self, val):
9594
9695 Args:
9796 val : Value to be compared against the object referenced by the
98- AtomicRef.
97+ AtomicRef.
9998
10099 Returns: The original value of the object referenced by the AtomicRef.
101-
102100 """
103101 old = self ._ref [self ._index ].copy ()
104102 self ._ref [self ._index ] = min (old , val )
@@ -111,10 +109,9 @@ def fetch_max(self, val):
111109
112110 Args:
113111 val : Value to be compared against the object referenced by the
114- AtomicRef.
112+ AtomicRef.
115113
116114 Returns: The original value of the object referenced by the AtomicRef.
117-
118115 """
119116 old = self ._ref [self ._index ].copy ()
120117 self ._ref [self ._index ] = max (old , val )
@@ -127,10 +124,9 @@ def fetch_and(self, val):
127124
128125 Args:
129126 val : Value to be bitwise ANDed against the object referenced by
130- the AtomicRef.
127+ the AtomicRef.
131128
132129 Returns: The original value of the object referenced by the AtomicRef.
133-
134130 """
135131 old = self ._ref [self ._index ].copy ()
136132 self ._ref [self ._index ] &= val
@@ -143,10 +139,9 @@ def fetch_or(self, val):
143139
144140 Args:
145141 val : Value to be bitwise ORed against the object referenced by
146- the AtomicRef.
142+ the AtomicRef.
147143
148144 Returns: The original value of the object referenced by the AtomicRef.
149-
150145 """
151146 old = self ._ref [self ._index ].copy ()
152147 self ._ref [self ._index ] |= val
@@ -159,7 +154,7 @@ def fetch_xor(self, val):
159154
160155 Args:
161156 val : Value to be bitwise XORed against the object referenced by
162- the AtomicRef.
157+ the AtomicRef.
163158
164159 Returns: The original value of the object referenced by the AtomicRef.
165160
@@ -172,54 +167,49 @@ def load(self):
172167 """Loads the value of the object referenced by the AtomicRef.
173168
174169 Returns: The value of the object referenced by the AtomicRef.
175-
176170 """
177171 return self ._ref [self ._index ]
178172
179173 def store (self , val ):
180174 """Stores operand ``val`` to the object referenced by the AtomicRef.
181175
182176 Args:
183- val : Value to be stored in the object referenced by
184- the AtomicRef.
185-
177+ val : Value to be stored in the object referenced by the AtomicRef.
186178 """
187179 self ._ref [self ._index ] = val
188180
189181 def exchange (self , val ):
190182 """Replaces the value of the object referenced by the AtomicRef
191- with value of ``val``. Returns the original value of the referenced object.
183+ with value of ``val``. Returns the original value of the referenced
184+ object.
192185
193186 Args:
194187 val : Value to be exchanged against the object referenced by
195- the AtomicRef.
188+ the AtomicRef.
196189
197190 Returns: The original value of the object referenced by the AtomicRef.
198-
199191 """
200192 old = self ._ref [self ._index ].copy ()
201193 self ._ref [self ._index ] = val
202194 return old
203195
204196 def compare_exchange (self , expected , desired , expected_idx = 0 ):
205197 """Compares the value of the object referenced by the AtomicRef
206- against the value of ``expected[expected_idx]``.
207- If the values are equal, replaces the value of the
208- referenced object with the value of ``desired``.
209- Otherwise assigns the original value of the
210- referenced object to ``expected[expected_idx]``.
198+ against the value of ``expected[expected_idx]``. If the values are
199+ equal, replaces the value of the referenced object with the value of
200+ ``desired``. Otherwise assigns the original value of the referenced
201+ object to ``expected[expected_idx]``.
211202
212203 Args:
213- expected : Array containing the expected value of the
214- object referenced by the AtomicRef.
215- desired : Value that replaces the value of the object
216- referenced by the AtomicRef.
204+ expected : Array containing the expected value of the object
205+ referenced by the AtomicRef.
206+ desired : Value that replaces the value of the object referenced by
207+ the AtomicRef.
217208 expected_idx: Offset in `expected` array where the expected
218209 value of the object referenced by the AtomicRef is present.
219210
220- Returns: Returns ``True`` if the comparison operation and
221- replacement operation were successful.
222-
211+ Returns: ``True`` if the comparison operation and replacement operation
212+ were successful.
223213 """
224214 if self ._ref [self ._index ] == expected [expected_idx ]:
225215 self ._ref [self ._index ] = desired
0 commit comments