Skip to content

Commit

Permalink
[OPENMP, NVPTX] Sync threads before start ordered loops.
Browse files Browse the repository at this point in the history
Summary: Threads must be synchronized before starting ordered construct.

Reviewers: grokos

Subscribers: guansong, openmp-commits

Differential Revision: https://reviews.llvm.org/D48732

llvm-svn: 335987
  • Loading branch information
alexey-bataev committed Jun 29, 2018
1 parent 79917b9 commit 3994baf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion openmp/libomptarget/deviceRTLs/nvptx/src/loop.cu
Expand Up @@ -240,12 +240,17 @@ public:

// Process schedule.
if (tnum == 1 || tripCount <= 1 || OrderedSchedule(schedule)) {
if (OrderedSchedule(schedule)) {
if (isSPMDMode())
__syncthreads();
else
__kmpc_barrier(loc, threadId);
}
PRINT(LD_LOOP,
"go sequential as tnum=%ld, trip count %lld, ordered sched=%d\n",
(long)tnum, P64(tripCount), schedule);
schedule = kmp_sched_static_chunk;
chunk = tripCount; // one thread gets the whole loop

} else if (schedule == kmp_sched_runtime) {
// process runtime
omp_sched_t rtSched = currTaskDescr->GetRuntimeSched();
Expand Down

0 comments on commit 3994baf

Please sign in to comment.