31 template <
int Dimensions>
34 return id<1>(linear_id);
38 result[0] = linear_id /
r[1];
39 result[1] = linear_id %
r[1];
44 result[0] = linear_id / (
r[1] *
r[2]);
45 result[1] = (linear_id % (
r[1] *
r[2])) /
r[2];
46 result[2] = linear_id %
r[2];
52 template <>
inline size_t get_local_linear_range<group<1>>(
group<1> g) {
53 return g.get_local_range(0);
55 template <>
inline size_t get_local_linear_range<group<2>>(
group<2> g) {
56 return g.get_local_range(0) * g.get_local_range(1);
58 template <>
inline size_t get_local_linear_range<group<3>>(
group<3> g) {
59 return g.get_local_range(0) * g.get_local_range(1) * g.get_local_range(2);
68 template <
typename Group>
71 #ifdef __SYCL_DEVICE_ONLY__
72 #define __SYCL_GROUP_GET_LOCAL_LINEAR_ID(D) \
74 inline group<D>::linear_id_type get_local_linear_id<group<D>>(group<D>) { \
75 nd_item<D> it = sycl::detail::Builder::getNDItem<D>(); \
76 return it.get_local_linear_id(); \
78 __SYCL_GROUP_GET_LOCAL_LINEAR_ID(1);
79 __SYCL_GROUP_GET_LOCAL_LINEAR_ID(2);
80 __SYCL_GROUP_GET_LOCAL_LINEAR_ID(3);
81 #undef __SYCL_GROUP_GET_LOCAL_LINEAR_ID
94 sycl::bit_and<T>, sycl::maximum<T>, sycl::minimum<T>,
97 template <
typename T,
typename BinaryOperation>
struct is_native_op {
98 static constexpr
bool value =
104 template <
typename T,
typename BinaryOperation>
106 bool, std::is_same<BinaryOperation, sycl::plus<T>>::value ||
107 std::is_same<BinaryOperation, sycl::plus<void>>::value>;
111 template <
typename T>
113 : std::integral_constant<bool,
114 std::is_same<T, std::complex<float>>::value ||
115 std::is_same<T, std::complex<double>>::value> {
119 template <
typename T>
121 std::integral_constant<bool, sycl::detail::is_complex<T>::value ||
122 sycl::detail::is_arithmetic<T>::value>;
124 template <
typename T,
typename BinaryOperation>
128 : std::true_type::value)>;
135 template <
typename T,
class BinaryOperation>
142 template <
typename T,
class BinaryOperation>
144 return sycl::known_identity_v<BinaryOperation, T>;
148 template <
typename Group,
typename Ptr,
class Function>
149 Function
for_each(Group g, Ptr first, Ptr last, Function f) {
150 #ifdef __SYCL_DEVICE_ONLY__
153 for (Ptr p = first + offset; p < last; p += stride) {
162 throw runtime_error(
"Group algorithms are not supported on host device.",
163 PI_ERROR_INVALID_DEVICE);
172 template <
typename Group,
typename T,
class BinaryOperation>
174 detail::is_scalar_arithmetic<T>::value &&
175 detail::is_native_op<T, BinaryOperation>::value),
180 std::is_same<decltype(binary_op(x, x)), T>::value ||
181 (std::is_same<T, half>::value &&
182 std::is_same<decltype(binary_op(x, x)),
float>::value),
183 "Result type of binary_op must match reduction accumulation type.");
184 #ifdef __SYCL_DEVICE_ONLY__
186 sycl::detail::spirv::group_scope<Group>::value>(
187 typename sycl::detail::GroupOpTag<T>::type(), x, binary_op);
189 throw runtime_error(
"Group algorithms are not supported on host device.",
190 PI_ERROR_INVALID_DEVICE);
196 template <
typename Group,
typename T,
class BinaryOperation>
198 detail::is_complex<T>::value &&
199 detail::is_native_op<T, sycl::plus<T>>::value &&
200 detail::is_plus<T, BinaryOperation>::value),
203 #ifdef __SYCL_DEVICE_ONLY__
212 throw runtime_error(
"Group algorithms are not supported on host device.",
213 PI_ERROR_INVALID_DEVICE);
217 template <
typename Group,
typename T,
class BinaryOperation>
219 detail::is_vector_arithmetic<T>::value &&
220 detail::is_native_op<T, BinaryOperation>::value),
225 std::is_same<decltype(binary_op(x[0], x[0])),
226 typename T::element_type>::value ||
227 (std::is_same<T, half>::value &&
228 std::is_same<decltype(binary_op(x[0], x[0])),
float>::value),
229 "Result type of binary_op must match reduction accumulation type.");
231 for (
int s = 0;
s < x.size(); ++
s) {
239 template <
typename Group,
typename V,
typename T,
class BinaryOperation>
241 (is_group_v<std::decay_t<Group>> &&
242 (detail::is_scalar_arithmetic<V>::value || detail::is_complex<V>::value) &&
243 (detail::is_scalar_arithmetic<T>::value || detail::is_complex<T>::value) &&
244 detail::is_native_op<V, BinaryOperation>::value &&
245 detail::is_native_op<T, BinaryOperation>::value &&
246 detail::is_plus_if_complex<T, BinaryOperation>::value &&
247 detail::is_plus_if_complex<V, BinaryOperation>::value),
252 std::is_same<decltype(binary_op(init, x)), T>::value ||
253 (std::is_same<T, half>::value &&
254 std::is_same<decltype(binary_op(init, x)),
float>::value),
255 "Result type of binary_op must match reduction accumulation type.");
256 #ifdef __SYCL_DEVICE_ONLY__
260 throw runtime_error(
"Group algorithms are not supported on host device.",
261 PI_ERROR_INVALID_DEVICE);
265 template <
typename Group,
typename V,
typename T,
class BinaryOperation>
267 detail::is_vector_arithmetic<V>::value &&
268 detail::is_vector_arithmetic<T>::value &&
269 detail::is_native_op<V, BinaryOperation>::value &&
270 detail::is_native_op<T, BinaryOperation>::value),
275 std::is_same<decltype(binary_op(init[0], x[0])),
276 typename T::element_type>::value ||
277 (std::is_same<T, half>::value &&
278 std::is_same<decltype(binary_op(init[0], x[0])),
float>::value),
279 "Result type of binary_op must match reduction accumulation type.");
280 #ifdef __SYCL_DEVICE_ONLY__
282 for (
int s = 0;
s < x.size(); ++
s) {
288 throw runtime_error(
"Group algorithms are not supported on host device.",
289 PI_ERROR_INVALID_DEVICE);
294 template <
typename Group,
typename Ptr,
class BinaryOperation>
296 (is_group_v<std::decay_t<Group>> && detail::is_pointer<Ptr>::value &&
298 typename detail::remove_pointer<Ptr>::type>::value &&
299 detail::is_plus_if_complex<typename detail::remove_pointer<Ptr>::type,
300 BinaryOperation>::value),
301 typename detail::remove_pointer<Ptr>::type>
302 joint_reduce(Group g, Ptr first, Ptr last, BinaryOperation binary_op) {
303 #ifdef __SYCL_DEVICE_ONLY__
305 T init = detail::identity_for_ga_op<T, BinaryOperation>();
312 throw runtime_error(
"Group algorithms are not supported on host device.",
313 PI_ERROR_INVALID_DEVICE);
317 template <
typename Group,
typename Ptr,
typename T,
class BinaryOperation>
319 (is_group_v<std::decay_t<Group>> && detail::is_pointer<Ptr>::value &&
321 typename detail::remove_pointer<Ptr>::type>::value &&
322 detail::is_arithmetic_or_complex<T>::value &&
323 detail::is_native_op<typename detail::remove_pointer<Ptr>::type,
324 BinaryOperation>::value &&
325 detail::is_plus_if_complex<typename detail::remove_pointer<Ptr>::type,
326 BinaryOperation>::value &&
327 detail::is_plus_if_complex<T, BinaryOperation>::value &&
328 detail::is_native_op<T, BinaryOperation>::value),
330 joint_reduce(Group g, Ptr first, Ptr last, T init, BinaryOperation binary_op) {
333 std::is_same<decltype(binary_op(init, *first)), T>::value ||
334 (std::is_same<T, half>::value &&
335 std::is_same<decltype(binary_op(init, *first)),
float>::value),
336 "Result type of binary_op must match reduction accumulation type.");
337 #ifdef __SYCL_DEVICE_ONLY__
338 T partial = detail::identity_for_ga_op<T, BinaryOperation>();
341 partial = binary_op(partial, x);
347 throw runtime_error(
"Group algorithms are not supported on host device.",
348 PI_ERROR_INVALID_DEVICE);
353 template <
typename Group>
354 detail::enable_if_t<is_group_v<std::decay_t<Group>>,
bool>
356 #ifdef __SYCL_DEVICE_ONLY__
357 return sycl::detail::spirv::GroupAny<Group>(pred);
360 throw runtime_error(
"Group algorithms are not supported on host device.",
361 PI_ERROR_INVALID_DEVICE);
365 template <
typename Group,
typename T,
class Predicate>
372 template <
typename Group,
typename Ptr,
class Predicate>
374 (is_group_v<std::decay_t<Group>> && detail::is_pointer<Ptr>::value),
bool>
376 #ifdef __SYCL_DEVICE_ONLY__
378 bool partial =
false;
386 throw runtime_error(
"Group algorithms are not supported on host device.",
387 PI_ERROR_INVALID_DEVICE);
392 template <
typename Group>
393 detail::enable_if_t<is_group_v<std::decay_t<Group>>,
bool>
395 #ifdef __SYCL_DEVICE_ONLY__
396 return sycl::detail::spirv::GroupAll<Group>(pred);
399 throw runtime_error(
"Group algorithms are not supported on host device.",
400 PI_ERROR_INVALID_DEVICE);
404 template <
typename Group,
typename T,
class Predicate>
405 detail::enable_if_t<is_group_v<std::decay_t<Group>>,
bool>
411 template <
typename Group,
typename Ptr,
class Predicate>
413 (is_group_v<std::decay_t<Group>> && detail::is_pointer<Ptr>::value),
bool>
415 #ifdef __SYCL_DEVICE_ONLY__
425 throw runtime_error(
"Group algorithms are not supported on host device.",
426 PI_ERROR_INVALID_DEVICE);
431 template <
typename Group>
432 detail::enable_if_t<is_group_v<std::decay_t<Group>>,
bool>
434 #ifdef __SYCL_DEVICE_ONLY__
435 return sycl::detail::spirv::GroupAll<Group>(!pred);
438 throw runtime_error(
"Group algorithms are not supported on host device.",
439 PI_ERROR_INVALID_DEVICE);
443 template <
typename Group,
typename T,
class Predicate>
444 detail::enable_if_t<is_group_v<std::decay_t<Group>>,
bool>
450 template <
typename Group,
typename Ptr,
class Predicate>
452 (is_group_v<std::decay_t<Group>> && detail::is_pointer<Ptr>::value),
bool>
454 #ifdef __SYCL_DEVICE_ONLY__
461 throw runtime_error(
"Group algorithms are not supported on host device.",
462 PI_ERROR_INVALID_DEVICE);
469 template <
typename Group,
typename T>
471 (std::is_trivially_copyable<T>::value ||
472 detail::is_vec<T>::value)),
475 #ifdef __SYCL_DEVICE_ONLY__
476 return sycl::detail::spirv::SubgroupShuffleDown(x, delta);
480 throw runtime_error(
"Sub-groups are not supported on host device.",
481 PI_ERROR_INVALID_DEVICE);
488 template <
typename Group,
typename T>
490 (std::is_trivially_copyable<T>::value ||
491 detail::is_vec<T>::value)),
494 #ifdef __SYCL_DEVICE_ONLY__
495 return sycl::detail::spirv::SubgroupShuffleUp(x, delta);
499 throw runtime_error(
"Sub-groups are not supported on host device.",
500 PI_ERROR_INVALID_DEVICE);
507 template <
typename Group,
typename T>
509 (std::is_trivially_copyable<T>::value ||
510 detail::is_vec<T>::value)),
513 #ifdef __SYCL_DEVICE_ONLY__
514 return sycl::detail::spirv::SubgroupShuffleXor(x, mask);
518 throw runtime_error(
"Sub-groups are not supported on host device.",
519 PI_ERROR_INVALID_DEVICE);
526 template <
typename Group,
typename T>
528 (std::is_trivially_copyable<T>::value ||
529 detail::is_vec<T>::value)),
532 #ifdef __SYCL_DEVICE_ONLY__
533 return sycl::detail::spirv::SubgroupShuffle(x, local_id);
537 throw runtime_error(
"Sub-groups are not supported on host device.",
538 PI_ERROR_INVALID_DEVICE);
545 template <
typename Group,
typename T>
547 (std::is_trivially_copyable<T>::value ||
548 detail::is_vec<T>::value)),
551 #ifdef __SYCL_DEVICE_ONLY__
552 return sycl::detail::spirv::GroupBroadcast<Group>(x, local_id);
556 throw runtime_error(
"Group algorithms are not supported on host device.",
557 PI_ERROR_INVALID_DEVICE);
561 template <
typename Group,
typename T>
563 (std::is_trivially_copyable<T>::value ||
564 detail::is_vec<T>::value)),
567 #ifdef __SYCL_DEVICE_ONLY__
574 (void)linear_local_id;
575 throw runtime_error(
"Group algorithms are not supported on host device.",
576 PI_ERROR_INVALID_DEVICE);
580 template <
typename Group,
typename T>
582 (std::is_trivially_copyable<T>::value ||
583 detail::is_vec<T>::value)),
586 #ifdef __SYCL_DEVICE_ONLY__
591 throw runtime_error(
"Group algorithms are not supported on host device.",
592 PI_ERROR_INVALID_DEVICE);
600 template <
typename Group,
typename T,
class BinaryOperation>
602 detail::is_scalar_arithmetic<T>::value &&
603 detail::is_native_op<T, BinaryOperation>::value),
607 static_assert(std::is_same<decltype(binary_op(x, x)), T>::value ||
608 (std::is_same<T, half>::value &&
609 std::is_same<decltype(binary_op(x, x)),
float>::value),
610 "Result type of binary_op must match scan accumulation type.");
611 #ifdef __SYCL_DEVICE_ONLY__
613 sycl::detail::spirv::group_scope<Group>::value>(
614 typename sycl::detail::GroupOpTag<T>::type(), x, binary_op);
616 throw runtime_error(
"Group algorithms are not supported on host device.",
617 PI_ERROR_INVALID_DEVICE);
623 template <
typename Group,
typename T,
class BinaryOperation>
625 detail::is_complex<T>::value &&
626 detail::is_native_op<T, sycl::plus<T>>::value &&
627 detail::is_plus<T, BinaryOperation>::value),
630 #ifdef __SYCL_DEVICE_ONLY__
639 throw runtime_error(
"Group algorithms are not supported on host device.",
640 PI_ERROR_INVALID_DEVICE);
644 template <
typename Group,
typename T,
class BinaryOperation>
646 detail::is_vector_arithmetic<T>::value &&
647 detail::is_native_op<T, BinaryOperation>::value),
652 std::is_same<decltype(binary_op(x[0], x[0])),
653 typename T::element_type>::value ||
654 (std::is_same<T, half>::value &&
655 std::is_same<decltype(binary_op(x[0], x[0])),
float>::value),
656 "Result type of binary_op must match scan accumulation type.");
658 for (
int s = 0;
s < x.size(); ++
s) {
666 template <
typename Group,
typename V,
typename T,
class BinaryOperation>
668 detail::is_vector_arithmetic<V>::value &&
669 detail::is_vector_arithmetic<T>::value &&
670 detail::is_native_op<V, BinaryOperation>::value &&
671 detail::is_native_op<T, BinaryOperation>::value),
676 std::is_same<decltype(binary_op(init[0], x[0])),
677 typename T::element_type>::value ||
678 (std::is_same<T, half>::value &&
679 std::is_same<decltype(binary_op(init[0], x[0])),
float>::value),
680 "Result type of binary_op must match scan accumulation type.");
682 for (
int s = 0;
s < x.size(); ++
s) {
688 template <
typename Group,
typename V,
typename T,
class BinaryOperation>
690 (is_group_v<std::decay_t<Group>> &&
691 (detail::is_scalar_arithmetic<V>::value || detail::is_complex<V>::value) &&
692 (detail::is_scalar_arithmetic<T>::value || detail::is_complex<T>::value) &&
693 detail::is_native_op<V, BinaryOperation>::value &&
694 detail::is_native_op<T, BinaryOperation>::value &&
695 detail::is_plus_if_complex<V, BinaryOperation>::value &&
696 detail::is_plus_if_complex<T, BinaryOperation>::value),
700 static_assert(std::is_same<decltype(binary_op(init, x)), T>::value ||
701 (std::is_same<T, half>::value &&
702 std::is_same<decltype(binary_op(init, x)),
float>::value),
703 "Result type of binary_op must match scan accumulation type.");
704 #ifdef __SYCL_DEVICE_ONLY__
705 typename Group::linear_id_type local_linear_id =
707 if (local_linear_id == 0) {
708 x = binary_op(init, x);
711 if (local_linear_id == 0) {
717 throw runtime_error(
"Group algorithms are not supported on host device.",
718 PI_ERROR_INVALID_DEVICE);
723 template <
typename Group,
typename InPtr,
typename OutPtr,
typename T,
724 class BinaryOperation>
726 (is_group_v<std::decay_t<Group>> && detail::is_pointer<InPtr>::value &&
727 detail::is_pointer<OutPtr>::value &&
729 typename detail::remove_pointer<InPtr>::type>::value &&
730 detail::is_arithmetic_or_complex<T>::value &&
731 detail::is_native_op<typename detail::remove_pointer<InPtr>::type,
732 BinaryOperation>::value &&
733 detail::is_native_op<T, BinaryOperation>::value &&
734 detail::is_plus_if_complex<typename detail::remove_pointer<InPtr>::type,
735 BinaryOperation>::value &&
736 detail::is_plus_if_complex<T, BinaryOperation>::value),
739 BinaryOperation binary_op) {
742 std::is_same<decltype(binary_op(*first, *first)), T>::value ||
743 (std::is_same<T, half>::value &&
744 std::is_same<decltype(binary_op(*first, *first)),
float>::value),
745 "Result type of binary_op must match scan accumulation type.");
746 #ifdef __SYCL_DEVICE_ONLY__
749 ptrdiff_t N = last - first;
750 auto roundup = [=](
const ptrdiff_t &v,
751 const ptrdiff_t &divisor) -> ptrdiff_t {
752 return ((v + divisor - 1) / divisor) * divisor;
754 typename std::remove_const<typename detail::remove_pointer<InPtr>::type>::type
757 for (ptrdiff_t chunk = 0; chunk < roundup(N, stride); chunk += stride) {
758 ptrdiff_t i = chunk + offset;
775 throw runtime_error(
"Group algorithms are not supported on host device.",
776 PI_ERROR_INVALID_DEVICE);
780 template <
typename Group,
typename InPtr,
typename OutPtr,
781 class BinaryOperation>
783 (is_group_v<std::decay_t<Group>> && detail::is_pointer<InPtr>::value &&
784 detail::is_pointer<OutPtr>::value &&
786 typename detail::remove_pointer<InPtr>::type>::value &&
787 detail::is_native_op<typename detail::remove_pointer<InPtr>::type,
788 BinaryOperation>::value &&
789 detail::is_plus_if_complex<typename detail::remove_pointer<InPtr>::type,
790 BinaryOperation>::value),
793 BinaryOperation binary_op) {
796 std::is_same<decltype(binary_op(*first, *first)),
800 std::is_same<decltype(binary_op(*first, *first)),
float>::value),
801 "Result type of binary_op must match scan accumulation type.");
803 T init = detail::identity_for_ga_op<T, BinaryOperation>();
811 template <
typename Group,
typename T,
class BinaryOperation>
813 detail::is_vector_arithmetic<T>::value &&
814 detail::is_native_op<T, BinaryOperation>::value),
819 std::is_same<decltype(binary_op(x[0], x[0])),
820 typename T::element_type>::value ||
821 (std::is_same<T, half>::value &&
822 std::is_same<decltype(binary_op(x[0], x[0])),
float>::value),
823 "Result type of binary_op must match scan accumulation type.");
825 for (
int s = 0;
s < x.size(); ++
s) {
831 template <
typename Group,
typename T,
class BinaryOperation>
833 detail::is_scalar_arithmetic<T>::value &&
834 detail::is_native_op<T, BinaryOperation>::value),
838 static_assert(std::is_same<decltype(binary_op(x, x)), T>::value ||
839 (std::is_same<T, half>::value &&
840 std::is_same<decltype(binary_op(x, x)),
float>::value),
841 "Result type of binary_op must match scan accumulation type.");
842 #ifdef __SYCL_DEVICE_ONLY__
844 sycl::detail::spirv::group_scope<Group>::value>(
845 typename sycl::detail::GroupOpTag<T>::type(), x, binary_op);
847 throw runtime_error(
"Group algorithms are not supported on host device.",
848 PI_ERROR_INVALID_DEVICE);
853 template <
typename Group,
typename T,
class BinaryOperation>
855 detail::is_complex<T>::value &&
856 detail::is_native_op<T, sycl::plus<T>>::value &&
857 detail::is_plus<T, BinaryOperation>::value),
860 #ifdef __SYCL_DEVICE_ONLY__
869 throw runtime_error(
"Group algorithms are not supported on host device.",
870 PI_ERROR_INVALID_DEVICE);
876 template <
typename Group,
typename V,
class BinaryOperation,
typename T>
878 (is_group_v<std::decay_t<Group>> &&
879 (detail::is_scalar_arithmetic<V>::value || detail::is_complex<V>::value) &&
880 (detail::is_scalar_arithmetic<T>::value || detail::is_complex<T>::value) &&
881 detail::is_native_op<V, BinaryOperation>::value &&
882 detail::is_native_op<T, BinaryOperation>::value &&
883 detail::is_plus_if_complex<T, BinaryOperation>::value &&
884 detail::is_plus_if_complex<V, BinaryOperation>::value),
888 static_assert(std::is_same<decltype(binary_op(init, x)), T>::value ||
889 (std::is_same<T, half>::value &&
890 std::is_same<decltype(binary_op(init, x)),
float>::value),
891 "Result type of binary_op must match scan accumulation type.");
892 #ifdef __SYCL_DEVICE_ONLY__
894 x = binary_op(init, x);
899 throw runtime_error(
"Group algorithms are not supported on host device.",
900 PI_ERROR_INVALID_DEVICE);
904 template <
typename Group,
typename V,
class BinaryOperation,
typename T>
906 detail::is_vector_arithmetic<V>::value &&
907 detail::is_vector_arithmetic<T>::value &&
908 detail::is_native_op<V, BinaryOperation>::value &&
909 detail::is_native_op<T, BinaryOperation>::value),
914 std::is_same<decltype(binary_op(init[0], x[0])), T>::value ||
915 (std::is_same<T, half>::value &&
916 std::is_same<decltype(binary_op(init[0], x[0])),
float>::value),
917 "Result type of binary_op must match scan accumulation type.");
919 for (
int s = 0;
s < x.size(); ++
s) {
926 template <
typename Group,
typename InPtr,
typename OutPtr,
927 class BinaryOperation,
typename T>
929 (is_group_v<std::decay_t<Group>> && detail::is_pointer<InPtr>::value &&
930 detail::is_pointer<OutPtr>::value &&
932 typename detail::remove_pointer<InPtr>::type>::value &&
933 detail::is_arithmetic_or_complex<T>::value &&
934 detail::is_native_op<typename detail::remove_pointer<InPtr>::type,
935 BinaryOperation>::value &&
936 detail::is_native_op<T, BinaryOperation>::value &&
937 detail::is_plus_if_complex<typename detail::remove_pointer<InPtr>::type,
938 BinaryOperation>::value &&
939 detail::is_plus_if_complex<T, BinaryOperation>::value),
942 BinaryOperation binary_op, T init) {
945 std::is_same<decltype(binary_op(init, *first)), T>::value ||
946 (std::is_same<T, half>::value &&
947 std::is_same<decltype(binary_op(init, *first)),
float>::value),
948 "Result type of binary_op must match scan accumulation type.");
949 #ifdef __SYCL_DEVICE_ONLY__
952 ptrdiff_t N = last - first;
953 auto roundup = [=](
const ptrdiff_t &v,
954 const ptrdiff_t &divisor) -> ptrdiff_t {
955 return ((v + divisor - 1) / divisor) * divisor;
957 typename std::remove_const<typename detail::remove_pointer<InPtr>::type>::type
960 for (ptrdiff_t chunk = 0; chunk < roundup(N, stride); chunk += stride) {
961 ptrdiff_t i = chunk + offset;
977 throw runtime_error(
"Group algorithms are not supported on host device.",
978 PI_ERROR_INVALID_DEVICE);
982 template <
typename Group,
typename InPtr,
typename OutPtr,
983 class BinaryOperation>
985 (is_group_v<std::decay_t<Group>> && detail::is_pointer<InPtr>::value &&
986 detail::is_pointer<OutPtr>::value &&
988 typename detail::remove_pointer<InPtr>::type>::value &&
989 detail::is_native_op<typename detail::remove_pointer<InPtr>::type,
990 BinaryOperation>::value &&
991 detail::is_plus_if_complex<typename detail::remove_pointer<InPtr>::type,
992 BinaryOperation>::value),
995 BinaryOperation binary_op) {
998 std::is_same<decltype(binary_op(*first, *first)),
1002 std::is_same<decltype(binary_op(*first, *first)),
float>::value),
1003 "Result type of binary_op must match scan accumulation type.");
1006 T init = detail::identity_for_ga_op<T, BinaryOperation>();
A unique identifier of an item in an index space.
#define __SYCL_INLINE_VER_NAMESPACE(X)
std::integral_constant< bool,(is_complex< T >::value ? is_plus< T, BinaryOperation >::value :std::true_type::value)> is_plus_if_complex
std::integral_constant< bool, sycl::detail::is_complex< T >::value||sycl::detail::is_arithmetic< T >::value > is_arithmetic_or_complex
std::integral_constant< bool, std::is_same< BinaryOperation, sycl::plus< T > >::value||std::is_same< BinaryOperation, sycl::plus< void > >::value > is_plus
id< 3 > linear_id_to_id(range< 3 > r, size_t linear_id)
typename std::enable_if< B, T >::type enable_if_t
size_t get_local_linear_range(Group g)
constexpr detail::enable_if_t<!is_complex< T >::value, T > identity_for_ga_op()
Group::linear_id_type get_local_linear_id(Group g)
Function for_each(Group g, Ptr first, Ptr last, Function f)
detail::enable_if_t<(is_group_v< std::decay_t< Group >> &&detail::is_pointer< Ptr >::value &&detail::is_arithmetic_or_complex< typename detail::remove_pointer< Ptr >::type >::value &&detail::is_arithmetic_or_complex< T >::value &&detail::is_native_op< typename detail::remove_pointer< Ptr >::type, BinaryOperation >::value &&detail::is_plus_if_complex< typename detail::remove_pointer< Ptr >::type, BinaryOperation >::value &&detail::is_plus_if_complex< T, BinaryOperation >::value &&detail::is_native_op< T, BinaryOperation >::value), T > joint_reduce(Group g, Ptr first, Ptr last, T init, BinaryOperation binary_op)
detail::enable_if_t<(is_group_v< std::decay_t< Group >> &&(detail::is_scalar_arithmetic< V >::value||detail::is_complex< V >::value) &&(detail::is_scalar_arithmetic< T >::value||detail::is_complex< T >::value) &&detail::is_native_op< V, BinaryOperation >::value &&detail::is_native_op< T, BinaryOperation >::value &&detail::is_plus_if_complex< V, BinaryOperation >::value &&detail::is_plus_if_complex< T, BinaryOperation >::value), T > exclusive_scan_over_group(Group g, V x, T init, BinaryOperation binary_op)
detail::enable_if_t<(is_group_v< std::decay_t< Group >> &&(std::is_trivially_copyable< T >::value||detail::is_vec< T >::value)), T > group_broadcast(Group g, T x)
detail::enable_if_t< is_group_v< std::decay_t< Group > >, bool > none_of_group(Group g, T x, Predicate pred)
detail::enable_if_t<(std::is_same< std::decay_t< Group >, sub_group >::value &&(std::is_trivially_copyable< T >::value||detail::is_vec< T >::value)), T > select_from_group(Group, T x, typename Group::id_type local_id)
detail::enable_if_t<(is_group_v< std::decay_t< Group >> &&detail::is_pointer< Ptr >::value), bool > joint_all_of(Group g, Ptr first, Ptr last, Predicate pred)
detail::enable_if_t< is_group_v< Group >, bool > any_of_group(Group g, T x, Predicate pred)
detail::enable_if_t< is_group_v< std::decay_t< Group > >, bool > all_of_group(Group g, T x, Predicate pred)
detail::enable_if_t<(is_group_v< std::decay_t< Group >> &&detail::is_pointer< Ptr >::value), bool > joint_any_of(Group g, Ptr first, Ptr last, Predicate pred)
detail::enable_if_t<(std::is_same< std::decay_t< Group >, sub_group >::value &&(std::is_trivially_copyable< T >::value||detail::is_vec< T >::value)), T > shift_group_left(Group, T x, typename Group::linear_id_type delta=1)
detail::enable_if_t<(std::is_same< std::decay_t< Group >, sub_group >::value &&(std::is_trivially_copyable< T >::value||detail::is_vec< T >::value)), T > shift_group_right(Group, T x, typename Group::linear_id_type delta=1)
detail::enable_if_t<(is_group_v< std::decay_t< Group >> &&detail::is_pointer< Ptr >::value), bool > joint_none_of(Group g, Ptr first, Ptr last, Predicate pred)
detail::enable_if_t<(is_group_v< std::decay_t< Group >> &&detail::is_vector_arithmetic< V >::value &&detail::is_vector_arithmetic< T >::value &&detail::is_native_op< V, BinaryOperation >::value &&detail::is_native_op< T, BinaryOperation >::value), T > reduce_over_group(Group g, V x, T init, BinaryOperation binary_op)
detail::enable_if_t<(is_group_v< std::decay_t< Group >> &&detail::is_vector_arithmetic< V >::value &&detail::is_vector_arithmetic< T >::value &&detail::is_native_op< V, BinaryOperation >::value &&detail::is_native_op< T, BinaryOperation >::value), T > inclusive_scan_over_group(Group g, V x, BinaryOperation binary_op, T init)
detail::enable_if_t<(is_group_v< std::decay_t< Group >> &&detail::is_pointer< InPtr >::value &&detail::is_pointer< OutPtr >::value &&detail::is_arithmetic_or_complex< typename detail::remove_pointer< InPtr >::type >::value &&detail::is_native_op< typename detail::remove_pointer< InPtr >::type, BinaryOperation >::value &&detail::is_plus_if_complex< typename detail::remove_pointer< InPtr >::type, BinaryOperation >::value), OutPtr > joint_exclusive_scan(Group g, InPtr first, InPtr last, OutPtr result, BinaryOperation binary_op)
detail::enable_if_t<(std::is_same< std::decay_t< Group >, sub_group >::value &&(std::is_trivially_copyable< T >::value||detail::is_vec< T >::value)), T > permute_group_by_xor(Group, T x, typename Group::linear_id_type mask)
detail::enable_if_t<(is_group_v< std::decay_t< Group >> &&detail::is_pointer< InPtr >::value &&detail::is_pointer< OutPtr >::value &&detail::is_arithmetic_or_complex< typename detail::remove_pointer< InPtr >::type >::value &&detail::is_native_op< typename detail::remove_pointer< InPtr >::type, BinaryOperation >::value &&detail::is_plus_if_complex< typename detail::remove_pointer< InPtr >::type, BinaryOperation >::value), OutPtr > joint_inclusive_scan(Group g, InPtr first, InPtr last, OutPtr result, BinaryOperation binary_op)
sycl::detail::half_impl::half half
---— Error handling, matching OpenCL plugin semantics.
range_type get_local_range() const
id_type get_local_id() const