[OpenMP][libomptarget] Flush intermediate values during team reduction
authorGheorghe-Teodor Bercea <gheorghe-teod.bercea@ibm.com>
Mon, 3 Dec 2018 15:21:49 +0000 (15:21 +0000)
committerGheorghe-Teodor Bercea <gheorghe-teod.bercea@ibm.com>
Mon, 3 Dec 2018 15:21:49 +0000 (15:21 +0000)
Summary: Ensure intermediate values of a team reduction are flushed to memory.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: guansong, jfb, openmp-commits

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

llvm-svn: 348148

openmp/libomptarget/deviceRTLs/nvptx/src/reduction.cu

index bbe4ad1..a9e35a1 100644 (file)
@@ -444,6 +444,7 @@ EXTERN int32_t __kmpc_nvptx_teams_reduce_nowait_simple(kmp_Ident *loc,
 EXTERN void
 __kmpc_nvptx_teams_end_reduce_nowait_simple(kmp_Ident *loc, int32_t global_tid,
                                             kmp_CriticalName *crit) {
+  __threadfence_system();
   (void)atomicExch((uint32_t *)crit, 0);
 }