@@ -210,8 +210,10 @@ In order to invoke the SIMD function, `invoke_simd` converts each argument
210
210
in the `args` parameter pack according to the following rules:
211
211
212
212
- Arguments of type `bool` are converted to type
213
- `sycl::ext::oneapi::experimental::simd_mask<bool, N>`, where `N` is the sub-group size of
214
- the calling kernel. Element `i` of the SIMD type represents the value from
213
+ `sycl::ext::oneapi::experimental::simd_mask<T, N>`, where `N` is the sub-group size of
214
+ the calling kernel, and `T` is a user-specified type supported by
215
+ `sycl::ext::oneapi::experimental::simd_mask`.
216
+ Element `i` of the SIMD type represents the value from
215
217
the work-item with sub-group local ID `i`.
216
218
217
219
- All other arithmetic arguments of type `T` are converted to type
@@ -241,7 +243,7 @@ cannot deduce the type of `Callable`.
241
243
The return value of an `invoke_simd` function is subject to the same mapping
242
244
rules in reverse:
243
245
244
- - Return values of type `sycl::ext::oneapi::experimental::simd_mask<bool , N>` are converted
246
+ - Return values of type `sycl::ext::oneapi::experimental::simd_mask<T , N>` are converted
245
247
to `bool`, and the value in element `i` of the SIMD type is returned to the
246
248
work-item with sub-group local ID `i`.
247
249
@@ -282,14 +284,14 @@ by this specification. Otherwise, the implementation must issue a proper diagnos
282
284
283
285
The following algorithm to determine the sub-group size may be employed:
284
286
- If any of the actual SPMD arguments is non-uniform, the specification requires
285
- that the corresponding SIMD argument must have `simd<T, N>` or `simd_mask<bool , N>`
287
+ that the corresponding SIMD argument must have `simd<T, N>` or `simd_mask<T , N>`
286
288
type, and `N` must be equal to the the sub-group size. The implementation may
287
289
iterate through the supported sub-group sizes at compile time and check whether the
288
290
function object is invocable with given sub-group size. There must be
289
291
exactly one such sub-group size and it must match `N` or the user program is not
290
292
well-formed.
291
293
- Otherwise, if the return type of the SIMD target function is `simd<T, N>` or
292
- `simd_mask<bool , N>`, then the sub-group size is `N`.
294
+ `simd_mask<T , N>`, then the sub-group size is `N`.
293
295
- Otherwise (all arguments and the return type are uniform) the SIMD target is
294
296
fully uniform and it can be invoked with any sub-group size.
295
297
@@ -312,7 +314,7 @@ sycl::ext::oneapi::experimental::simd<float, 8> scale(sycl::ext::oneapi::experim
312
314
return x * n;
313
315
}
314
316
315
- sycl::ext::oneapi::experimental::simd<float, 8> masked_scale(sycl::ext::oneapi::experimental::simd<float, 8> x, float n, sycl::ext::oneapi::experimental::simd_mask<bool , 8> mask)
317
+ sycl::ext::oneapi::experimental::simd<float, 8> masked_scale(sycl::ext::oneapi::experimental::simd<float, 8> x, float n, sycl::ext::oneapi::experimental::simd_mask<float , 8> mask)
316
318
{
317
319
std::experimental::where(mask, x) *= n;
318
320
return x;
@@ -330,7 +332,7 @@ q.parallel_for(..., sycl::nd_item<1> it) [[sycl::reqd_sub_group_size(8)]]
330
332
331
333
// invoke SIMD function with a mask parameter
332
334
// x values from each work-item be a simd<float, 8>
333
- // mask values from each work-item are combined into a simd_mask<bool , 8>
335
+ // mask values from each work-item are combined into a simd_mask<float , 8>
334
336
bool mask = (it.get_local_id(0) % 2);
335
337
float z = sycl::ext::oneapi::experimental::invoke_simd(sg, masked_scale, x, sycl::ext::oneapi::experimental::uniform(n), mask);
336
338
});
0 commit comments