20 #ifndef RAJA_pattern_launch_hip_HPP
21 #define RAJA_pattern_launch_hip_HPP
38 template<
typename IndicesAndDimsT>
55 return indices_and_dims;
59 template<
typename BODY,
typename ReduceParams>
85 RAJA::policy::hip::hip_launch_t<async, named_usage::unspecified>>
88 template<
typename BODY_IN,
typename ReduceParams>
89 static concepts::enable_if_t<
90 resources::EventProxy<resources::Resource>,
92 exec(RAJA::resources::Resource res,
95 ReduceParams& launch_reducers)
97 using BODY = camp::decay<BODY_IN>;
99 RAJA::policy::hip::hip_launch_t<async, named_usage::unspecified>;
102 auto func =
reinterpret_cast<const void*
>(
103 &launch_new_reduce_global_fcn<BODY, camp::decay<ReduceParams>>);
105 resources::Hip hip_res = res.get<RAJA::resources::Hip>();
112 static_cast<hip_dim_member_t
>(launch_params.
teams.
value[0]),
113 static_cast<hip_dim_member_t
>(launch_params.
teams.
value[1]),
114 static_cast<hip_dim_member_t
>(launch_params.
teams.
value[2])};
116 hip_dim_t blockSize {
117 static_cast<hip_dim_member_t
>(launch_params.
threads.
value[0]),
118 static_cast<hip_dim_member_t
>(launch_params.
threads.
value[1]),
119 static_cast<hip_dim_member_t
>(launch_params.
threads.
value[2])};
122 constexpr hip_dim_member_t zero = 0;
123 if (gridSize.x > zero && gridSize.y > zero && gridSize.z > zero &&
124 blockSize.x > zero && blockSize.y > zero && blockSize.z > zero)
129 RAJA::hip::detail::hipInfo launch_info;
130 launch_info.gridDim = gridSize;
131 launch_info.blockDim = blockSize;
132 launch_info.dynamic_smem = &shared_mem_size;
133 launch_info.res = hip_res;
143 BODY
body = RAJA::hip::make_launch_body(func, gridSize, blockSize,
144 shared_mem_size, hip_res,
145 std::forward<BODY_IN>(body_in));
150 void*
args[] = {(
void*)&
body, (
void*)&launch_reducers};
159 return resources::EventProxy<resources::Resource>(res);
163 template<
typename BODY,
int num_threads,
typename ReduceParams>
165 void launch_new_reduce_global_fcn_fixed(const BODY body_in,
188 template<
bool async,
int nthreads>
192 template<
typename BODY_IN,
typename ReduceParams>
193 static concepts::enable_if_t<
194 resources::EventProxy<resources::Resource>,
196 exec(RAJA::resources::Resource res,
199 ReduceParams& launch_reducers)
201 using BODY = camp::decay<BODY_IN>;
205 RAJA::policy::hip::hip_launch_t<async, named_usage::unspecified>;
208 auto func =
reinterpret_cast<const void*
>(
209 &launch_new_reduce_global_fcn_fixed<BODY, nthreads,
210 camp::decay<ReduceParams>>);
212 resources::Hip hip_res = res.get<RAJA::resources::Hip>();
219 static_cast<hip_dim_member_t
>(launch_params.
teams.
value[0]),
220 static_cast<hip_dim_member_t
>(launch_params.
teams.
value[1]),
221 static_cast<hip_dim_member_t
>(launch_params.
teams.
value[2])};
223 hip_dim_t blockSize {
224 static_cast<hip_dim_member_t
>(launch_params.
threads.
value[0]),
225 static_cast<hip_dim_member_t
>(launch_params.
threads.
value[1]),
226 static_cast<hip_dim_member_t
>(launch_params.
threads.
value[2])};
229 constexpr hip_dim_member_t zero = 0;
230 if (gridSize.x > zero && gridSize.y > zero && gridSize.z > zero &&
231 blockSize.x > zero && blockSize.y > zero && blockSize.z > zero)
236 RAJA::hip::detail::hipInfo launch_info;
237 launch_info.gridDim = gridSize;
238 launch_info.blockDim = blockSize;
239 launch_info.dynamic_smem = &shared_mem_size;
240 launch_info.res = hip_res;
250 BODY
body = RAJA::hip::make_launch_body(func, gridSize, blockSize,
251 shared_mem_size, hip_res,
252 std::forward<BODY_IN>(body_in));
257 void*
args[] = {(
void*)&
body, (
void*)&launch_reducers};
266 return resources::EventProxy<resources::Resource>(res);
273 template<
typename SEGMENT,
typename IndexMapper>
275 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::DirectUnchecked,
276 kernel_sync_requirement::none,
281 using diff_t =
typename std::iterator_traits<
282 typename SEGMENT::iterator>::difference_type;
284 template<
typename LaunchContextPolicy,
typename BODY>
287 SEGMENT
const& segment,
291 IndexMapper::template index<diff_t>(
ctx.get_indices_and_dims());
293 body(*(segment.begin() + i));
297 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
299 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::DirectUnchecked,
300 kernel_sync_requirement::none,
306 using diff_t =
typename std::iterator_traits<
307 typename SEGMENT::iterator>::difference_type;
309 template<
typename LaunchContextPolicy,
typename BODY>
312 SEGMENT
const& segment0,
313 SEGMENT
const& segment1,
317 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
319 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
321 body(*(segment0.begin() + i0), *(segment1.begin() + i1));
325 template<
typename SEGMENT,
326 typename IndexMapper0,
327 typename IndexMapper1,
328 typename IndexMapper2>
330 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::DirectUnchecked,
331 kernel_sync_requirement::none,
338 using diff_t =
typename std::iterator_traits<
339 typename SEGMENT::iterator>::difference_type;
341 template<
typename LaunchContextPolicy,
typename BODY>
344 SEGMENT
const& segment0,
345 SEGMENT
const& segment1,
346 SEGMENT
const& segment2,
350 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
352 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
354 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims());
356 body(*(segment0.begin() + i0), *(segment1.begin() + i1),
357 *(segment2.begin() + i2));
361 template<
typename SEGMENT,
typename IndexMapper>
363 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::Direct,
364 kernel_sync_requirement::none,
369 using diff_t =
typename std::iterator_traits<
370 typename SEGMENT::iterator>::difference_type;
372 template<
typename LaunchContextPolicy,
typename BODY>
375 SEGMENT
const& segment,
378 const diff_t len = segment.end() - segment.begin();
380 IndexMapper::template index<diff_t>(
ctx.get_indices_and_dims());
384 body(*(segment.begin() + i));
389 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
391 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::Direct,
392 kernel_sync_requirement::none,
398 using diff_t =
typename std::iterator_traits<
399 typename SEGMENT::iterator>::difference_type;
401 template<
typename LaunchContextPolicy,
typename BODY>
404 SEGMENT
const& segment0,
405 SEGMENT
const& segment1,
408 const int len0 = segment0.end() - segment0.begin();
409 const int len1 = segment1.end() - segment1.begin();
412 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
414 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
416 if (i0 < len0 && i1 < len1)
418 body(*(segment0.begin() + i0), *(segment1.begin() + i1));
423 template<
typename SEGMENT,
424 typename IndexMapper0,
425 typename IndexMapper1,
426 typename IndexMapper2>
428 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::Direct,
429 kernel_sync_requirement::none,
436 using diff_t =
typename std::iterator_traits<
437 typename SEGMENT::iterator>::difference_type;
439 template<
typename LaunchContextPolicy,
typename BODY>
442 SEGMENT
const& segment0,
443 SEGMENT
const& segment1,
444 SEGMENT
const& segment2,
447 const int len0 = segment0.end() - segment0.begin();
448 const int len1 = segment1.end() - segment1.begin();
449 const int len2 = segment2.end() - segment2.begin();
452 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
454 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
456 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims());
458 if (i0 < len0 && i1 < len1 && i2 < len2)
460 body(*(segment0.begin() + i0), *(segment1.begin() + i1),
461 *(segment2.begin() + i2));
466 template<
typename SEGMENT,
typename IndexMapper>
468 RAJA::policy::hip::hip_indexer<
469 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
470 kernel_sync_requirement::none,
475 using diff_t =
typename std::iterator_traits<
476 typename SEGMENT::iterator>::difference_type;
478 template<
typename LaunchContextPolicy,
typename BODY>
481 SEGMENT
const& segment,
484 const diff_t len = segment.end() - segment.begin();
486 IndexMapper::template index<diff_t>(
ctx.get_indices_and_dims());
488 IndexMapper::template size<diff_t>(
ctx.get_indices_and_dims());
490 for (
diff_t i = i_init; i < len; i += i_stride)
492 body(*(segment.begin() + i));
497 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
499 RAJA::policy::hip::hip_indexer<
500 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
501 kernel_sync_requirement::none,
507 using diff_t =
typename std::iterator_traits<
508 typename SEGMENT::iterator>::difference_type;
510 template<
typename LaunchContextPolicy,
typename BODY>
513 SEGMENT
const& segment0,
514 SEGMENT
const& segment1,
517 const int len0 = segment0.end() - segment0.begin();
518 const int len1 = segment1.end() - segment1.begin();
521 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
523 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
526 IndexMapper0::template size<diff_t>(
ctx.get_indices_and_dims());
528 IndexMapper1::template size<diff_t>(
ctx.get_indices_and_dims());
530 for (
diff_t i0 = i0_init; i0 < len0; i0 += i0_stride)
533 for (
diff_t i1 = i1_init; i1 < len1; i1 += i1_stride)
536 body(*(segment0.begin() + i0), *(segment1.begin() + i1));
542 template<
typename SEGMENT,
543 typename IndexMapper0,
544 typename IndexMapper1,
545 typename IndexMapper2>
547 RAJA::policy::hip::hip_indexer<
548 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
549 kernel_sync_requirement::none,
556 using diff_t =
typename std::iterator_traits<
557 typename SEGMENT::iterator>::difference_type;
559 template<
typename LaunchContextPolicy,
typename BODY>
562 SEGMENT
const& segment0,
563 SEGMENT
const& segment1,
564 SEGMENT
const& segment2,
567 const int len0 = segment0.end() - segment0.begin();
568 const int len1 = segment1.end() - segment1.begin();
569 const int len2 = segment2.end() - segment2.begin();
572 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
574 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
576 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims());
579 IndexMapper0::template size<diff_t>(
ctx.get_indices_and_dims());
581 IndexMapper1::template size<diff_t>(
ctx.get_indices_and_dims());
583 IndexMapper2::template size<diff_t>(
ctx.get_indices_and_dims());
585 for (
diff_t i0 = i0_init; i0 < len0; i0 += i0_stride)
588 for (
diff_t i1 = i1_init; i1 < len1; i1 += i1_stride)
591 for (
diff_t i2 = i2_init; i2 < len2; i2 += i2_stride)
594 body(*(segment0.begin() + i0), *(segment1.begin() + i1),
595 *(segment2.begin() + i2));
605 template<
typename SEGMENT,
typename IndexMapper>
607 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::DirectUnchecked,
608 kernel_sync_requirement::none,
613 using diff_t =
typename std::iterator_traits<
614 typename SEGMENT::iterator>::difference_type;
616 template<
typename LaunchContextPolicy,
typename BODY>
619 SEGMENT
const& segment,
623 IndexMapper::template index<diff_t>(
ctx.get_indices_and_dims());
625 body(*(segment.begin() + i), i);
629 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
631 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::DirectUnchecked,
632 kernel_sync_requirement::none,
638 using diff_t =
typename std::iterator_traits<
639 typename SEGMENT::iterator>::difference_type;
641 template<
typename LaunchContextPolicy,
typename BODY>
644 SEGMENT
const& segment0,
645 SEGMENT
const& segment1,
649 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
651 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
653 body(*(segment0.begin() + i0), *(segment1.begin() + i1), i0, i1);
657 template<
typename SEGMENT,
658 typename IndexMapper0,
659 typename IndexMapper1,
660 typename IndexMapper2>
662 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::DirectUnchecked,
663 kernel_sync_requirement::none,
670 using diff_t =
typename std::iterator_traits<
671 typename SEGMENT::iterator>::difference_type;
673 template<
typename LaunchContextPolicy,
typename BODY>
676 SEGMENT
const& segment0,
677 SEGMENT
const& segment1,
678 SEGMENT
const& segment2,
682 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
684 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
686 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims());
688 body(*(segment0.begin() + i0), *(segment1.begin() + i1),
689 *(segment2.begin() + i2), i0, i1, i2);
693 template<
typename SEGMENT,
typename IndexMapper>
695 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::Direct,
696 kernel_sync_requirement::none,
701 using diff_t =
typename std::iterator_traits<
702 typename SEGMENT::iterator>::difference_type;
704 template<
typename LaunchContextPolicy,
typename BODY>
707 SEGMENT
const& segment,
710 const diff_t len = segment.end() - segment.begin();
712 IndexMapper::template index<diff_t>(
ctx.get_indices_and_dims());
716 body(*(segment.begin() + i), i);
721 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
723 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::Direct,
724 kernel_sync_requirement::none,
730 using diff_t =
typename std::iterator_traits<
731 typename SEGMENT::iterator>::difference_type;
733 template<
typename LaunchContextPolicy,
typename BODY>
736 SEGMENT
const& segment0,
737 SEGMENT
const& segment1,
740 const int len0 = segment0.end() - segment0.begin();
741 const int len1 = segment1.end() - segment1.begin();
744 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
746 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
748 if (i0 < len0 && i1 < len1)
750 body(*(segment0.begin() + i0), *(segment1.begin() + i1), i0, i1);
755 template<
typename SEGMENT,
756 typename IndexMapper0,
757 typename IndexMapper1,
758 typename IndexMapper2>
760 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::Direct,
761 kernel_sync_requirement::none,
768 using diff_t =
typename std::iterator_traits<
769 typename SEGMENT::iterator>::difference_type;
771 template<
typename LaunchContextPolicy,
typename BODY>
774 SEGMENT
const& segment0,
775 SEGMENT
const& segment1,
776 SEGMENT
const& segment2,
779 const int len0 = segment0.end() - segment0.begin();
780 const int len1 = segment1.end() - segment1.begin();
781 const int len2 = segment2.end() - segment2.begin();
784 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
786 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
788 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims());
790 if (i0 < len0 && i1 < len1 && i2 < len2)
792 body(*(segment0.begin() + i0), *(segment1.begin() + i1),
793 *(segment2.begin() + i2), i0, i1, i2);
798 template<
typename SEGMENT,
typename IndexMapper>
800 RAJA::policy::hip::hip_indexer<
801 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
802 kernel_sync_requirement::none,
807 using diff_t =
typename std::iterator_traits<
808 typename SEGMENT::iterator>::difference_type;
810 template<
typename LaunchContextPolicy,
typename BODY>
813 SEGMENT
const& segment,
816 const diff_t len = segment.end() - segment.begin();
818 IndexMapper::template index<diff_t>(
ctx.get_indices_and_dims());
820 IndexMapper::template size<diff_t>(
ctx.get_indices_and_dims());
822 for (
diff_t i = i_init; i < len; i += i_stride)
824 body(*(segment.begin() + i), i);
829 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
831 RAJA::policy::hip::hip_indexer<
832 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
833 kernel_sync_requirement::none,
839 using diff_t =
typename std::iterator_traits<
840 typename SEGMENT::iterator>::difference_type;
842 template<
typename LaunchContextPolicy,
typename BODY>
845 SEGMENT
const& segment0,
846 SEGMENT
const& segment1,
849 const int len0 = segment0.end() - segment0.begin();
850 const int len1 = segment1.end() - segment1.begin();
853 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
855 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
858 IndexMapper0::template size<diff_t>(
ctx.get_indices_and_dims());
860 IndexMapper1::template size<diff_t>(
ctx.get_indices_and_dims());
862 for (
diff_t i0 = i0_init; i0 < len0; i0 += i0_stride)
865 for (
diff_t i1 = i1_init; i1 < len1; i1 += i1_stride)
868 body(*(segment0.begin() + i0), *(segment1.begin() + i1), i0, i1);
874 template<
typename SEGMENT,
875 typename IndexMapper0,
876 typename IndexMapper1,
877 typename IndexMapper2>
879 RAJA::policy::hip::hip_indexer<
880 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
881 kernel_sync_requirement::none,
888 using diff_t =
typename std::iterator_traits<
889 typename SEGMENT::iterator>::difference_type;
891 template<
typename LaunchContextPolicy,
typename BODY>
894 SEGMENT
const& segment0,
895 SEGMENT
const& segment1,
896 SEGMENT
const& segment2,
899 const int len0 = segment0.end() - segment0.begin();
900 const int len1 = segment1.end() - segment1.begin();
901 const int len2 = segment2.end() - segment2.begin();
904 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
906 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
908 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims());
911 IndexMapper0::template size<diff_t>(
ctx.get_indices_and_dims());
913 IndexMapper1::template size<diff_t>(
ctx.get_indices_and_dims());
915 IndexMapper2::template size<diff_t>(
ctx.get_indices_and_dims());
917 for (
diff_t i0 = i0_init; i0 < len0; i0 += i0_stride)
920 for (
diff_t i1 = i1_init; i1 < len1; i1 += i1_stride)
923 for (
diff_t i2 = i2_init; i2 < len2; i2 += i2_stride)
926 body(*(segment0.begin() + i0), *(segment1.begin() + i1),
927 *(segment2.begin() + i2), i0, i1, i2);
937 template<
typename SEGMENT, kernel_sync_requirement sync,
typename IndexMapper0>
939 RAJA::iteration_mapping::DirectUnchecked,
944 RAJA::iteration_mapping::DirectUnchecked,
950 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
952 RAJA::iteration_mapping::DirectUnchecked,
953 kernel_sync_requirement::none,
958 using diff_t =
typename std::iterator_traits<
959 typename SEGMENT::iterator>::difference_type;
961 template<
typename LaunchContextPolicy,
typename BODY>
964 SEGMENT
const& segment,
968 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
970 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
973 IndexMapper0::template size<diff_t>(
ctx.get_indices_and_dims());
975 const int i = i0 + i0_stride * i1;
977 body(*(segment.begin() + i));
981 template<
typename SEGMENT,
982 typename IndexMapper0,
983 typename IndexMapper1,
984 typename IndexMapper2>
986 RAJA::iteration_mapping::DirectUnchecked,
987 kernel_sync_requirement::none,
993 using diff_t =
typename std::iterator_traits<
994 typename SEGMENT::iterator>::difference_type;
996 template<
typename LaunchContextPolicy,
typename BODY>
999 SEGMENT
const& segment,
1003 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
1005 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
1007 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims());
1010 IndexMapper0::template size<diff_t>(
ctx.get_indices_and_dims());
1012 IndexMapper1::template size<diff_t>(
ctx.get_indices_and_dims());
1014 const int i = i0 + i0_stride * (i1 + i1_stride * i2);
1016 body(*(segment.begin() + i));
1020 template<
typename SEGMENT, kernel_sync_requirement sync,
typename IndexMapper0>
1022 RAJA::policy::hip::hip_flatten_indexer<RAJA::iteration_mapping::Direct,
1028 hip_indexer<RAJA::iteration_mapping::Direct, sync, IndexMapper0>,
1032 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
1034 RAJA::policy::hip::hip_flatten_indexer<RAJA::iteration_mapping::Direct,
1035 kernel_sync_requirement::none,
1040 using diff_t =
typename std::iterator_traits<
1041 typename SEGMENT::iterator>::difference_type;
1043 template<
typename LaunchContextPolicy,
typename BODY>
1046 SEGMENT
const& segment,
1049 const int len = segment.end() - segment.begin();
1052 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
1054 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
1057 IndexMapper0::template size<diff_t>(
ctx.get_indices_and_dims());
1059 const int i = i0 + i0_stride * i1;
1063 body(*(segment.begin() + i));
1068 template<
typename SEGMENT,
1069 typename IndexMapper0,
1070 typename IndexMapper1,
1071 typename IndexMapper2>
1073 RAJA::policy::hip::hip_flatten_indexer<RAJA::iteration_mapping::Direct,
1074 kernel_sync_requirement::none,
1080 using diff_t =
typename std::iterator_traits<
1081 typename SEGMENT::iterator>::difference_type;
1083 template<
typename LaunchContextPolicy,
typename BODY>
1086 SEGMENT
const& segment,
1089 const int len = segment.end() - segment.begin();
1092 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
1094 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
1096 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims());
1099 IndexMapper0::template size<diff_t>(
ctx.get_indices_and_dims());
1101 IndexMapper1::template size<diff_t>(
ctx.get_indices_and_dims());
1103 const int i = i0 + i0_stride * (i1 + i1_stride * i2);
1107 body(*(segment.begin() + i));
1112 template<
typename SEGMENT, kernel_sync_requirement sync,
typename IndexMapper0>
1114 RAJA::policy::hip::hip_flatten_indexer<
1115 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
1120 RAJA::policy::hip::hip_indexer<
1121 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
1127 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
1129 RAJA::policy::hip::hip_flatten_indexer<
1130 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
1131 kernel_sync_requirement::none,
1136 using diff_t =
typename std::iterator_traits<
1137 typename SEGMENT::iterator>::difference_type;
1139 template<
typename LaunchContextPolicy,
typename BODY>
1142 SEGMENT
const& segment,
1145 const int len = segment.end() - segment.begin();
1148 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
1150 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
1152 const int i0_stride =
1153 IndexMapper0::template size<diff_t>(
ctx.get_indices_and_dims());
1154 const int i1_stride =
1155 IndexMapper1::template size<diff_t>(
ctx.get_indices_and_dims());
1157 for (
int i = i0 + i0_stride * i1; i < len; i += i0_stride * i1_stride)
1159 body(*(segment.begin() + i));
1164 template<
typename SEGMENT,
1165 typename IndexMapper0,
1166 typename IndexMapper1,
1167 typename IndexMapper2>
1169 RAJA::policy::hip::hip_flatten_indexer<
1170 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
1171 kernel_sync_requirement::none,
1177 using diff_t =
typename std::iterator_traits<
1178 typename SEGMENT::iterator>::difference_type;
1180 template<
typename LaunchContextPolicy,
typename BODY>
1183 SEGMENT
const& segment,
1186 const int len = segment.end() - segment.begin();
1189 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
1191 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
1193 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims());
1195 const int i0_stride =
1196 IndexMapper0::template size<diff_t>(
ctx.get_indices_and_dims());
1197 const int i1_stride =
1198 IndexMapper1::template size<diff_t>(
ctx.get_indices_and_dims());
1199 const int i2_stride =
1200 IndexMapper2::template size<diff_t>(
ctx.get_indices_and_dims());
1202 for (
int i = i0 + i0_stride * (i1 + i1_stride * i2); i < len;
1203 i += i0_stride * i1_stride * i2_stride)
1205 body(*(segment.begin() + i));
1213 template<
typename SEGMENT,
typename IndexMapper>
1215 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::DirectUnchecked,
1216 kernel_sync_requirement::none,
1221 using diff_t =
typename std::iterator_traits<
1222 typename SEGMENT::iterator>::difference_type;
1224 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1228 SEGMENT
const& segment,
1232 IndexMapper::template index<diff_t>(
ctx.get_indices_and_dims()) *
1233 static_cast<diff_t>(tile_size);
1235 body(segment.slice(i,
static_cast<diff_t>(tile_size)));
1239 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
1241 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::DirectUnchecked,
1242 kernel_sync_requirement::none,
1248 using diff_t =
typename std::iterator_traits<
1249 typename SEGMENT::iterator>::difference_type;
1251 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1256 SEGMENT
const& segment0,
1257 SEGMENT
const& segment1,
1261 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims()) *
1262 static_cast<diff_t>(tile_size0);
1264 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims()) *
1265 static_cast<diff_t>(tile_size1);
1267 body(segment0.slice(i0,
static_cast<diff_t>(tile_size0)),
1268 segment1.slice(i1,
static_cast<diff_t>(tile_size1)));
1272 template<
typename SEGMENT,
1273 typename IndexMapper0,
1274 typename IndexMapper1,
1275 typename IndexMapper2>
1277 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::DirectUnchecked,
1278 kernel_sync_requirement::none,
1285 using diff_t =
typename std::iterator_traits<
1286 typename SEGMENT::iterator>::difference_type;
1288 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1294 SEGMENT
const& segment0,
1295 SEGMENT
const& segment1,
1296 SEGMENT
const& segment2,
1300 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims()) *
1301 static_cast<diff_t>(tile_size0);
1303 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims()) *
1304 static_cast<diff_t>(tile_size1);
1306 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims()) *
1307 static_cast<diff_t>(tile_size2);
1309 body(segment0.slice(i0,
static_cast<diff_t>(tile_size0)),
1310 segment1.slice(i1,
static_cast<diff_t>(tile_size1)),
1311 segment2.slice(i2,
static_cast<diff_t>(tile_size2)));
1315 template<
typename SEGMENT,
typename IndexMapper>
1317 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::Direct,
1318 kernel_sync_requirement::none,
1323 using diff_t =
typename std::iterator_traits<
1324 typename SEGMENT::iterator>::difference_type;
1326 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1330 SEGMENT
const& segment,
1333 const diff_t len = segment.end() - segment.begin();
1335 IndexMapper::template index<diff_t>(
ctx.get_indices_and_dims()) *
1336 static_cast<diff_t>(tile_size);
1340 body(segment.slice(i,
static_cast<diff_t>(tile_size)));
1345 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
1347 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::Direct,
1348 kernel_sync_requirement::none,
1354 using diff_t =
typename std::iterator_traits<
1355 typename SEGMENT::iterator>::difference_type;
1357 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1362 SEGMENT
const& segment0,
1363 SEGMENT
const& segment1,
1366 const diff_t len0 = segment0.end() - segment0.begin();
1367 const diff_t len1 = segment1.end() - segment1.begin();
1370 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims()) *
1371 static_cast<diff_t>(tile_size0);
1373 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims()) *
1374 static_cast<diff_t>(tile_size1);
1376 if (i0 < len0 && i1 < len1)
1378 body(segment0.slice(i0,
static_cast<diff_t>(tile_size0)),
1379 segment1.slice(i1,
static_cast<diff_t>(tile_size1)));
1384 template<
typename SEGMENT,
1385 typename IndexMapper0,
1386 typename IndexMapper1,
1387 typename IndexMapper2>
1389 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::Direct,
1390 kernel_sync_requirement::none,
1397 using diff_t =
typename std::iterator_traits<
1398 typename SEGMENT::iterator>::difference_type;
1400 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1406 SEGMENT
const& segment0,
1407 SEGMENT
const& segment1,
1408 SEGMENT
const& segment2,
1411 const diff_t len0 = segment0.end() - segment0.begin();
1412 const diff_t len1 = segment1.end() - segment1.begin();
1413 const diff_t len2 = segment2.end() - segment2.begin();
1416 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims()) *
1417 static_cast<diff_t>(tile_size0);
1419 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims()) *
1420 static_cast<diff_t>(tile_size1);
1422 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims()) *
1423 static_cast<diff_t>(tile_size2);
1425 if (i0 < len0 && i1 < len1 && i2 < len2)
1427 body(segment0.slice(i0,
static_cast<diff_t>(tile_size0)),
1428 segment1.slice(i1,
static_cast<diff_t>(tile_size1)),
1429 segment2.slice(i2,
static_cast<diff_t>(tile_size2)));
1434 template<
typename SEGMENT,
typename IndexMapper>
1436 RAJA::policy::hip::hip_indexer<
1437 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
1438 kernel_sync_requirement::none,
1443 using diff_t =
typename std::iterator_traits<
1444 typename SEGMENT::iterator>::difference_type;
1446 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1450 SEGMENT
const& segment,
1453 const diff_t len = segment.end() - segment.begin();
1455 IndexMapper::template index<diff_t>(
ctx.get_indices_and_dims()) *
1456 static_cast<diff_t>(tile_size);
1458 IndexMapper::template size<diff_t>(
ctx.get_indices_and_dims()) *
1459 static_cast<diff_t>(tile_size);
1461 for (
diff_t i = i_init; i < len; i += i_stride)
1463 body(segment.slice(i,
static_cast<diff_t>(tile_size)));
1468 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
1470 RAJA::policy::hip::hip_indexer<
1471 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
1472 kernel_sync_requirement::none,
1478 using diff_t =
typename std::iterator_traits<
1479 typename SEGMENT::iterator>::difference_type;
1481 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1486 SEGMENT
const& segment0,
1487 SEGMENT
const& segment1,
1490 const diff_t len0 = segment0.end() - segment0.begin();
1491 const diff_t len1 = segment1.end() - segment1.begin();
1494 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims()) *
1495 static_cast<diff_t>(tile_size0);
1497 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims()) *
1498 static_cast<diff_t>(tile_size1);
1501 IndexMapper0::template size<diff_t>(
ctx.get_indices_and_dims()) *
1502 static_cast<diff_t>(tile_size0);
1504 IndexMapper1::template size<diff_t>(
ctx.get_indices_and_dims()) *
1505 static_cast<diff_t>(tile_size1);
1507 for (
diff_t i0 = i0_init; i0 < len0; i0 += i0_stride)
1509 for (
diff_t i1 = i1_init; i1 < len1; i1 += i1_stride)
1511 body(segment0.slice(i0,
static_cast<diff_t>(tile_size0)),
1512 segment1.slice(i1,
static_cast<diff_t>(tile_size1)));
1518 template<
typename SEGMENT,
1519 typename IndexMapper0,
1520 typename IndexMapper1,
1521 typename IndexMapper2>
1523 RAJA::policy::hip::hip_indexer<
1524 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
1525 kernel_sync_requirement::none,
1532 using diff_t =
typename std::iterator_traits<
1533 typename SEGMENT::iterator>::difference_type;
1535 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1541 SEGMENT
const& segment0,
1542 SEGMENT
const& segment1,
1543 SEGMENT
const& segment2,
1546 const diff_t len0 = segment0.end() - segment0.begin();
1547 const diff_t len1 = segment1.end() - segment1.begin();
1548 const diff_t len2 = segment2.end() - segment2.begin();
1551 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims()) *
1552 static_cast<diff_t>(tile_size0);
1554 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims()) *
1555 static_cast<diff_t>(tile_size1);
1557 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims()) *
1558 static_cast<diff_t>(tile_size2);
1561 IndexMapper0::template size<diff_t>(
ctx.get_indices_and_dims()) *
1562 static_cast<diff_t>(tile_size0);
1564 IndexMapper1::template size<diff_t>(
ctx.get_indices_and_dims()) *
1565 static_cast<diff_t>(tile_size1);
1567 IndexMapper2::template size<diff_t>(
ctx.get_indices_and_dims()) *
1568 static_cast<diff_t>(tile_size2);
1570 for (
diff_t i0 = i0_init; i0 < len0; i0 += i0_stride)
1572 for (
diff_t i1 = i1_init; i1 < len1; i1 += i1_stride)
1574 for (
diff_t i2 = i2_init; i2 < len2; i2 += i2_stride)
1576 body(segment0.slice(i0,
static_cast<diff_t>(tile_size0)),
1577 segment1.slice(i1,
static_cast<diff_t>(tile_size1)),
1578 segment2.slice(i2,
static_cast<diff_t>(tile_size2)));
1588 template<
typename SEGMENT,
typename IndexMapper>
1590 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::DirectUnchecked,
1591 kernel_sync_requirement::none,
1596 using diff_t =
typename std::iterator_traits<
1597 typename SEGMENT::iterator>::difference_type;
1599 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1603 SEGMENT
const& segment,
1607 IndexMapper::template index<diff_t>(
ctx.get_indices_and_dims());
1610 body(segment.slice(i,
static_cast<diff_t>(tile_size)), t);
1614 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
1616 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::DirectUnchecked,
1617 kernel_sync_requirement::none,
1623 using diff_t =
typename std::iterator_traits<
1624 typename SEGMENT::iterator>::difference_type;
1626 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1631 SEGMENT
const& segment0,
1632 SEGMENT
const& segment1,
1636 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
1638 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
1640 const diff_t i0 = t0 *
static_cast<diff_t>(tile_size0);
1641 const diff_t i1 = t1 *
static_cast<diff_t>(tile_size1);
1643 body(segment0.slice(i0,
static_cast<diff_t>(tile_size0)),
1644 segment1.slice(i1,
static_cast<diff_t>(tile_size1)), t0, t1);
1648 template<
typename SEGMENT,
1649 typename IndexMapper0,
1650 typename IndexMapper1,
1651 typename IndexMapper2>
1653 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::DirectUnchecked,
1654 kernel_sync_requirement::none,
1661 using diff_t =
typename std::iterator_traits<
1662 typename SEGMENT::iterator>::difference_type;
1664 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1670 SEGMENT
const& segment0,
1671 SEGMENT
const& segment1,
1672 SEGMENT
const& segment2,
1676 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
1678 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
1680 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims());
1682 const diff_t i0 = t0 *
static_cast<diff_t>(tile_size0);
1683 const diff_t i1 = t1 *
static_cast<diff_t>(tile_size1);
1684 const diff_t i2 = t2 *
static_cast<diff_t>(tile_size2);
1686 body(segment0.slice(i0,
static_cast<diff_t>(tile_size0)),
1687 segment1.slice(i1,
static_cast<diff_t>(tile_size1)),
1688 segment2.slice(i2,
static_cast<diff_t>(tile_size2)), t0, t1, t2);
1692 template<
typename SEGMENT,
typename IndexMapper>
1694 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::Direct,
1695 kernel_sync_requirement::none,
1700 using diff_t =
typename std::iterator_traits<
1701 typename SEGMENT::iterator>::difference_type;
1703 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1707 SEGMENT
const& segment,
1710 const diff_t len = segment.end() - segment.begin();
1712 IndexMapper::template index<diff_t>(
ctx.get_indices_and_dims());
1717 body(segment.slice(i,
static_cast<diff_t>(tile_size)), t);
1722 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
1724 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::Direct,
1725 kernel_sync_requirement::none,
1731 using diff_t =
typename std::iterator_traits<
1732 typename SEGMENT::iterator>::difference_type;
1734 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1739 SEGMENT
const& segment0,
1740 SEGMENT
const& segment1,
1743 const diff_t len0 = segment0.end() - segment0.begin();
1744 const diff_t len1 = segment1.end() - segment1.begin();
1747 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
1749 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
1751 const diff_t i0 = t0 *
static_cast<diff_t>(tile_size0);
1752 const diff_t i1 = t1 *
static_cast<diff_t>(tile_size1);
1754 if (i0 < len0 && i1 < len1)
1756 body(segment0.slice(i0,
static_cast<diff_t>(tile_size0)),
1757 segment1.slice(i1,
static_cast<diff_t>(tile_size1)), t0, t1);
1762 template<
typename SEGMENT,
1763 typename IndexMapper0,
1764 typename IndexMapper1,
1765 typename IndexMapper2>
1767 RAJA::policy::hip::hip_indexer<RAJA::iteration_mapping::Direct,
1768 kernel_sync_requirement::none,
1775 using diff_t =
typename std::iterator_traits<
1776 typename SEGMENT::iterator>::difference_type;
1778 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1784 SEGMENT
const& segment0,
1785 SEGMENT
const& segment1,
1786 SEGMENT
const& segment2,
1789 const diff_t len0 = segment0.end() - segment0.begin();
1790 const diff_t len1 = segment1.end() - segment1.begin();
1791 const diff_t len2 = segment2.end() - segment2.begin();
1794 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
1796 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
1798 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims());
1800 const diff_t i0 = t0 *
static_cast<diff_t>(tile_size0);
1801 const diff_t i1 = t1 *
static_cast<diff_t>(tile_size1);
1802 const diff_t i2 = t2 *
static_cast<diff_t>(tile_size2);
1804 if (i0 < len0 && i1 < len1 && i2 < len2)
1806 body(segment0.slice(i0,
static_cast<diff_t>(tile_size0)),
1807 segment1.slice(i1,
static_cast<diff_t>(tile_size1)),
1808 segment2.slice(i2,
static_cast<diff_t>(tile_size2)), t0, t1, t2);
1813 template<
typename SEGMENT,
typename IndexMapper>
1815 RAJA::policy::hip::hip_indexer<
1816 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
1817 kernel_sync_requirement::none,
1822 using diff_t =
typename std::iterator_traits<
1823 typename SEGMENT::iterator>::difference_type;
1825 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1829 SEGMENT
const& segment,
1832 const diff_t len = segment.end() - segment.begin();
1834 IndexMapper::template index<diff_t>(
ctx.get_indices_and_dims());
1835 const diff_t i_init = t_init *
static_cast<diff_t>(tile_size);
1837 IndexMapper::template size<diff_t>(
ctx.get_indices_and_dims());
1838 const diff_t i_stride = t_stride *
static_cast<diff_t>(tile_size);
1840 for (
diff_t i = i_init, t = t_init; i < len; i += i_stride, t += t_stride)
1842 body(segment.slice(i,
static_cast<diff_t>(tile_size)), t);
1847 template<
typename SEGMENT,
typename IndexMapper0,
typename IndexMapper1>
1849 RAJA::policy::hip::hip_indexer<
1850 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
1851 kernel_sync_requirement::none,
1857 using diff_t =
typename std::iterator_traits<
1858 typename SEGMENT::iterator>::difference_type;
1860 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1865 SEGMENT
const& segment0,
1866 SEGMENT
const& segment1,
1869 const diff_t len0 = segment0.end() - segment0.begin();
1870 const diff_t len1 = segment1.end() - segment1.begin();
1873 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
1875 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
1877 const diff_t i0_init = t0_init *
static_cast<diff_t>(tile_size0);
1878 const diff_t i1_init = t1_init *
static_cast<diff_t>(tile_size1);
1881 IndexMapper0::template size<diff_t>(
ctx.get_indices_and_dims());
1883 IndexMapper1::template size<diff_t>(
ctx.get_indices_and_dims());
1885 const diff_t i0_stride = t0_stride *
static_cast<diff_t>(tile_size0);
1886 const diff_t i1_stride = t1_stride *
static_cast<diff_t>(tile_size1);
1888 for (
diff_t i0 = i0_init, t0 = t0_init; i0 < len0;
1889 i0 += i0_stride, t0 += t0_stride)
1891 for (
diff_t i1 = i1_init, t1 = t1_init; i1 < len1;
1892 i1 += i1_stride, t1 += t1_stride)
1894 body(segment0.slice(i0,
static_cast<diff_t>(tile_size0)),
1895 segment1.slice(i1,
static_cast<diff_t>(tile_size1)), t0, t1);
1901 template<
typename SEGMENT,
1902 typename IndexMapper0,
1903 typename IndexMapper1,
1904 typename IndexMapper2>
1906 RAJA::policy::hip::hip_indexer<
1907 RAJA::iteration_mapping::StridedLoop<named_usage::unspecified>,
1908 kernel_sync_requirement::none,
1915 using diff_t =
typename std::iterator_traits<
1916 typename SEGMENT::iterator>::difference_type;
1918 template<
typename LaunchContextPolicy,
typename TILE_T,
typename BODY>
1924 SEGMENT
const& segment0,
1925 SEGMENT
const& segment1,
1926 SEGMENT
const& segment2,
1929 const diff_t len0 = segment0.end() - segment0.begin();
1930 const diff_t len1 = segment1.end() - segment1.begin();
1931 const diff_t len2 = segment2.end() - segment2.begin();
1934 IndexMapper0::template index<diff_t>(
ctx.get_indices_and_dims());
1936 IndexMapper1::template index<diff_t>(
ctx.get_indices_and_dims());
1938 IndexMapper2::template index<diff_t>(
ctx.get_indices_and_dims());
1940 const diff_t i0_init = t0_init *
static_cast<diff_t>(tile_size0);
1941 const diff_t i1_init = t1_init *
static_cast<diff_t>(tile_size1);
1942 const diff_t i2_init = t2_init *
static_cast<diff_t>(tile_size2);
1945 IndexMapper0::template size<diff_t>(
ctx.get_indices_and_dims());
1947 IndexMapper1::template size<diff_t>(
ctx.get_indices_and_dims());
1949 IndexMapper2::template size<diff_t>(
ctx.get_indices_and_dims());
1951 const diff_t i0_stride = t0_stride *
static_cast<diff_t>(tile_size0);
1952 const diff_t i1_stride = t1_stride *
static_cast<diff_t>(tile_size1);
1953 const diff_t i2_stride = t2_stride *
static_cast<diff_t>(tile_size2);
1955 for (
diff_t i0 = i0_init, t0 = t0_init; i0 < len0;
1956 i0 += i0_stride, t0 += t0_stride)
1958 for (
diff_t i1 = i1_init, t1 = t1_init; i1 < len1;
1959 i1 += i1_stride, t1 += t1_stride)
1961 for (
diff_t i2 = i2_init, t2 = t2_init; i2 < len2;
1962 i2 += i2_stride, t2 += t2_stride)
1964 body(segment0.slice(i0,
static_cast<diff_t>(tile_size0)),
1965 segment1.slice(i1,
static_cast<diff_t>(tile_size1)),
1966 segment2.slice(i2,
static_cast<diff_t>(tile_size2)), t0, t1, t2);
Header file defining prototypes for routines used to manage memory for HIP reductions and other opera...
Definition: launch_core.hpp:192
Definition: launch_core.hpp:246
RAJA_HOST_DEVICE RAJA_INLINE indices_and_dims_t const & get_indices_and_dims() const
Definition: launch.hpp:52
indices_and_dims_t indices_and_dims
Definition: launch.hpp:45
RAJA_HOST_DEVICE RAJA_INLINE LaunchContextT()
Definition: launch.hpp:47
IndicesAndDimsT indices_and_dims_t
Definition: launch.hpp:43
Definition: launch_context_policy.hpp:30
Header file containing RAJA HIP policy definitions.
RAJA header file containing the core components of RAJA::launch.
#define RAJA_HOST_DEVICE
Definition: macros.hpp:65
#define RAJA_DEVICE
Definition: macros.hpp:66
Args args
Definition: WorkRunner.hpp:212
constexpr RAJA_HOST_DEVICE auto invoke_body(Params &¶ms, Fn &&f, Ts &&... extra)
Definition: forall.hpp:598
RAJA_HOST_DEVICE auto thread_privatize(const T &item) -> Privatizer< T >
Create a private copy of the argument to be stored on the current thread's stack in a class of the Pr...
Definition: privatizer.hpp:88
Definition: AlignedRangeIndexSetBuilders.cpp:35
LaunchContextType ctx
Definition: launch.hpp:185
__launch_bounds__(num_threads, BLOCKS_PER_SM) __global__ void launch_new_reduce_global_fcn_fixed(const RAJA_CUDA_GRID_CONSTANT BODY body_in
ReduceParams reduce_params
Definition: launch.hpp:173
__global__ void launch_new_reduce_global_fcn(const RAJA_CUDA_GRID_CONSTANT BODY body_in, ReduceParams reduce_params)
Definition: launch.hpp:61
void launch(LaunchParams const &launch_params, ReduceParams &&... rest_of_launch_args)
Definition: launch_core.hpp:268
auto & body
Definition: launch.hpp:177
__shared__ char raja_shmem_ptr[]
Definition: launch.hpp:174
typename RAJA::detail::launch_context_type< BODY >::type LaunchContextType
Definition: launch.hpp:183
auto privatizer
Definition: launch.hpp:176
Header file containing utility methods used in HIP operations.
Header file for RAJA resource definitions.
static concepts::enable_if_t< resources::EventProxy< resources::Resource >, RAJA::expt::type_traits::is_ForallParamPack< ReduceParams > > exec(RAJA::resources::Resource res, const LaunchParams &launch_params, BODY_IN &&body_in, ReduceParams &launch_reducers)
Definition: launch.hpp:92
static concepts::enable_if_t< resources::EventProxy< resources::Resource >, RAJA::expt::type_traits::is_ForallParamPack< ReduceParams > > exec(RAJA::resources::Resource res, const LaunchParams &launch_params, BODY_IN &&body_in, ReduceParams &launch_reducers)
Definition: launch.hpp:196
Definition: launch_core.hpp:263
Definition: launch_core.hpp:163
size_t shared_mem_size
Definition: launch_core.hpp:167
Teams teams
Definition: launch_core.hpp:165
Threads threads
Definition: launch_core.hpp:166
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:962
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:959
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1178
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:1181
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1041
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:1044
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:997
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:994
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:1084
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1081
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1137
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:1140
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:476
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:479
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment0, SEGMENT const &segment1, SEGMENT const &segment2, BODY const &body)
Definition: launch.hpp:342
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:339
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment0, SEGMENT const &segment1, SEGMENT const &segment2, BODY const &body)
Definition: launch.hpp:440
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:437
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:282
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:285
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch.hpp:310
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:307
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:370
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:373
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch.hpp:511
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:508
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:399
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch.hpp:402
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:557
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment0, SEGMENT const &segment1, SEGMENT const &segment2, BODY const &body)
Definition: launch.hpp:560
Definition: launch_core.hpp:480
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch.hpp:734
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:731
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:769
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment0, SEGMENT const &segment1, SEGMENT const &segment2, BODY const &body)
Definition: launch.hpp:772
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:889
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment0, SEGMENT const &segment1, SEGMENT const &segment2, BODY const &body)
Definition: launch.hpp:892
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment0, SEGMENT const &segment1, SEGMENT const &segment2, BODY const &body)
Definition: launch.hpp:674
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:671
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch.hpp:843
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:840
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:702
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:705
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:614
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:617
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:639
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch.hpp:642
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:808
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:811
Definition: launch_core.hpp:483
int value[3]
Definition: launch_core.hpp:99
int value[3]
Definition: launch_core.hpp:124
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1355
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size0, TILE_T tile_size1, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch.hpp:1358
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:1447
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1444
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size0, TILE_T tile_size1, TILE_T tile_size2, SEGMENT const &segment0, SEGMENT const &segment1, SEGMENT const &segment2, BODY const &body)
Definition: launch.hpp:1536
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1533
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1324
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:1327
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size0, TILE_T tile_size1, TILE_T tile_size2, SEGMENT const &segment0, SEGMENT const &segment1, SEGMENT const &segment2, BODY const &body)
Definition: launch.hpp:1289
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1286
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1479
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size0, TILE_T tile_size1, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch.hpp:1482
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1222
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:1225
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1398
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size0, TILE_T tile_size1, TILE_T tile_size2, SEGMENT const &segment0, SEGMENT const &segment1, SEGMENT const &segment2, BODY const &body)
Definition: launch.hpp:1401
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1249
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size0, TILE_T tile_size1, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch.hpp:1252
Definition: launch_core.hpp:579
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:1600
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1597
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1858
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size0, TILE_T tile_size1, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch.hpp:1861
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1624
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size0, TILE_T tile_size1, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch.hpp:1627
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size0, TILE_T tile_size1, SEGMENT const &segment0, SEGMENT const &segment1, BODY const &body)
Definition: launch.hpp:1735
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1732
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size0, TILE_T tile_size1, TILE_T tile_size2, SEGMENT const &segment0, SEGMENT const &segment1, SEGMENT const &segment2, BODY const &body)
Definition: launch.hpp:1919
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1916
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:1704
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1701
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1662
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size0, TILE_T tile_size1, TILE_T tile_size2, SEGMENT const &segment0, SEGMENT const &segment1, SEGMENT const &segment2, BODY const &body)
Definition: launch.hpp:1665
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1776
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size0, TILE_T tile_size1, TILE_T tile_size2, SEGMENT const &segment0, SEGMENT const &segment1, SEGMENT const &segment2, BODY const &body)
Definition: launch.hpp:1779
static RAJA_INLINE RAJA_DEVICE void exec(LaunchContextT< LaunchContextPolicy > const &ctx, TILE_T tile_size, SEGMENT const &segment, BODY const &body)
Definition: launch.hpp:1826
typename std::iterator_traits< typename SEGMENT::iterator >::difference_type diff_t
Definition: launch.hpp:1823
Definition: launch_core.hpp:582
static constexpr void parampack_resolve(EXEC_POL const &pol, ForallParamPack< Params... > &f_params, Args &&... args)
Definition: forall.hpp:304
static constexpr void parampack_init(EXEC_POL const &pol, ForallParamPack< Params... > &f_params, Args &&... args)
Definition: forall.hpp:269
static RAJA_HOST_DEVICE constexpr void parampack_combine(EXEC_POL const &pol, ForallParamPack< Params... > &f_params, Args &&... args)
Definition: forall.hpp:286
Definition: TypeTraits.hpp:59