[Openmp-commits] [PATCH] D20699: Addition of schedule(simd:static)

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Tue May 31 12:18:47 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL271320: Addition of OpenMP 4.5 feature: schedule(simd:static) (authored by jlpeyton).

Changed prior to commit:
  http://reviews.llvm.org/D20699?vs=58674&id=59112#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20699

Files:
  openmp/trunk/runtime/src/kmp.h
  openmp/trunk/runtime/src/kmp_sched.cpp

Index: openmp/trunk/runtime/src/kmp_sched.cpp
===================================================================
--- openmp/trunk/runtime/src/kmp_sched.cpp
+++ openmp/trunk/runtime/src/kmp_sched.cpp
@@ -324,6 +324,29 @@
                 *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;
Index: openmp/trunk/runtime/src/kmp.h
===================================================================
--- openmp/trunk/runtime/src/kmp.h
+++ openmp/trunk/runtime/src/kmp.h
@@ -313,8 +313,12 @@
 
     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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20699.59112.patch
Type: text/x-patch
Size: 2089 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160531/886f56bf/attachment.bin>


More information about the Openmp-commits mailing list