Lines Matching defs:bounds

73 // "bounds" array has to be allocated per thread.
78 /*in/out*/ bounds_infoXX_template<T> *bounds) {
81 if (bounds->step == 0) {
87 if (bounds->comparison == comparison_t::comp_not_eq) {
89 if (bounds->step > 0) {
90 bounds->comparison = comparison_t::comp_less;
92 bounds->comparison = comparison_t::comp_greater;
96 if (bounds->comparison == comparison_t::comp_less) {
100 bounds->ub0 -= 1;
101 bounds->comparison = comparison_t::comp_less_or_eq;
102 } else if (bounds->comparison == comparison_t::comp_greater) {
103 bounds->ub0 += 1;
104 bounds->comparison = comparison_t::comp_greater_or_eq;
114 auto bounds = &(original_bounds_nest[ind]);
116 switch (bounds->loop_type) {
120 /*in/out*/ (bounds_infoXX_template<kmp_int32> *)(bounds));
125 /*in/out*/ (bounds_infoXX_template<kmp_uint32> *)(bounds));
130 /*in/out*/ (bounds_infoXX_template<kmp_int64> *)(bounds));
135 /*in/out*/ (bounds_infoXX_template<kmp_uint64> *)(bounds));
154 /*in/out*/ bounds_infoXX_template<T> *bounds) {
156 if (bounds->comparison == comparison_t::comp_less_or_eq) {
157 if (bounds->ub0 < bounds->lb0) {
160 bounds->trip_count = 0;
164 bounds->trip_count =
165 static_cast<kmp_loop_nest_iv_t>(bounds->ub0 - bounds->lb0) /
166 __kmp_abs(bounds->step) +
169 } else if (bounds->comparison == comparison_t::comp_greater_or_eq) {
170 if (bounds->lb0 < bounds->ub0) {
173 bounds->trip_count = 0;
177 bounds->trip_count =
178 static_cast<kmp_loop_nest_iv_t>(bounds->lb0 - bounds->ub0) /
179 __kmp_abs(bounds->step) +
185 return bounds->trip_count;
189 kmp_loop_nest_iv_t kmp_calculate_trip_count(/*in/out*/ bounds_info_t *bounds) {
193 switch (bounds->loop_type) {
196 /*in/out*/ (bounds_infoXX_template<kmp_int32> *)(bounds));
200 /*in/out*/ (bounds_infoXX_template<kmp_uint32> *)(bounds));
204 /*in/out*/ (bounds_infoXX_template<kmp_int64> *)(bounds));
208 /*in/out*/ (bounds_infoXX_template<kmp_uint64> *)(bounds));
305 // Return true if the point fits into upper bounds on this level,
308 bool kmp_iv_is_in_upper_bound_XX(const bounds_infoXX_template<T> *bounds,
313 T outer_iv = static_cast<T>(original_ivs[bounds->outer_iv]);
315 if (((bounds->comparison == comparison_t::comp_less_or_eq) &&
316 (iv > (bounds->ub0 + bounds->ub1 * outer_iv))) ||
317 ((bounds->comparison == comparison_t::comp_greater_or_eq) &&
318 (iv < (bounds->ub0 + bounds->ub1 * outer_iv)))) {
327 // Return true if it fits into lower-upper bounds on this level
330 bool kmp_calc_one_iv_XX(const bounds_infoXX_template<T> *bounds,
336 T outer_iv = static_cast<T>(original_ivs[bounds->outer_iv]);
341 temp = bounds->lb0 + bounds->lb1 * outer_iv;
344 temp = bounds->lb0 + bounds->lb1 * outer_iv + iteration * bounds->step;
348 original_ivs[ind] = kmp_fix_iv(bounds->loop_iv_type, temp);
351 return kmp_iv_is_in_upper_bound_XX(bounds, original_ivs, ind);
357 bool kmp_calc_one_iv(const bounds_info_t *bounds,
362 switch (bounds->loop_type) {
365 (bounds_infoXX_template<kmp_int32> *)(bounds),
371 (bounds_infoXX_template<kmp_uint32> *)(bounds),
377 (bounds_infoXX_template<kmp_int64> *)(bounds),
383 (bounds_infoXX_template<kmp_uint64> *)(bounds),
396 // Return true if it fits into lower-upper bounds on this level
399 void kmp_calc_one_iv_rectang_XX(const bounds_infoXX_template<T> *bounds,
407 bounds->lb0 +
408 bounds->lb1 * static_cast<T>(original_ivs[bounds->outer_iv]) +
409 iteration * bounds->step;
412 original_ivs[ind] = kmp_fix_iv(bounds->loop_iv_type, temp);
415 void kmp_calc_one_iv_rectang(const bounds_info_t *bounds,
420 switch (bounds->loop_type) {
423 (bounds_infoXX_template<kmp_int32> *)(bounds),
428 (bounds_infoXX_template<kmp_uint32> *)(bounds),
433 (bounds_infoXX_template<kmp_int64> *)(bounds),
438 (bounds_infoXX_template<kmp_uint64> *)(bounds),
456 // canonical form there will be no changes to bounds in bounds_nest array
469 auto bounds = &(original_bounds_nest[ind]);
471 kmp_loop_nest_iv_t trip_count = kmp_calculate_trip_count(/*in/out*/ bounds);
498 auto bounds = &(original_bounds_nest[ind]);
501 auto temp = new_iv / bounds->trip_count;
502 auto iteration = new_iv % bounds->trip_count;
510 auto bounds = &(original_bounds_nest[ind]);
512 kmp_calc_one_iv_rectang(bounds, /*in/out*/ original_ivs, iterations, ind);
529 /* in/out*/ bounds_info_internalXX_template<T> *bounds,
538 auto &bbounds = bounds->b;
556 bounds->span_smallest = bound_candidate1;
558 bounds->span_smallest = bound_candidate2;
571 bounds->span_biggest = bound_candidate2;
573 bounds->span_biggest = bound_candidate1;
578 bounds->span_smallest = bbounds.lb0;
579 bounds->span_biggest = bbounds.ub0;
581 if (!bounds->loop_bounds_adjusted) {
585 bounds->span_biggest -=
593 /* in/out*/ bounds_info_internalXX_template<T> *bounds,
602 auto &bbounds = bounds->b;
620 bounds->span_smallest = bound_candidate1;
622 bounds->span_smallest = bound_candidate2;
635 bounds->span_biggest = bound_candidate2;
637 bounds->span_biggest = bound_candidate1;
643 bounds->span_biggest = bbounds.lb0;
644 bounds->span_smallest = bbounds.ub0;
646 if (!bounds->loop_bounds_adjusted) {
650 bounds->span_biggest -=
658 /* in/out*/ bounds_info_internalXX_template<T> *bounds,
661 if (bounds->b.comparison == comparison_t::comp_less_or_eq) {
662 kmp_calc_span_lessoreq_XX(/* in/out*/ bounds, /* in/out*/ bounds_nest);
664 KMP_ASSERT(bounds->b.comparison == comparison_t::comp_greater_or_eq);
665 kmp_calc_span_greateroreq_XX(/* in/out*/ bounds, /* in/out*/ bounds_nest);
671 // Calculate new bounds for this loop level.
674 // overflow, for that we'll adjust both upper and lower bounds as needed.
677 /* in/out*/ bounds_info_internalXX_template<T> *bounds,
680 auto &bbounds = bounds->b;
684 bounds->loop_bounds_adjusted = false;
686 bounds->loop_bounds_adjusted = true;
696 // get upper and lower bounds to be parallel
768 /* in/out*/ bounds_info_internalXX_template<T> *bounds,
771 kmp_calc_new_bounds_XX(/* in/out*/ bounds, /* in/out*/ bounds_nest);
772 kmp_calc_span_XX(/* in/out*/ bounds, /* in/out*/ bounds_nest);
773 return kmp_calculate_trip_count_XX(/*in/out*/ &(bounds->b));
787 auto bounds = &(bounds_nest[ind]);
790 switch (bounds->b.loop_type) {
793 /*in/out*/ (bounds_info_internalXX_template<kmp_int32> *)(bounds),
798 /*in/out*/ (bounds_info_internalXX_template<kmp_uint32> *)(bounds),
803 /*in/out*/ (bounds_info_internalXX_template<kmp_int64> *)(bounds),
808 /*in/out*/ (bounds_info_internalXX_template<kmp_uint64> *)(bounds),
827 kmp_calc_number_of_iterations_XX(const bounds_infoXX_template<T> *bounds,
833 if (bounds->comparison == comparison_t::comp_less_or_eq) {
835 (static_cast<T>(original_ivs[ind]) - bounds->lb0 -
836 bounds->lb1 * static_cast<T>(original_ivs[bounds->outer_iv])) /
837 __kmp_abs(bounds->step);
839 KMP_DEBUG_ASSERT(bounds->comparison == comparison_t::comp_greater_or_eq);
840 iterations = (bounds->lb0 +
841 bounds->lb1 * static_cast<T>(original_ivs[bounds->outer_iv]) -
843 __kmp_abs(bounds->step);
851 kmp_loop_nest_iv_t kmp_calc_number_of_iterations(const bounds_info_t *bounds,
855 switch (bounds->loop_type) {
858 (bounds_infoXX_template<kmp_int32> *)(bounds), original_ivs, ind);
862 (bounds_infoXX_template<kmp_uint32> *)(bounds), original_ivs, ind);
866 (bounds_infoXX_template<kmp_int64> *)(bounds), original_ivs, ind);
870 (bounds_infoXX_template<kmp_uint64> *)(bounds), original_ivs, ind);
881 // Take updated bounds and calculate what new_iv will correspond to this point.
883 // original loops bounds. Getting new_iv for the adjusted original IVs will help
893 auto bounds = &(bounds_nest[ind].b);
895 new_iv = new_iv * bounds->trip_count +
896 kmp_calc_number_of_iterations(bounds, original_ivs, ind);
915 auto bounds = &(original_bounds_nest[ind]);
916 bool good = kmp_calc_one_iv(bounds, /*in/out*/ original_ivs, iterations,
944 // Note: lower bounds of all loops may not work -
968 // Return false if there is no next point in the loop bounds.
976 auto bounds = &(original_bounds_nest[ind]);
977 iterations[ind] = kmp_calc_number_of_iterations(bounds, original_ivs, ind);
1003 const bounds_infoXX_template<T> *bounds,
1015 T outer_iv = static_cast<T>(original_ivs[bounds->outer_iv]);
1020 temp = bounds->lb0 + bounds->lb1 * outer_iv;
1032 auto step = bounds->step;
1036 ((bounds->lb0 + bounds->lb1 * outer_iv) -
1043 if (((bounds->comparison == comparison_t::comp_less_or_eq) &&
1044 (temp < (bounds->lb0 + bounds->lb1 * outer_iv))) ||
1045 ((bounds->comparison == comparison_t::comp_greater_or_eq) &&
1046 (temp > (bounds->lb0 + bounds->lb1 * outer_iv)))) {
1049 temp = bounds->lb0 + bounds->lb1 * outer_iv + iteration / 2 * step;
1056 temp = kmp_fix_iv(bounds->loop_iv_type, temp);
1060 if (((bounds->comparison == comparison_t::comp_less_or_eq) &&
1062 ((bounds->comparison == comparison_t::comp_greater_or_eq) &&
1071 original_ivs[ind] = temp = kmp_fix_iv(bounds->loop_iv_type, temp);
1073 if (((bounds->comparison == comparison_t::comp_less_or_eq) &&
1074 (temp > (bounds->ub0 + bounds->ub1 * outer_iv))) ||
1075 ((bounds->comparison == comparison_t::comp_greater_or_eq) &&
1076 (temp < (bounds->ub0 + bounds->ub1 * outer_iv)))) {
1086 bool kmp_calc_one_iv_for_chunk_end(const bounds_info_t *bounds,
1094 switch (bounds->loop_type) {
1097 (bounds_infoXX_template<kmp_int32> *)(bounds),
1105 (bounds_infoXX_template<kmp_uint32> *)(bounds),
1113 (bounds_infoXX_template<kmp_int64> *)(bounds),
1121 (bounds_infoXX_template<kmp_uint64> *)(bounds),
1136 // esp. on the lower bounds side. When getting result need to make sure that the
1144 // original upper bounds as the end of the chunk. Chunk won't be empty, because
1174 auto bounds = &(original_bounds_nest[ind]);
1178 bounds, updated_bounds,
1205 (kmp_ivs_eq(bounds->loop_iv_type, original_ivs[ind],
1209 !(kmp_ivs_eq(bounds->loop_iv_type, original_ivs[ind],
1219 //----------Calculate upper bounds for the last chunk-------------------------
1223 void kmp_calc_one_iv_end_XX(const bounds_infoXX_template<T> *bounds,
1227 T temp = bounds->ub0 +
1228 bounds->ub1 * static_cast<T>(original_ivs[bounds->outer_iv]);
1230 original_ivs[ind] = kmp_fix_iv(bounds->loop_iv_type, temp);
1233 void kmp_calc_one_iv_end(const bounds_info_t *bounds,
1236 switch (bounds->loop_type) {
1242 (bounds_infoXX_template<kmp_int32> *)(bounds),
1247 (bounds_infoXX_template<kmp_uint32> *)(bounds),
1252 (bounds_infoXX_template<kmp_int64> *)(bounds),
1257 (bounds_infoXX_template<kmp_uint64> *)(bounds),
1263 // Calculate upper bounds for the last loop iteration. Just use original upper
1264 // bounds (adjusted when canonicalized to use <= / >=). No need to check that
1270 auto bounds = &(original_bounds_nest[ind]);
1271 kmp_calc_one_iv_end(bounds, /*in/out*/ original_ivs, ind);
1281 // canonical form there will be no changes to bounds in bounds_nest array
1283 // to parallelogram/parallelepiped, calculate total, calculate bounds for the
1285 // important on the left side, to hit the lower bounds and not step over), and
1407 // We could not find the ending point, use the original upper bounds:
1442 // Fill in chunk bounds: