[Openmp-commits] [PATCH] D24486: [OpenMP] Stride in distribute parallel for loops with no chunk size

George Rokos via Openmp-commits openmp-commits at lists.llvm.org
Mon Sep 12 17:42:18 PDT 2016


grokos created this revision.
grokos added reviewers: tlwilmar, jlpeyton, hbae, AndreyChurbanov.
grokos added a subscriber: openmp-commits.
grokos set the repository for this revision to rL LLVM.

When we have a `distribute parallel for` the compiler calls `__kmpc_for_static_init_*` which in turn calls `__kmp_for_static_init`. In the latter function, when no chunk size is specified in the `dist_schedule` clause, the code does not set `pstride` correctly; `*pstride` is left to be equal to 1. Whereas this is OK for plain `parallel` for-loops with no chunk size, it is obviously wrong for `distribute parallel` for-loops and causes chunks of the distributed loop to be distributed multiple times to multiple teams. The fix is to set `*pstride` to some value at least as large as the loop trip count.

Repository:
  rL LLVM

https://reviews.llvm.org/D24486

Files:
  kmp_sched.cpp

Index: kmp_sched.cpp
===================================================================
--- kmp_sched.cpp
+++ kmp_sched.cpp
@@ -308,6 +308,7 @@
                     }
                 }
             }
+            *pstride = trip_count;
             break;
         }
     case kmp_sch_static_chunked:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24486.71072.patch
Type: text/x-patch
Size: 303 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160913/e1d8298b/attachment.bin>


More information about the Openmp-commits mailing list