20 #include "kmp_error.h"
23 #include "kmp_stats.h"
27 #include "ompt-specific.h"
33 char const *traits_t<int>::spec =
"d";
34 char const *traits_t<unsigned int>::spec =
"u";
35 char const *traits_t<long long>::spec =
"lld";
36 char const *traits_t<unsigned long long>::spec =
"llu";
37 char const *traits_t<long>::spec =
"ld";
42 #define KMP_STATS_LOOP_END(stat) \
45 kmp_int64 u = (kmp_int64)(*pupper); \
46 kmp_int64 l = (kmp_int64)(*plower); \
47 kmp_int64 i = (kmp_int64)incr; \
50 } else if (i == -1) { \
53 t = (u - l) / i + 1; \
55 KMP_DEBUG_ASSERT(i != 0); \
56 t = (l - u) / (-i) + 1; \
58 KMP_COUNT_VALUE(stat, t); \
59 KMP_POP_PARTITIONED_TIMER(); \
62 #define KMP_STATS_LOOP_END(stat)
65 #if USE_ITT_BUILD || defined KMP_DEBUG
67 static inline void check_loc(
ident_t *&loc) {
74 static void __kmp_for_static_init(
ident_t *loc, kmp_int32 global_tid,
75 kmp_int32 schedtype, kmp_int32 *plastiter,
77 typename traits_t<T>::signed_t *pstride,
78 typename traits_t<T>::signed_t incr,
79 typename traits_t<T>::signed_t chunk
80 #
if OMPT_SUPPORT && OMPT_OPTIONAL
86 KMP_PUSH_PARTITIONED_TIMER(OMP_loop_static);
87 KMP_PUSH_PARTITIONED_TIMER(OMP_loop_static_scheduling);
90 schedtype = SCHEDULE_WITHOUT_MODIFIERS(schedtype);
92 typedef typename traits_t<T>::unsigned_t UT;
93 typedef typename traits_t<T>::signed_t ST;
95 kmp_int32 gtid = global_tid;
100 __kmp_assert_valid_gtid(gtid);
101 kmp_info_t *th = __kmp_threads[gtid];
103 #if OMPT_SUPPORT && OMPT_OPTIONAL
104 ompt_team_info_t *team_info = NULL;
105 ompt_task_info_t *task_info = NULL;
106 ompt_work_t ompt_work_type = ompt_work_loop_static;
108 static kmp_int8 warn = 0;
110 if (ompt_enabled.ompt_callback_work || ompt_enabled.ompt_callback_dispatch) {
112 team_info = __ompt_get_teaminfo(0, NULL);
113 task_info = __ompt_get_task_info_object(0);
117 ompt_work_type = ompt_work_loop_static;
119 ompt_work_type = ompt_work_sections;
121 ompt_work_type = ompt_work_distribute;
124 KMP_COMPARE_AND_STORE_ACQ8(&warn, (kmp_int8)0, (kmp_int8)1);
126 KMP_WARNING(OmptOutdatedWorkshare);
128 KMP_DEBUG_ASSERT(ompt_work_type);
133 KMP_DEBUG_ASSERT(plastiter && plower && pupper && pstride);
134 KE_TRACE(10, (
"__kmpc_for_static_init called (%d)\n", global_tid));
139 buff = __kmp_str_format(
140 "__kmpc_for_static_init: T#%%d sched=%%d liter=%%d iter=(%%%s,"
141 " %%%s, %%%s) incr=%%%s chunk=%%%s signed?<%s>\n",
142 traits_t<T>::spec, traits_t<T>::spec, traits_t<ST>::spec,
143 traits_t<ST>::spec, traits_t<ST>::spec, traits_t<T>::spec);
144 KD_TRACE(100, (buff, global_tid, schedtype, *plastiter, *plower, *pupper,
145 *pstride, incr, chunk));
146 __kmp_str_free(&buff);
150 if (__kmp_env_consistency_check) {
151 __kmp_push_workshare(global_tid, ct_pdo, loc);
153 __kmp_error_construct(kmp_i18n_msg_CnsLoopIncrZeroProhibited, ct_pdo,
158 if (incr > 0 ? (*pupper < *plower) : (*plower < *pupper)) {
159 if (plastiter != NULL)
171 buff = __kmp_str_format(
"__kmpc_for_static_init:(ZERO TRIP) liter=%%d "
172 "lower=%%%s upper=%%%s stride = %%%s "
173 "signed?<%s>, loc = %%s\n",
174 traits_t<T>::spec, traits_t<T>::spec,
175 traits_t<ST>::spec, traits_t<T>::spec);
178 (buff, *plastiter, *plower, *pupper, *pstride, loc->
psource));
179 __kmp_str_free(&buff);
182 KE_TRACE(10, (
"__kmpc_for_static_init: T#%d return\n", global_tid));
184 #if OMPT_SUPPORT && OMPT_OPTIONAL
185 if (ompt_enabled.ompt_callback_work) {
186 ompt_callbacks.ompt_callback(ompt_callback_work)(
187 ompt_work_type, ompt_scope_begin, &(team_info->parallel_data),
188 &(task_info->task_data), 0, codeptr);
191 KMP_STATS_LOOP_END(OMP_loop_static_iterations);
203 if (th->th.th_team->t.t_serialized > 1) {
205 team = th->th.th_team;
207 tid = th->th.th_team->t.t_master_tid;
208 team = th->th.th_team->t.t_parent;
211 tid = __kmp_tid_from_gtid(global_tid);
212 team = th->th.th_team;
216 if (team->t.t_serialized) {
218 if (plastiter != NULL)
222 (incr > 0) ? (*pupper - *plower + 1) : (-(*plower - *pupper + 1));
228 buff = __kmp_str_format(
"__kmpc_for_static_init: (serial) liter=%%d "
229 "lower=%%%s upper=%%%s stride = %%%s\n",
230 traits_t<T>::spec, traits_t<T>::spec,
232 KD_TRACE(100, (buff, *plastiter, *plower, *pupper, *pstride));
233 __kmp_str_free(&buff);
236 KE_TRACE(10, (
"__kmpc_for_static_init: T#%d return\n", global_tid));
238 #if OMPT_SUPPORT && OMPT_OPTIONAL
239 if (ompt_enabled.ompt_callback_work) {
240 ompt_callbacks.ompt_callback(ompt_callback_work)(
241 ompt_work_type, ompt_scope_begin, &(team_info->parallel_data),
242 &(task_info->task_data), *pstride, codeptr);
245 KMP_STATS_LOOP_END(OMP_loop_static_iterations);
248 nth = team->t.t_nproc;
250 if (plastiter != NULL)
253 (incr > 0) ? (*pupper - *plower + 1) : (-(*plower - *pupper + 1));
258 buff = __kmp_str_format(
"__kmpc_for_static_init: (serial) liter=%%d "
259 "lower=%%%s upper=%%%s stride = %%%s\n",
260 traits_t<T>::spec, traits_t<T>::spec,
262 KD_TRACE(100, (buff, *plastiter, *plower, *pupper, *pstride));
263 __kmp_str_free(&buff);
266 KE_TRACE(10, (
"__kmpc_for_static_init: T#%d return\n", global_tid));
268 #if OMPT_SUPPORT && OMPT_OPTIONAL
269 if (ompt_enabled.ompt_callback_work) {
270 ompt_callbacks.ompt_callback(ompt_callback_work)(
271 ompt_work_type, ompt_scope_begin, &(team_info->parallel_data),
272 &(task_info->task_data), *pstride, codeptr);
275 KMP_STATS_LOOP_END(OMP_loop_static_iterations);
281 trip_count = *pupper - *plower + 1;
282 }
else if (incr == -1) {
283 trip_count = *plower - *pupper + 1;
284 }
else if (incr > 0) {
286 trip_count = (UT)(*pupper - *plower) / incr + 1;
288 KMP_DEBUG_ASSERT(incr != 0);
289 trip_count = (UT)(*plower - *pupper) / (-incr) + 1;
292 #if KMP_STATS_ENABLED
293 if (KMP_MASTER_GTID(gtid)) {
298 if (__kmp_env_consistency_check) {
300 if (trip_count == 0 && *pupper != *plower) {
301 __kmp_error_construct(kmp_i18n_msg_CnsIterationRangeTooLarge, ct_pdo,
309 if (trip_count < nth) {
311 __kmp_static == kmp_sch_static_greedy ||
313 kmp_sch_static_balanced);
314 if (tid < trip_count) {
315 *pupper = *plower = *plower + tid * incr;
318 *plower = *pupper + (incr > 0 ? 1 : -1);
320 if (plastiter != NULL)
321 *plastiter = (tid == trip_count - 1);
323 KMP_DEBUG_ASSERT(nth != 0);
324 if (__kmp_static == kmp_sch_static_balanced) {
325 UT small_chunk = trip_count / nth;
326 UT extras = trip_count % nth;
327 *plower += incr * (tid * small_chunk + (tid < extras ? tid : extras));
328 *pupper = *plower + small_chunk * incr - (tid < extras ? 0 : incr);
329 if (plastiter != NULL)
330 *plastiter = (tid == nth - 1);
332 T big_chunk_inc_count =
333 (trip_count / nth + ((trip_count % nth) ? 1 : 0)) * incr;
334 T old_upper = *pupper;
336 KMP_DEBUG_ASSERT(__kmp_static == kmp_sch_static_greedy);
339 *plower += tid * big_chunk_inc_count;
340 *pupper = *plower + big_chunk_inc_count - incr;
342 if (*pupper < *plower)
343 *pupper = traits_t<T>::max_value;
344 if (plastiter != NULL)
345 *plastiter = *plower <= old_upper && *pupper > old_upper - incr;
346 if (*pupper > old_upper)
349 if (*pupper > *plower)
350 *pupper = traits_t<T>::min_value;
351 if (plastiter != NULL)
352 *plastiter = *plower >= old_upper && *pupper < old_upper - incr;
353 if (*pupper < old_upper)
358 *pstride = trip_count;
361 case kmp_sch_static_chunked: {
364 KMP_DEBUG_ASSERT(chunk != 0);
367 else if ((UT)chunk > trip_count)
369 nchunks = (trip_count) / (UT)chunk + (trip_count % (UT)chunk ? 1 : 0);
372 *pstride = span * nchunks;
374 *plower = *plower + (span * tid);
375 *pupper = *plower + span - incr;
377 *plower = *pupper + (incr > 0 ? 1 : -1);
380 *pstride = span * nth;
381 *plower = *plower + (span * tid);
382 *pupper = *plower + span - incr;
384 if (plastiter != NULL)
385 *plastiter = (tid == (nchunks - 1) % nth);
388 case kmp_sch_static_balanced_chunked: {
389 T old_upper = *pupper;
390 KMP_DEBUG_ASSERT(nth != 0);
392 UT span = (trip_count + nth - 1) / nth;
395 chunk = (span + chunk - 1) & ~(chunk - 1);
398 *plower = *plower + (span * tid);
399 *pupper = *plower + span - incr;
401 if (*pupper > old_upper)
403 }
else if (*pupper < old_upper)
406 if (plastiter != NULL) {
407 KMP_DEBUG_ASSERT(chunk != 0);
408 *plastiter = (tid == ((trip_count - 1) / (UT)chunk));
413 KMP_ASSERT2(0,
"__kmpc_for_static_init: unknown scheduling type");
419 if (KMP_MASTER_TID(tid) && __itt_metadata_add_ptr &&
420 __kmp_forkjoin_frames_mode == 3 && th->th.th_teams_microtask == NULL &&
421 team->t.t_active_level == 1) {
422 kmp_uint64 cur_chunk = chunk;
427 KMP_DEBUG_ASSERT(nth != 0);
428 cur_chunk = trip_count / nth + ((trip_count % nth) ? 1 : 0);
431 __kmp_itt_metadata_loop(loc, 0, trip_count, cur_chunk);
438 buff = __kmp_str_format(
"__kmpc_for_static_init: liter=%%d lower=%%%s "
439 "upper=%%%s stride = %%%s signed?<%s>\n",
440 traits_t<T>::spec, traits_t<T>::spec,
441 traits_t<ST>::spec, traits_t<T>::spec);
442 KD_TRACE(100, (buff, *plastiter, *plower, *pupper, *pstride));
443 __kmp_str_free(&buff);
446 KE_TRACE(10, (
"__kmpc_for_static_init: T#%d return\n", global_tid));
448 #if OMPT_SUPPORT && OMPT_OPTIONAL
449 if (ompt_enabled.ompt_callback_work) {
450 ompt_callbacks.ompt_callback(ompt_callback_work)(
451 ompt_work_type, ompt_scope_begin, &(team_info->parallel_data),
452 &(task_info->task_data), trip_count, codeptr);
454 if (ompt_enabled.ompt_callback_dispatch) {
455 ompt_dispatch_t dispatch_type;
456 ompt_data_t instance = ompt_data_none;
457 ompt_dispatch_chunk_t dispatch_chunk;
458 if (ompt_work_type == ompt_work_sections) {
459 dispatch_type = ompt_dispatch_section;
460 instance.ptr = codeptr;
462 OMPT_GET_DISPATCH_CHUNK(dispatch_chunk, *plower, *pupper, incr);
463 dispatch_type = (ompt_work_type == ompt_work_distribute)
464 ? ompt_dispatch_distribute_chunk
465 : ompt_dispatch_ws_loop_chunk;
466 instance.ptr = &dispatch_chunk;
468 ompt_callbacks.ompt_callback(ompt_callback_dispatch)(
469 &(team_info->parallel_data), &(task_info->task_data), dispatch_type,
474 KMP_STATS_LOOP_END(OMP_loop_static_iterations);
478 template <
typename T>
479 static void __kmp_dist_for_static_init(
ident_t *loc, kmp_int32 gtid,
480 kmp_int32 schedule, kmp_int32 *plastiter,
481 T *plower, T *pupper, T *pupperDist,
482 typename traits_t<T>::signed_t *pstride,
483 typename traits_t<T>::signed_t incr,
484 typename traits_t<T>::signed_t chunk
485 #
if OMPT_SUPPORT && OMPT_OPTIONAL
491 KMP_PUSH_PARTITIONED_TIMER(OMP_distribute);
492 KMP_PUSH_PARTITIONED_TIMER(OMP_distribute_scheduling);
493 typedef typename traits_t<T>::unsigned_t UT;
494 typedef typename traits_t<T>::signed_t ST;
503 KMP_DEBUG_ASSERT(plastiter && plower && pupper && pupperDist && pstride);
504 KE_TRACE(10, (
"__kmpc_dist_for_static_init called (%d)\n", gtid));
505 __kmp_assert_valid_gtid(gtid);
510 buff = __kmp_str_format(
511 "__kmpc_dist_for_static_init: T#%%d schedLoop=%%d liter=%%d "
512 "iter=(%%%s, %%%s, %%%s) chunk=%%%s signed?<%s>\n",
513 traits_t<T>::spec, traits_t<T>::spec, traits_t<ST>::spec,
514 traits_t<ST>::spec, traits_t<T>::spec);
516 (buff, gtid, schedule, *plastiter, *plower, *pupper, incr, chunk));
517 __kmp_str_free(&buff);
521 if (__kmp_env_consistency_check) {
522 __kmp_push_workshare(gtid, ct_pdo, loc);
524 __kmp_error_construct(kmp_i18n_msg_CnsLoopIncrZeroProhibited, ct_pdo,
527 if (incr > 0 ? (*pupper < *plower) : (*plower < *pupper)) {
537 __kmp_error_construct(kmp_i18n_msg_CnsLoopIncrIllegal, ct_pdo, loc);
540 tid = __kmp_tid_from_gtid(gtid);
541 th = __kmp_threads[gtid];
542 nth = th->th.th_team_nproc;
543 team = th->th.th_team;
544 KMP_DEBUG_ASSERT(th->th.th_teams_microtask);
549 while (team->t.t_parent && team->t.t_serialized)
550 team = team->t.t_parent;
551 nteams = th->th.th_teams_size.nteams;
552 team_id = team->t.t_master_tid;
553 KMP_DEBUG_ASSERT(nteams == (kmp_uint32)team->t.t_parent->t.t_nproc);
557 trip_count = *pupper - *plower + 1;
558 }
else if (incr == -1) {
559 trip_count = *plower - *pupper + 1;
560 }
else if (incr > 0) {
562 trip_count = (UT)(*pupper - *plower) / incr + 1;
564 KMP_DEBUG_ASSERT(incr != 0);
565 trip_count = (UT)(*plower - *pupper) / (-incr) + 1;
568 *pstride = *pupper - *plower;
569 if (trip_count <= nteams) {
571 __kmp_static == kmp_sch_static_greedy ||
573 kmp_sch_static_balanced);
576 if (team_id < trip_count && tid == 0) {
577 *pupper = *pupperDist = *plower = *plower + team_id * incr;
579 *pupperDist = *pupper;
580 *plower = *pupper + incr;
582 if (plastiter != NULL)
583 *plastiter = (tid == 0 && team_id == trip_count - 1);
586 KMP_DEBUG_ASSERT(nteams != 0);
587 if (__kmp_static == kmp_sch_static_balanced) {
588 UT chunkD = trip_count / nteams;
589 UT extras = trip_count % nteams;
591 incr * (team_id * chunkD + (team_id < extras ? team_id : extras));
592 *pupperDist = *plower + chunkD * incr - (team_id < extras ? 0 : incr);
593 if (plastiter != NULL)
594 *plastiter = (team_id == nteams - 1);
597 (trip_count / nteams + ((trip_count % nteams) ? 1 : 0)) * incr;
599 KMP_DEBUG_ASSERT(__kmp_static == kmp_sch_static_greedy);
601 *plower += team_id * chunk_inc_count;
602 *pupperDist = *plower + chunk_inc_count - incr;
605 if (*pupperDist < *plower)
606 *pupperDist = traits_t<T>::max_value;
607 if (plastiter != NULL)
608 *plastiter = *plower <= upper && *pupperDist > upper - incr;
609 if (*pupperDist > upper)
611 if (*plower > *pupperDist) {
612 *pupper = *pupperDist;
616 if (*pupperDist > *plower)
617 *pupperDist = traits_t<T>::min_value;
618 if (plastiter != NULL)
619 *plastiter = *plower >= upper && *pupperDist < upper - incr;
620 if (*pupperDist < upper)
622 if (*plower < *pupperDist) {
623 *pupper = *pupperDist;
631 trip_count = *pupperDist - *plower + 1;
632 }
else if (incr == -1) {
633 trip_count = *plower - *pupperDist + 1;
634 }
else if (incr > 1) {
636 trip_count = (UT)(*pupperDist - *plower) / incr + 1;
638 KMP_DEBUG_ASSERT(incr != 0);
639 trip_count = (UT)(*plower - *pupperDist) / (-incr) + 1;
641 KMP_DEBUG_ASSERT(trip_count);
644 if (trip_count <= nth) {
646 __kmp_static == kmp_sch_static_greedy ||
648 kmp_sch_static_balanced);
649 if (tid < trip_count)
650 *pupper = *plower = *plower + tid * incr;
652 *plower = *pupper + incr;
653 if (plastiter != NULL)
654 if (*plastiter != 0 && !(tid == trip_count - 1))
657 KMP_DEBUG_ASSERT(nth != 0);
658 if (__kmp_static == kmp_sch_static_balanced) {
659 UT chunkL = trip_count / nth;
660 UT extras = trip_count % nth;
661 *plower += incr * (tid * chunkL + (tid < extras ? tid : extras));
662 *pupper = *plower + chunkL * incr - (tid < extras ? 0 : incr);
663 if (plastiter != NULL)
664 if (*plastiter != 0 && !(tid == nth - 1))
668 (trip_count / nth + ((trip_count % nth) ? 1 : 0)) * incr;
669 T upper = *pupperDist;
670 KMP_DEBUG_ASSERT(__kmp_static == kmp_sch_static_greedy);
672 *plower += tid * chunk_inc_count;
673 *pupper = *plower + chunk_inc_count - incr;
675 if (*pupper < *plower)
676 *pupper = traits_t<T>::max_value;
677 if (plastiter != NULL)
678 if (*plastiter != 0 &&
679 !(*plower <= upper && *pupper > upper - incr))
684 if (*pupper > *plower)
685 *pupper = traits_t<T>::min_value;
686 if (plastiter != NULL)
687 if (*plastiter != 0 &&
688 !(*plower >= upper && *pupper < upper - incr))
697 case kmp_sch_static_chunked: {
702 *pstride = span * nth;
703 *plower = *plower + (span * tid);
704 *pupper = *plower + span - incr;
705 if (plastiter != NULL) {
706 KMP_DEBUG_ASSERT(chunk != 0);
707 if (*plastiter != 0 && !(tid == ((trip_count - 1) / (UT)chunk) % nth))
714 "__kmpc_dist_for_static_init: unknown loop scheduling type");
723 buff = __kmp_str_format(
724 "__kmpc_dist_for_static_init: last=%%d lo=%%%s up=%%%s upDist=%%%s "
725 "stride=%%%s signed?<%s>\n",
726 traits_t<T>::spec, traits_t<T>::spec, traits_t<T>::spec,
727 traits_t<ST>::spec, traits_t<T>::spec);
728 KD_TRACE(100, (buff, *plastiter, *plower, *pupper, *pupperDist, *pstride));
729 __kmp_str_free(&buff);
732 KE_TRACE(10, (
"__kmpc_dist_for_static_init: T#%d return\n", gtid));
733 #if OMPT_SUPPORT && OMPT_OPTIONAL
734 if (ompt_enabled.ompt_callback_work || ompt_enabled.ompt_callback_dispatch) {
735 ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
736 ompt_task_info_t *task_info = __ompt_get_task_info_object(0);
737 if (ompt_enabled.ompt_callback_work) {
738 ompt_callbacks.ompt_callback(ompt_callback_work)(
739 ompt_work_distribute, ompt_scope_begin, &(team_info->parallel_data),
740 &(task_info->task_data), 0, codeptr);
742 if (ompt_enabled.ompt_callback_dispatch) {
743 ompt_data_t instance = ompt_data_none;
744 ompt_dispatch_chunk_t dispatch_chunk;
745 OMPT_GET_DISPATCH_CHUNK(dispatch_chunk, *plower, *pupperDist, incr);
746 instance.ptr = &dispatch_chunk;
747 ompt_callbacks.ompt_callback(ompt_callback_dispatch)(
748 &(team_info->parallel_data), &(task_info->task_data),
749 ompt_dispatch_distribute_chunk, instance);
753 KMP_STATS_LOOP_END(OMP_distribute_iterations);
757 template <
typename T>
758 static void __kmp_team_static_init(
ident_t *loc, kmp_int32 gtid,
759 kmp_int32 *p_last, T *p_lb, T *p_ub,
760 typename traits_t<T>::signed_t *p_st,
761 typename traits_t<T>::signed_t incr,
762 typename traits_t<T>::signed_t chunk) {
768 typedef typename traits_t<T>::unsigned_t UT;
769 typedef typename traits_t<T>::signed_t ST;
779 KMP_DEBUG_ASSERT(p_last && p_lb && p_ub && p_st);
780 KE_TRACE(10, (
"__kmp_team_static_init called (%d)\n", gtid));
781 __kmp_assert_valid_gtid(gtid);
786 buff = __kmp_str_format(
"__kmp_team_static_init enter: T#%%d liter=%%d "
787 "iter=(%%%s, %%%s, %%%s) chunk %%%s; signed?<%s>\n",
788 traits_t<T>::spec, traits_t<T>::spec,
789 traits_t<ST>::spec, traits_t<ST>::spec,
791 KD_TRACE(100, (buff, gtid, *p_last, *p_lb, *p_ub, *p_st, chunk));
792 __kmp_str_free(&buff);
798 if (__kmp_env_consistency_check) {
800 __kmp_error_construct(kmp_i18n_msg_CnsLoopIncrZeroProhibited, ct_pdo,
803 if (incr > 0 ? (upper < lower) : (lower < upper)) {
813 __kmp_error_construct(kmp_i18n_msg_CnsLoopIncrIllegal, ct_pdo, loc);
816 th = __kmp_threads[gtid];
817 team = th->th.th_team;
818 KMP_DEBUG_ASSERT(th->th.th_teams_microtask);
819 nteams = th->th.th_teams_size.nteams;
820 team_id = team->t.t_master_tid;
821 KMP_DEBUG_ASSERT(nteams == (kmp_uint32)team->t.t_parent->t.t_nproc);
825 trip_count = upper - lower + 1;
826 }
else if (incr == -1) {
827 trip_count = lower - upper + 1;
828 }
else if (incr > 0) {
830 trip_count = (UT)(upper - lower) / incr + 1;
832 KMP_DEBUG_ASSERT(incr != 0);
833 trip_count = (UT)(lower - upper) / (-incr) + 1;
838 *p_st = span * nteams;
839 *p_lb = lower + (span * team_id);
840 *p_ub = *p_lb + span - incr;
841 if (p_last != NULL) {
842 KMP_DEBUG_ASSERT(chunk != 0);
843 *p_last = (team_id == ((trip_count - 1) / (UT)chunk) % nteams);
848 *p_ub = traits_t<T>::max_value;
853 *p_ub = traits_t<T>::min_value;
862 __kmp_str_format(
"__kmp_team_static_init exit: T#%%d team%%u liter=%%d "
863 "iter=(%%%s, %%%s, %%%s) chunk %%%s\n",
864 traits_t<T>::spec, traits_t<T>::spec,
865 traits_t<ST>::spec, traits_t<ST>::spec);
866 KD_TRACE(100, (buff, gtid, team_id, *p_last, *p_lb, *p_ub, *p_st, chunk));
867 __kmp_str_free(&buff);
896 kmp_int32 *plastiter, kmp_int32 *plower,
897 kmp_int32 *pupper, kmp_int32 *pstride,
898 kmp_int32 incr, kmp_int32 chunk) {
899 __kmp_for_static_init<kmp_int32>(loc, gtid, schedtype, plastiter, plower,
900 pupper, pstride, incr, chunk
901 #
if OMPT_SUPPORT && OMPT_OPTIONAL
903 OMPT_GET_RETURN_ADDRESS(0)
912 kmp_int32 schedtype, kmp_int32 *plastiter,
913 kmp_uint32 *plower, kmp_uint32 *pupper,
914 kmp_int32 *pstride, kmp_int32 incr,
916 __kmp_for_static_init<kmp_uint32>(loc, gtid, schedtype, plastiter, plower,
917 pupper, pstride, incr, chunk
918 #
if OMPT_SUPPORT && OMPT_OPTIONAL
920 OMPT_GET_RETURN_ADDRESS(0)
929 kmp_int32 *plastiter, kmp_int64 *plower,
930 kmp_int64 *pupper, kmp_int64 *pstride,
931 kmp_int64 incr, kmp_int64 chunk) {
932 __kmp_for_static_init<kmp_int64>(loc, gtid, schedtype, plastiter, plower,
933 pupper, pstride, incr, chunk
934 #
if OMPT_SUPPORT && OMPT_OPTIONAL
936 OMPT_GET_RETURN_ADDRESS(0)
945 kmp_int32 schedtype, kmp_int32 *plastiter,
946 kmp_uint64 *plower, kmp_uint64 *pupper,
947 kmp_int64 *pstride, kmp_int64 incr,
949 __kmp_for_static_init<kmp_uint64>(loc, gtid, schedtype, plastiter, plower,
950 pupper, pstride, incr, chunk
951 #
if OMPT_SUPPORT && OMPT_OPTIONAL
953 OMPT_GET_RETURN_ADDRESS(0)
961 #if OMPT_SUPPORT && OMPT_OPTIONAL
962 #define OMPT_CODEPTR_ARG , OMPT_GET_RETURN_ADDRESS(0)
964 #define OMPT_CODEPTR_ARG
990 kmp_int32 schedule, kmp_int32 *plastiter,
991 kmp_int32 *plower, kmp_int32 *pupper,
992 kmp_int32 *pupperD, kmp_int32 *pstride,
993 kmp_int32 incr, kmp_int32 chunk) {
994 __kmp_dist_for_static_init<kmp_int32>(loc, gtid, schedule, plastiter, plower,
995 pupper, pupperD, pstride, incr,
996 chunk OMPT_CODEPTR_ARG);
1003 kmp_int32 schedule, kmp_int32 *plastiter,
1004 kmp_uint32 *plower, kmp_uint32 *pupper,
1005 kmp_uint32 *pupperD, kmp_int32 *pstride,
1006 kmp_int32 incr, kmp_int32 chunk) {
1007 __kmp_dist_for_static_init<kmp_uint32>(loc, gtid, schedule, plastiter, plower,
1008 pupper, pupperD, pstride, incr,
1009 chunk OMPT_CODEPTR_ARG);
1016 kmp_int32 schedule, kmp_int32 *plastiter,
1017 kmp_int64 *plower, kmp_int64 *pupper,
1018 kmp_int64 *pupperD, kmp_int64 *pstride,
1019 kmp_int64 incr, kmp_int64 chunk) {
1020 __kmp_dist_for_static_init<kmp_int64>(loc, gtid, schedule, plastiter, plower,
1021 pupper, pupperD, pstride, incr,
1022 chunk OMPT_CODEPTR_ARG);
1029 kmp_int32 schedule, kmp_int32 *plastiter,
1030 kmp_uint64 *plower, kmp_uint64 *pupper,
1031 kmp_uint64 *pupperD, kmp_int64 *pstride,
1032 kmp_int64 incr, kmp_int64 chunk) {
1033 __kmp_dist_for_static_init<kmp_uint64>(loc, gtid, schedule, plastiter, plower,
1034 pupper, pupperD, pstride, incr,
1035 chunk OMPT_CODEPTR_ARG);
1068 kmp_int32 *p_lb, kmp_int32 *p_ub,
1069 kmp_int32 *p_st, kmp_int32 incr,
1071 KMP_DEBUG_ASSERT(__kmp_init_serial);
1072 __kmp_team_static_init<kmp_int32>(loc, gtid, p_last, p_lb, p_ub, p_st, incr,
1080 kmp_uint32 *p_lb, kmp_uint32 *p_ub,
1081 kmp_int32 *p_st, kmp_int32 incr,
1083 KMP_DEBUG_ASSERT(__kmp_init_serial);
1084 __kmp_team_static_init<kmp_uint32>(loc, gtid, p_last, p_lb, p_ub, p_st, incr,
1092 kmp_int64 *p_lb, kmp_int64 *p_ub,
1093 kmp_int64 *p_st, kmp_int64 incr,
1095 KMP_DEBUG_ASSERT(__kmp_init_serial);
1096 __kmp_team_static_init<kmp_int64>(loc, gtid, p_last, p_lb, p_ub, p_st, incr,
1104 kmp_uint64 *p_lb, kmp_uint64 *p_ub,
1105 kmp_int64 *p_st, kmp_int64 incr,
1107 KMP_DEBUG_ASSERT(__kmp_init_serial);
1108 __kmp_team_static_init<kmp_uint64>(loc, gtid, p_last, p_lb, p_ub, p_st, incr,
@ KMP_IDENT_WORK_SECTIONS
@ KMP_IDENT_WORK_DISTRIBUTE
#define KMP_COUNT_VALUE(name, value)
Adds value to specified timer (name).
#define KMP_COUNT_BLOCK(name)
Increments specified counter (name).
void __kmpc_for_static_init_8(ident_t *loc, kmp_int32 gtid, kmp_int32 schedtype, kmp_int32 *plastiter, kmp_int64 *plower, kmp_int64 *pupper, kmp_int64 *pstride, kmp_int64 incr, kmp_int64 chunk)
void __kmpc_dist_for_static_init_8(ident_t *loc, kmp_int32 gtid, kmp_int32 schedule, kmp_int32 *plastiter, kmp_int64 *plower, kmp_int64 *pupper, kmp_int64 *pupperD, kmp_int64 *pstride, kmp_int64 incr, kmp_int64 chunk)
void __kmpc_for_static_init_4u(ident_t *loc, kmp_int32 gtid, kmp_int32 schedtype, kmp_int32 *plastiter, kmp_uint32 *plower, kmp_uint32 *pupper, kmp_int32 *pstride, kmp_int32 incr, kmp_int32 chunk)
void __kmpc_team_static_init_8(ident_t *loc, kmp_int32 gtid, kmp_int32 *p_last, kmp_int64 *p_lb, kmp_int64 *p_ub, kmp_int64 *p_st, kmp_int64 incr, kmp_int64 chunk)
void __kmpc_dist_for_static_init_4u(ident_t *loc, kmp_int32 gtid, kmp_int32 schedule, kmp_int32 *plastiter, kmp_uint32 *plower, kmp_uint32 *pupper, kmp_uint32 *pupperD, kmp_int32 *pstride, kmp_int32 incr, kmp_int32 chunk)
void __kmpc_team_static_init_8u(ident_t *loc, kmp_int32 gtid, kmp_int32 *p_last, kmp_uint64 *p_lb, kmp_uint64 *p_ub, kmp_int64 *p_st, kmp_int64 incr, kmp_int64 chunk)
void __kmpc_for_static_init_8u(ident_t *loc, kmp_int32 gtid, kmp_int32 schedtype, kmp_int32 *plastiter, kmp_uint64 *plower, kmp_uint64 *pupper, kmp_int64 *pstride, kmp_int64 incr, kmp_int64 chunk)
void __kmpc_team_static_init_4u(ident_t *loc, kmp_int32 gtid, kmp_int32 *p_last, kmp_uint32 *p_lb, kmp_uint32 *p_ub, kmp_int32 *p_st, kmp_int32 incr, kmp_int32 chunk)
void __kmpc_dist_for_static_init_4(ident_t *loc, kmp_int32 gtid, kmp_int32 schedule, kmp_int32 *plastiter, kmp_int32 *plower, kmp_int32 *pupper, kmp_int32 *pupperD, kmp_int32 *pstride, kmp_int32 incr, kmp_int32 chunk)
void __kmpc_for_static_init_4(ident_t *loc, kmp_int32 gtid, kmp_int32 schedtype, kmp_int32 *plastiter, kmp_int32 *plower, kmp_int32 *pupper, kmp_int32 *pstride, kmp_int32 incr, kmp_int32 chunk)
void __kmpc_team_static_init_4(ident_t *loc, kmp_int32 gtid, kmp_int32 *p_last, kmp_int32 *p_lb, kmp_int32 *p_ub, kmp_int32 *p_st, kmp_int32 incr, kmp_int32 chunk)
void __kmpc_dist_for_static_init_8u(ident_t *loc, kmp_int32 gtid, kmp_int32 schedule, kmp_int32 *plastiter, kmp_uint64 *plower, kmp_uint64 *pupper, kmp_uint64 *pupperD, kmp_int64 *pstride, kmp_int64 incr, kmp_int64 chunk)