[Openmp-commits] [PATCH] D54967: [OPENMP][NVPTX]Basic support for reductions across the teams.
Alexey Bataev via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Tue Nov 27 13:09:56 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL347710: [OPENMP][NVPTX]Basic support for reductions across the teams. (authored by ABataev, committed by ).
Herald added a subscriber: llvm-commits.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54967/new/
https://reviews.llvm.org/D54967
Files:
openmp/trunk/libomptarget/deviceRTLs/nvptx/src/interface.h
openmp/trunk/libomptarget/deviceRTLs/nvptx/src/reduction.cu
Index: openmp/trunk/libomptarget/deviceRTLs/nvptx/src/interface.h
===================================================================
--- openmp/trunk/libomptarget/deviceRTLs/nvptx/src/interface.h
+++ openmp/trunk/libomptarget/deviceRTLs/nvptx/src/interface.h
@@ -419,6 +419,12 @@
int32_t global_tid, int32_t num_vars, size_t reduce_size, void *reduce_data,
kmp_ShuffleReductFctPtr shflFct, kmp_InterWarpCopyFctPtr cpyFct,
kmp_CopyToScratchpadFctPtr sratchFct, kmp_LoadReduceFctPtr ldFct);
+EXTERN int32_t __kmpc_nvptx_teams_reduce_nowait_simple(kmp_Ident *loc,
+ int32_t global_tid,
+ kmp_CriticalName *crit);
+EXTERN void __kmpc_nvptx_teams_end_reduce_nowait_simple(kmp_Ident *loc,
+ int32_t global_tid,
+ kmp_CriticalName *crit);
EXTERN int32_t __kmpc_shuffle_int32(int32_t val, int16_t delta, int16_t size);
EXTERN int64_t __kmpc_shuffle_int64(int64_t val, int16_t delta, int16_t size);
Index: openmp/trunk/libomptarget/deviceRTLs/nvptx/src/reduction.cu
===================================================================
--- openmp/trunk/libomptarget/deviceRTLs/nvptx/src/reduction.cu
+++ openmp/trunk/libomptarget/deviceRTLs/nvptx/src/reduction.cu
@@ -430,3 +430,21 @@
/*isSPMDExecutionMode=*/false,
/*isRuntimeUninitialized=*/true);
}
+
+EXTERN int32_t __kmpc_nvptx_teams_reduce_nowait_simple(kmp_Ident *loc,
+ int32_t global_tid,
+ kmp_CriticalName *crit) {
+ if (checkSPMDMode(loc) && GetThreadIdInBlock() != 0)
+ return 0;
+ // The master thread of the team actually does the reduction.
+ while (atomicCAS((uint32_t *)crit, 0, 1))
+ ;
+ return 1;
+}
+
+EXTERN void
+__kmpc_nvptx_teams_end_reduce_nowait_simple(kmp_Ident *loc, int32_t global_tid,
+ kmp_CriticalName *crit) {
+ (void)atomicExch((uint32_t *)crit, 0);
+}
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54967.175568.patch
Type: text/x-patch
Size: 2202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20181127/34a97541/attachment.bin>
More information about the Openmp-commits
mailing list