Lines Matching +full:spec +full:-
2 * kmp_sched.cpp -- static scheduling -- iteration initialization
5 //===----------------------------------------------------------------------===//
9 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
11 //===----------------------------------------------------------------------===//
15 NOTE: team->t.t_nproc is a constant inside of any dispatch loop, however
27 #include "ompt-specific.h"
31 //-------------------------------------------------------------------------
33 char const *traits_t<int>::spec = "d"; member in traits_t<int>
34 char const *traits_t<unsigned int>::spec = "u"; member in traits_t<unsigned int>
35 char const *traits_t<long long>::spec = "lld"; member in traits_t<long long>
36 char const *traits_t<unsigned long long>::spec = "llu"; member in traits_t<unsigned long long>
37 char const *traits_t<long>::spec = "ld"; member in traits_t<long>
38 //-------------------------------------------------------------------------
49 t = u - l + 1; \
50 } else if (i == -1) { \
51 t = l - u + 1; \
53 t = (u - l) / i + 1; \
56 t = (l - u) / (-i) + 1; \
116 if ((loc->flags & KMP_IDENT_WORK_LOOP) != 0) { in __kmp_for_static_init()
118 } else if ((loc->flags & KMP_IDENT_WORK_SECTIONS) != 0) { in __kmp_for_static_init()
120 } else if ((loc->flags & KMP_IDENT_WORK_DISTRIBUTE) != 0) { in __kmp_for_static_init()
142 traits_t<T>::spec, traits_t<T>::spec, traits_t<ST>::spec, in __kmp_for_static_init()
143 traits_t<ST>::spec, traits_t<ST>::spec, traits_t<T>::spec); in __kmp_for_static_init()
157 /* special handling for zero-trip loops */ in __kmp_for_static_init()
163 // *plower = *pupper - incr; in __kmp_for_static_init()
164 // let compiler bypass the illegal loop (like for(i=1;i<10;i--)) in __kmp_for_static_init()
166 // ON A ZERO-TRIP LOOP (lower=1, upper=0,stride=1) - JPH June 23, 2009. in __kmp_for_static_init()
174 traits_t<T>::spec, traits_t<T>::spec, in __kmp_for_static_init()
175 traits_t<ST>::spec, traits_t<T>::spec); in __kmp_for_static_init()
178 (buff, *plastiter, *plower, *pupper, *pstride, loc->psource)); in __kmp_for_static_init()
187 ompt_work_type, ompt_scope_begin, &(team_info->parallel_data), in __kmp_for_static_init()
188 &(task_info->task_data), 0, codeptr); in __kmp_for_static_init()
201 schedtype += kmp_sch_static - in __kmp_for_static_init()
203 if (th->th.th_team->t.t_serialized > 1) { in __kmp_for_static_init()
205 team = th->th.th_team; in __kmp_for_static_init()
207 tid = th->th.th_team->t.t_master_tid; in __kmp_for_static_init()
208 team = th->th.th_team->t.t_parent; in __kmp_for_static_init()
212 team = th->th.th_team; in __kmp_for_static_init()
216 if (team->t.t_serialized) { in __kmp_for_static_init()
222 (incr > 0) ? (*pupper - *plower + 1) : (-(*plower - *pupper + 1)); in __kmp_for_static_init()
230 traits_t<T>::spec, traits_t<T>::spec, in __kmp_for_static_init()
231 traits_t<ST>::spec); in __kmp_for_static_init()
241 ompt_work_type, ompt_scope_begin, &(team_info->parallel_data), in __kmp_for_static_init()
242 &(task_info->task_data), *pstride, codeptr); in __kmp_for_static_init()
248 nth = team->t.t_nproc; in __kmp_for_static_init()
253 (incr > 0) ? (*pupper - *plower + 1) : (-(*plower - *pupper + 1)); in __kmp_for_static_init()
260 traits_t<T>::spec, traits_t<T>::spec, in __kmp_for_static_init()
261 traits_t<ST>::spec); in __kmp_for_static_init()
271 ompt_work_type, ompt_scope_begin, &(team_info->parallel_data), in __kmp_for_static_init()
272 &(task_info->task_data), *pstride, codeptr); in __kmp_for_static_init()
281 trip_count = *pupper - *plower + 1; in __kmp_for_static_init()
282 } else if (incr == -1) { in __kmp_for_static_init()
283 trip_count = *plower - *pupper + 1; in __kmp_for_static_init()
285 // upper-lower can exceed the limit of signed type in __kmp_for_static_init()
286 trip_count = (UT)(*pupper - *plower) / incr + 1; in __kmp_for_static_init()
289 trip_count = (UT)(*plower - *pupper) / (-incr) + 1; in __kmp_for_static_init()
317 // set bounds so non-active threads execute no iterations in __kmp_for_static_init()
318 *plower = *pupper + (incr > 0 ? 1 : -1); in __kmp_for_static_init()
321 *plastiter = (tid == trip_count - 1); in __kmp_for_static_init()
328 *pupper = *plower + small_chunk * incr - (tid < extras ? 0 : incr); in __kmp_for_static_init()
330 *plastiter = (tid == nth - 1); in __kmp_for_static_init()
340 *pupper = *plower + big_chunk_inc_count - incr; in __kmp_for_static_init()
345 *plastiter = *plower <= old_upper && *pupper > old_upper - incr; in __kmp_for_static_init()
352 *plastiter = *plower >= old_upper && *pupper < old_upper - incr; in __kmp_for_static_init()
375 *pupper = *plower + span - incr; in __kmp_for_static_init()
377 *plower = *pupper + (incr > 0 ? 1 : -1); in __kmp_for_static_init()
382 *pupper = *plower + span - incr; in __kmp_for_static_init()
385 *plastiter = (tid == (nchunks - 1) % nth); in __kmp_for_static_init()
392 UT span = (trip_count + nth - 1) / nth; in __kmp_for_static_init()
395 chunk = (span + chunk - 1) & ~(chunk - 1); in __kmp_for_static_init()
399 *pupper = *plower + span - incr; in __kmp_for_static_init()
408 *plastiter = (tid == ((trip_count - 1) / (UT)chunk)); in __kmp_for_static_init()
420 __kmp_forkjoin_frames_mode == 3 && th->th.th_teams_microtask == NULL && in __kmp_for_static_init()
421 team->t.t_active_level == 1) { in __kmp_for_static_init()
430 // 0 - "static" schedule in __kmp_for_static_init()
440 traits_t<T>::spec, traits_t<T>::spec, in __kmp_for_static_init()
441 traits_t<ST>::spec, traits_t<T>::spec); in __kmp_for_static_init()
451 ompt_work_type, ompt_scope_begin, &(team_info->parallel_data), in __kmp_for_static_init()
452 &(task_info->task_data), trip_count, codeptr); in __kmp_for_static_init()
469 &(team_info->parallel_data), &(task_info->task_data), dispatch_type, in __kmp_for_static_init()
513 traits_t<T>::spec, traits_t<T>::spec, traits_t<ST>::spec, in __kmp_dist_for_static_init()
514 traits_t<ST>::spec, traits_t<T>::spec); in __kmp_dist_for_static_init()
529 // Some zero-trip loops maintained by compiler, e.g.: in __kmp_dist_for_static_init()
530 // for(i=10;i<0;++i) // lower >= upper - run-time check in __kmp_dist_for_static_init()
531 // for(i=0;i>10;--i) // lower <= upper - run-time check in __kmp_dist_for_static_init()
532 // for(i=0;i>10;++i) // incr > 0 - compile-time check in __kmp_dist_for_static_init()
533 // for(i=10;i<0;--i) // incr < 0 - compile-time check in __kmp_dist_for_static_init()
536 // for(i=10;i>0;i-=incr) // where incr<0 in __kmp_dist_for_static_init()
542 nth = th->th.th_team_nproc; in __kmp_dist_for_static_init()
543 team = th->th.th_team; in __kmp_dist_for_static_init()
544 KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct in __kmp_dist_for_static_init()
545 nteams = th->th.th_teams_size.nteams; in __kmp_dist_for_static_init()
546 team_id = team->t.t_master_tid; in __kmp_dist_for_static_init()
547 KMP_DEBUG_ASSERT(nteams == (kmp_uint32)team->t.t_parent->t.t_nproc); in __kmp_dist_for_static_init()
551 trip_count = *pupper - *plower + 1; in __kmp_dist_for_static_init()
552 } else if (incr == -1) { in __kmp_dist_for_static_init()
553 trip_count = *plower - *pupper + 1; in __kmp_dist_for_static_init()
555 // upper-lower can exceed the limit of signed type in __kmp_dist_for_static_init()
556 trip_count = (UT)(*pupper - *plower) / incr + 1; in __kmp_dist_for_static_init()
559 trip_count = (UT)(*plower - *pupper) / (-incr) + 1; in __kmp_dist_for_static_init()
562 *pstride = *pupper - *plower; // just in case (can be unused) in __kmp_dist_for_static_init()
577 *plastiter = (tid == 0 && team_id == trip_count - 1); in __kmp_dist_for_static_init()
586 *pupperDist = *plower + chunkD * incr - (team_id < extras ? 0 : incr); in __kmp_dist_for_static_init()
588 *plastiter = (team_id == nteams - 1); in __kmp_dist_for_static_init()
596 *pupperDist = *plower + chunk_inc_count - incr; in __kmp_dist_for_static_init()
602 *plastiter = *plower <= upper && *pupperDist > upper - incr; in __kmp_dist_for_static_init()
613 *plastiter = *plower >= upper && *pupperDist < upper - incr; in __kmp_dist_for_static_init()
625 trip_count = *pupperDist - *plower + 1; in __kmp_dist_for_static_init()
626 } else if (incr == -1) { in __kmp_dist_for_static_init()
627 trip_count = *plower - *pupperDist + 1; in __kmp_dist_for_static_init()
629 // upper-lower can exceed the limit of signed type in __kmp_dist_for_static_init()
630 trip_count = (UT)(*pupperDist - *plower) / incr + 1; in __kmp_dist_for_static_init()
633 trip_count = (UT)(*plower - *pupperDist) / (-incr) + 1; in __kmp_dist_for_static_init()
648 if (*plastiter != 0 && !(tid == trip_count - 1)) in __kmp_dist_for_static_init()
656 *pupper = *plower + chunkL * incr - (tid < extras ? 0 : incr); in __kmp_dist_for_static_init()
658 if (*plastiter != 0 && !(tid == nth - 1)) in __kmp_dist_for_static_init()
667 *pupper = *plower + chunk_inc_count - incr; in __kmp_dist_for_static_init()
673 !(*plower <= upper && *pupper > upper - incr)) in __kmp_dist_for_static_init()
682 !(*plower >= upper && *pupper < upper - incr)) in __kmp_dist_for_static_init()
698 *pupper = *plower + span - incr; in __kmp_dist_for_static_init()
701 if (*plastiter != 0 && !(tid == ((trip_count - 1) / (UT)chunk) % nth)) in __kmp_dist_for_static_init()
720 traits_t<T>::spec, traits_t<T>::spec, traits_t<T>::spec, in __kmp_dist_for_static_init()
721 traits_t<ST>::spec, traits_t<T>::spec); in __kmp_dist_for_static_init()
733 ompt_work_distribute, ompt_scope_begin, &(team_info->parallel_data), in __kmp_dist_for_static_init()
734 &(task_info->task_data), 0, codeptr); in __kmp_dist_for_static_init()
742 &(team_info->parallel_data), &(task_info->task_data), in __kmp_dist_for_static_init()
782 traits_t<T>::spec, traits_t<T>::spec, in __kmp_team_static_init()
783 traits_t<ST>::spec, traits_t<ST>::spec, in __kmp_team_static_init()
784 traits_t<T>::spec); in __kmp_team_static_init()
799 // Some zero-trip loops maintained by compiler, e.g.: in __kmp_team_static_init()
800 // for(i=10;i<0;++i) // lower >= upper - run-time check in __kmp_team_static_init()
801 // for(i=0;i>10;--i) // lower <= upper - run-time check in __kmp_team_static_init()
802 // for(i=0;i>10;++i) // incr > 0 - compile-time check in __kmp_team_static_init()
803 // for(i=10;i<0;--i) // incr < 0 - compile-time check in __kmp_team_static_init()
806 // for(i=10;i>0;i-=incr) // where incr<0 in __kmp_team_static_init()
811 team = th->th.th_team; in __kmp_team_static_init()
812 KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct in __kmp_team_static_init()
813 nteams = th->th.th_teams_size.nteams; in __kmp_team_static_init()
814 team_id = team->t.t_master_tid; in __kmp_team_static_init()
815 KMP_DEBUG_ASSERT(nteams == (kmp_uint32)team->t.t_parent->t.t_nproc); in __kmp_team_static_init()
819 trip_count = upper - lower + 1; in __kmp_team_static_init()
820 } else if (incr == -1) { in __kmp_team_static_init()
821 trip_count = lower - upper + 1; in __kmp_team_static_init()
823 // upper-lower can exceed the limit of signed type in __kmp_team_static_init()
824 trip_count = (UT)(upper - lower) / incr + 1; in __kmp_team_static_init()
827 trip_count = (UT)(lower - upper) / (-incr) + 1; in __kmp_team_static_init()
834 *p_ub = *p_lb + span - incr; in __kmp_team_static_init()
837 *p_last = (team_id == ((trip_count - 1) / (UT)chunk) % nteams); in __kmp_team_static_init()
858 traits_t<T>::spec, traits_t<T>::spec, in __kmp_team_static_init()
859 traits_t<ST>::spec, traits_t<ST>::spec); in __kmp_team_static_init()
866 //------------------------------------------------------------------------------
1035 //------------------------------------------------------------------------------