36 template <
typename Ptr,
typename T>
42 std::is_trivially_copyable<T>::value &&
47 template <
typename T,
typename BinaryOperation>
53 template <
typename T,
typename BinaryOperation>
60 template <
typename T,
typename BinaryOperation>
64 std::is_trivially_copyable<T>::value) ||
68 template <
typename Group>
70 "ext::oneapi::all_of is deprecated. Use all_of_group instead.")
76 template <
typename Group,
typename T,
class Predicate>
78 "ext::oneapi::all_of is deprecated. Use all_of_group instead.")
80 Group g,
T x, Predicate pred) {
84 template <
typename Group,
typename Ptr,
class Predicate>
86 "ext::oneapi::all_of is deprecated. Use joint_all_of instead.")
89 bool>
all_of(Group g, Ptr first, Ptr last, Predicate pred) {
93 template <
typename Group>
95 "ext::oneapi::any_of is deprecated. Use any_of_group instead.")
101 template <
typename Group,
typename T,
class Predicate>
103 "ext::oneapi::any_of is deprecated. Use any_of_group instead.")
105 Group g,
T x, Predicate pred) {
109 template <
typename Group,
typename Ptr,
class Predicate>
111 "ext::oneapi::any_of is deprecated. Use joint_any_of instead.")
114 bool>
any_of(Group g, Ptr first, Ptr last, Predicate pred) {
118 template <
typename Group>
120 "ext::oneapi::none_of is deprecated. Use none_of_group instead.")
122 Group g,
bool pred) {
126 template <
typename Group,
typename T,
class Predicate>
128 "ext::oneapi::none_of is deprecated. Use none_of_group instead.")
130 Group g,
T x, Predicate pred) {
134 template <
typename Group,
typename Ptr,
class Predicate>
136 "ext::oneapi::none_of is deprecated. Use joint_none_of instead.")
139 bool>
none_of(Group g, Ptr first, Ptr last,
144 template <
typename Group,
typename T>
146 "ext::oneapi::broadcast is deprecated. Use group_broadcast instead.")
148 std::is_trivially_copyable<
T>::value &&
150 T> broadcast(Group,
T x, typename Group::id_type local_id) {
151 #ifdef __SYCL_DEVICE_ONLY__
152 return sycl::detail::spirv::GroupBroadcast<Group>(x, local_id);
156 throw runtime_error(
"Group algorithms are not supported on host device.",
161 template <
typename Group,
typename T>
163 "ext::oneapi::broadcast is deprecated. Use group_broadcast instead.")
166 T> broadcast(Group g, T x,
167 typename Group::id_type local_id) {
168 #ifdef __SYCL_DEVICE_ONLY__
170 for (
int s = 0;
s < x.get_size(); ++
s) {
171 result[
s] = broadcast(g, x[
s], local_id);
178 throw runtime_error(
"Group algorithms are not supported on host device.",
183 template <
typename Group,
typename T>
185 "ext::oneapi::broadcast is deprecated. Use group_broadcast instead.")
186 detail::
enable_if_t<(detail::is_generic_group<Group>::value &&
187 std::is_trivially_copyable<T>::value &&
188 !detail::is_vector_arithmetic<T>::value),
189 T> broadcast(Group g, T x,
190 typename Group::linear_id_type
192 #ifdef __SYCL_DEVICE_ONLY__
199 (void)linear_local_id;
200 throw runtime_error(
"Group algorithms are not supported on host device.",
205 template <
typename Group,
typename T>
207 "ext::oneapi::broadcast is deprecated. Use group_broadcast instead.")
208 detail::
enable_if_t<(detail::is_generic_group<Group>::value &&
209 detail::is_vector_arithmetic<
T>::value),
210 T> broadcast(Group g,
T x,
211 typename Group::linear_id_type
213 #ifdef __SYCL_DEVICE_ONLY__
215 for (
int s = 0;
s < x.get_size(); ++
s) {
216 result[
s] = broadcast(g, x[
s], linear_local_id);
222 (void)linear_local_id;
223 throw runtime_error(
"Group algorithms are not supported on host device.",
228 template <
typename Group,
typename T>
230 "ext::oneapi::broadcast is deprecated. Use group_broadcast instead.")
231 detail::
enable_if_t<(detail::is_generic_group<Group>::value &&
232 std::is_trivially_copyable<
T>::value &&
233 !detail::is_vector_arithmetic<
T>::value),
234 T> broadcast(Group g,
T x) {
235 #ifdef __SYCL_DEVICE_ONLY__
236 return broadcast(g, x, 0);
240 throw runtime_error(
"Group algorithms are not supported on host device.",
245 template <
typename Group,
typename T>
247 "ext::oneapi::broadcast is deprecated. Use group_broadcast instead.")
248 detail::
enable_if_t<(detail::is_generic_group<Group>::value &&
249 detail::is_vector_arithmetic<
T>::value),
250 T> broadcast(Group g,
T x) {
251 #ifdef __SYCL_DEVICE_ONLY__
253 for (
int s = 0;
s < x.get_size(); ++
s) {
254 result[
s] = broadcast(g, x[
s]);
260 throw runtime_error(
"Group algorithms are not supported on host device.",
265 template <
typename Group,
typename T,
class BinaryOperation>
267 "ext::oneapi::reduce is deprecated. Use reduce_over_group instead.")
271 T>
reduce(Group g,
T x, BinaryOperation binary_op) {
275 template <
typename Group,
typename T,
class BinaryOperation>
277 "ext::oneapi::reduce is deprecated. Use reduce_over_group instead.")
281 T>
reduce(Group g, T x, BinaryOperation binary_op) {
285 template <
typename Group,
typename T,
class BinaryOperation>
287 "ext::oneapi::reduce is deprecated. Use reduce_over_group instead.")
289 std::is_trivially_copyable<T>::value &&
292 T>
reduce(Group g, T x, BinaryOperation op) {
294 for (
int mask = 1; mask < g.get_max_local_range()[0]; mask *= 2) {
295 T tmp = g.shuffle_xor(result,
id<1>(mask));
296 if ((g.get_local_id()[0] ^ mask) < g.get_local_range()[0]) {
297 result = op(result, tmp);
300 return g.shuffle(result, 0);
303 template <
typename Group,
typename V,
typename T,
class BinaryOperation>
305 "ext::oneapi::reduce is deprecated. Use reduce_over_group instead.")
311 T>
reduce(Group g, V x,
T init, BinaryOperation binary_op) {
315 template <
typename Group,
typename V,
typename T,
class BinaryOperation>
317 "ext::oneapi::reduce is deprecated. Use reduce_over_group instead.")
323 T>
reduce(Group g, V x, T init, BinaryOperation binary_op) {
327 template <
typename Group,
typename V,
typename T,
class BinaryOperation>
329 "ext::oneapi::reduce is deprecated. Use reduce_over_group instead.")
331 std::is_trivially_copyable<T>::value &&
332 std::is_trivially_copyable<V>::value &&
336 T>
reduce(Group g, V x, T init, BinaryOperation op) {
338 for (
int mask = 1; mask < g.get_max_local_range()[0]; mask *= 2) {
339 T tmp = g.shuffle_xor(result,
id<1>(mask));
340 if ((g.get_local_id()[0] ^ mask) < g.get_local_range()[0]) {
341 result = op(result, tmp);
344 return g.shuffle(op(init, result), 0);
347 template <
typename Group,
typename Ptr,
class BinaryOperation>
349 "ext::oneapi::reduce is deprecated. Use joint_reduce instead.")
360 template <
typename Group,
typename Ptr,
typename T,
class BinaryOperation>
362 "ext::oneapi::reduce is deprecated. Use joint_reduce instead.")
368 BinaryOperation>::value &&
370 T>
reduce(Group g, Ptr first, Ptr last,
T init, BinaryOperation binary_op) {
374 template <
typename Group,
typename T,
class BinaryOperation>
376 "exclusive_scan_over_group instead.")
380 T> exclusive_scan(Group g,
T x, BinaryOperation binary_op) {
384 template <
typename Group,
typename T,
class BinaryOperation>
386 "exclusive_scan_over_group instead.")
390 T> exclusive_scan(Group g, T x, BinaryOperation binary_op) {
394 template <
typename Group,
typename V,
typename T,
class BinaryOperation>
396 "exclusive_scan_over_group instead.")
402 T> exclusive_scan(Group g, V x,
T init,
403 BinaryOperation binary_op) {
407 template <
typename Group,
typename V,
typename T,
class BinaryOperation>
409 "exclusive_scan_over_group instead.")
415 T> exclusive_scan(Group g, V x, T init,
416 BinaryOperation binary_op) {
420 template <
typename Group,
typename InPtr,
typename OutPtr,
typename T,
421 class BinaryOperation>
423 "joint_exclusive_scan instead.")
431 BinaryOperation>::value &&
433 OutPtr> exclusive_scan(Group g, InPtr first, InPtr last, OutPtr result,
434 T init, BinaryOperation binary_op) {
438 template <
typename Group,
typename InPtr,
typename OutPtr,
439 class BinaryOperation>
441 "joint_exclusive_scan instead.")
448 BinaryOperation>::value),
449 OutPtr> exclusive_scan(Group g, InPtr first, InPtr last, OutPtr result,
450 BinaryOperation binary_op) {
454 template <
typename Group,
typename T,
class BinaryOperation>
456 "inclusive_scan_over_group instead.")
460 T> inclusive_scan(Group g,
T x, BinaryOperation binary_op) {
464 template <
typename Group,
typename T,
class BinaryOperation>
466 "inclusive_scan_over_group instead.")
470 T> inclusive_scan(Group g, T x, BinaryOperation binary_op) {
474 template <
typename Group,
typename V,
class BinaryOperation,
typename T>
476 "inclusive_scan_over_group instead.")
482 T> inclusive_scan(Group g, V x, BinaryOperation binary_op,
487 template <
typename Group,
typename V,
class BinaryOperation,
typename T>
489 "inclusive_scan_over_group instead.")
495 T> inclusive_scan(Group g, V x, BinaryOperation binary_op,
500 template <
typename Group,
typename InPtr,
typename OutPtr,
501 class BinaryOperation,
typename T>
503 "joint_inclusive_scan instead.")
511 BinaryOperation>::value &&
513 OutPtr> inclusive_scan(Group g, InPtr first, InPtr last, OutPtr result,
514 BinaryOperation binary_op,
T init) {
518 template <
typename Group,
typename InPtr,
typename OutPtr,
519 class BinaryOperation>
521 "joint_inclusive_scan instead.")
528 BinaryOperation>::value),
529 OutPtr> inclusive_scan(Group g, InPtr first, InPtr last, OutPtr result,
530 BinaryOperation binary_op) {
534 template <
typename Group>
537 #ifdef __SYCL_DEVICE_ONLY__
538 typename Group::linear_id_type linear_id =
540 return (linear_id == 0);
543 throw runtime_error(
"Group algorithms are not supported on host device.",