@@ -115,92 +115,6 @@ struct AtomicIntegerImpl<T, 8> {
115
115
address, val, [](DTYPE a, DTYPE b) { return OP; }); \
116
116
}
117
117
118
- template <typename T, size_t n>
119
- struct AtomicIntegerImplLocal ;
120
-
121
- template <typename T>
122
- struct AtomicIntegerImplLocal <T, 1 > {
123
- template <typename func_t >
124
- inline void operator ()(T* address, T val, const func_t & func) {
125
- size_t offset = (size_t )address & 3 ;
126
- uint32_t * address_as_ui = (uint32_t *)((char *)address - offset);
127
- uint32_t assumed = *address_as_ui;
128
- uint32_t shift = offset * 8 ;
129
- uint32_t newval;
130
- uint32_t newval_byte;
131
- sycl_atomic_ref_rlx_wg_local_t <uint32_t > target (*address_as_ui);
132
-
133
- do {
134
- newval = assumed;
135
- newval_byte = (newval >> shift) & 0xff ;
136
- // preserve size in initial cast. Casting directly to uint32_t pads
137
- // negative signed values with 1's (e.g. signed -1 = unsigned ~0).
138
- newval = static_cast <uint8_t >(func (val, static_cast <T>(newval_byte)));
139
- newval = (assumed & ~(0x000000ff << shift)) | (newval << shift);
140
- } while (!target.compare_exchange_strong (assumed, newval));
141
- }
142
- };
143
-
144
- template <typename T>
145
- struct AtomicIntegerImplLocal <T, 2 > {
146
- template <typename func_t >
147
- inline void operator ()(T* address, T val, const func_t & func) {
148
- size_t offset = (size_t )address & 2 ;
149
- uint32_t * address_as_ui = (uint32_t *)((char *)address - offset);
150
- bool is_32_align = offset;
151
- uint32_t assumed = *address_as_ui;
152
- uint32_t newval;
153
- uint32_t newval_bytes;
154
- sycl_atomic_ref_rlx_wg_local_t <uint32_t > target (*address_as_ui);
155
-
156
- do {
157
- newval = assumed;
158
- newval_bytes = is_32_align ? newval >> 16 : newval & 0xffff ;
159
- // preserve size in initial cast. Casting directly to uint32_t pads
160
- // negative signed values with 1's (e.g. signed -1 = unsigned ~0).
161
- newval = static_cast <uint16_t >(func (val, static_cast <T>(newval_bytes)));
162
- newval = is_32_align ? (assumed & 0xffff ) | (newval << 16 )
163
- : (assumed & 0xffff0000 ) | newval;
164
- } while (!target.compare_exchange_strong (assumed, newval));
165
- }
166
- };
167
-
168
- template <typename T>
169
- struct AtomicIntegerImplLocal <T, 4 > {
170
- template <typename func_t >
171
- inline void operator ()(T* address, T val, const func_t & func) {
172
- uint32_t * address_as_ui = (uint32_t *)(address);
173
- uint32_t assumed = *address_as_ui;
174
- uint32_t newval;
175
- sycl_atomic_ref_rlx_wg_local_t <uint32_t > target (*address_as_ui);
176
-
177
- do {
178
- newval = static_cast <uint32_t >(func (val, static_cast <T>(assumed)));
179
- } while (!target.compare_exchange_strong (assumed, newval));
180
- }
181
- };
182
-
183
- template <typename T>
184
- struct AtomicIntegerImplLocal <T, 8 > {
185
- template <typename func_t >
186
- inline void operator ()(T* address, T val, const func_t & func) {
187
- unsigned long long * address_as_ull = (unsigned long long *)(address);
188
- unsigned long long assumed = *address_as_ull;
189
- unsigned long long newval;
190
- sycl_atomic_ref_rlx_wg_local_t <unsigned long long > target (*address_as_ull);
191
-
192
- do {
193
- newval = static_cast <uint64_t >(func (val, static_cast <T>(assumed)));
194
- } while (!target.compare_exchange_strong (assumed, newval));
195
- }
196
- };
197
-
198
- #define SYCL_ATOMIC_INTEGER_LOCAL (NAME, OP, DTYPE ) \
199
- static inline void atomic##NAME( \
200
- const sycl_local_ptr<DTYPE>& address, DTYPE val) { \
201
- AtomicIntegerImplLocal<DTYPE, sizeof (DTYPE)>()( \
202
- address, val, [](DTYPE a, DTYPE b) { return OP; }); \
203
- }
204
118
205
119
template <typename T>
206
120
struct AtomicFPImpl ;
@@ -361,11 +275,6 @@ SYCL_ATOMIC_INTEGER(Max, safe_max<int16_t>(a, b), int16_t)
361
275
SYCL_ATOMIC_INTEGER (Max, safe_max<int32_t >(a, b), int32_t )
362
276
SYCL_ATOMIC_INTEGER (Max, safe_max<int64_t >(a, b), int64_t )
363
277
364
- SYCL_ATOMIC_INTEGER_LOCAL (Max, safe_max<uint8_t >(a, b), uint8_t )
365
- SYCL_ATOMIC_INTEGER_LOCAL (Max, safe_max<int8_t >(a, b), int8_t )
366
- SYCL_ATOMIC_INTEGER_LOCAL (Max, safe_max<int16_t >(a, b), int16_t )
367
- SYCL_ATOMIC_INTEGER_LOCAL (Max, safe_max<int32_t >(a, b), int32_t )
368
- SYCL_ATOMIC_INTEGER_LOCAL (Max, safe_max<int64_t >(a, b), int64_t )
369
278
370
279
SYCL_ATOMIC_FP (Max, safe_max<float >(a, b), float )
371
280
SYCL_ATOMIC_FP (Max, safe_max<double >(a, b), double )
0 commit comments