[Openmp-commits] [openmp] r271320 - Addition of OpenMP 4.5 feature: schedule(simd:static)
Jonathan Peyton via Openmp-commits
openmp-commits at lists.llvm.org
Tue May 31 12:12:19 PDT 2016
Author: jlpeyton
Date: Tue May 31 14:12:18 2016
New Revision: 271320
URL: http://llvm.org/viewvc/llvm-project?rev=271320&view=rev
Log:
Addition of OpenMP 4.5 feature: schedule(simd:static)
This patch implements the new kmp_sch_static_balanced_chunked schedule kind that
the compiler will generate when it encounters schedule(simd: static). It just
adds the new constant and the new switch case __kmp_for_static_init.
Patch by Alex Duran.
Differential Revision: http://reviews.llvm.org/D20699
Modified:
openmp/trunk/runtime/src/kmp.h
openmp/trunk/runtime/src/kmp_sched.cpp
Modified: openmp/trunk/runtime/src/kmp.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp.h?rev=271320&r1=271319&r2=271320&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp.h (original)
+++ openmp/trunk/runtime/src/kmp.h Tue May 31 14:12:18 2016
@@ -313,8 +313,12 @@ enum sched_type {
kmp_sch_static_steal = 44, /**< accessible only through KMP_SCHEDULE environment variable */
+#if OMP_41_ENABLED
+ kmp_sch_static_balanced_chunked = 45, /**< static with chunk adjustment (e.g., simd) */
+#endif
+
/* accessible only through KMP_SCHEDULE environment variable */
- kmp_sch_upper = 45, /**< upper bound for unordered values */
+ kmp_sch_upper = 46, /**< upper bound for unordered values */
kmp_ord_lower = 64, /**< lower bound for ordered values, must be power of 2 */
kmp_ord_static_chunked = 65,
Modified: openmp/trunk/runtime/src/kmp_sched.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_sched.cpp?rev=271320&r1=271319&r2=271320&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_sched.cpp (original)
+++ openmp/trunk/runtime/src/kmp_sched.cpp Tue May 31 14:12:18 2016
@@ -324,6 +324,29 @@ __kmp_for_static_init(
*plastiter = (tid == ((trip_count - 1)/( UT )chunk) % nth);
break;
}
+#if OMP_41_ENABLED
+ case kmp_sch_static_balanced_chunked:
+ {
+ register T old_upper = *pupper;
+ // round up to make sure the chunk is enough to cover all iterations
+ register UT span = (trip_count+nth-1) / nth;
+
+ // perform chunk adjustment
+ chunk = (span + chunk - 1) & ~(chunk-1);
+
+ span = chunk * incr;
+ *plower = *plower + (span * tid);
+ *pupper = *plower + span - incr;
+ if ( incr > 0 ) {
+ if ( *pupper > old_upper ) *pupper = old_upper;
+ } else
+ if ( *pupper < old_upper ) *pupper = old_upper;
+
+ if( plastiter != NULL )
+ *plastiter = ( tid == ((trip_count - 1)/( UT )chunk) );
+ break;
+ }
+#endif
default:
KMP_ASSERT2( 0, "__kmpc_for_static_init: unknown scheduling type" );
break;
More information about the Openmp-commits
mailing list