aboutsummaryrefslogtreecommitdiff
path: root/libomptarget/deviceRTLs/nvptx/src/libcall.cu
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2019-04-15 20:15:20 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2019-04-15 20:15:20 +0000
commit6c198765a02de84ab1655caf083539bcb288c66d (patch)
tree9b616ba9c29bbdf20e8745a5bbf099ae5611cc0c /libomptarget/deviceRTLs/nvptx/src/libcall.cu
parentc1629ee2315dc59c5a56acd1588f362ba5fe43ec (diff)
[OPENMP][NVPTX]Fix dynamic scheduling in L2+ SPMD parallel regions.
Summary: If the kernel is executed in SPMD mode and the L2+ parallel for region with the dynamic scheduling is executed, dynamic scheduling functions are called. They expect full runtime support, but SPMD kernels may be executed without the full runtime. It leads to the runtime crash of the compiled program. Patch fixes this problem + fixes handling of the parallelism level in SPMD mode, which is required as part of this patch. Reviewers: gtbercea, kkwli0, grokos Subscribers: guansong, jdoerfert, openmp-commits, caomhin Tags: #openmp Differential Revision: https://reviews.llvm.org/D60578 git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@358442 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'libomptarget/deviceRTLs/nvptx/src/libcall.cu')
-rw-r--r--libomptarget/deviceRTLs/nvptx/src/libcall.cu3
1 files changed, 2 insertions, 1 deletions
diff --git a/libomptarget/deviceRTLs/nvptx/src/libcall.cu b/libomptarget/deviceRTLs/nvptx/src/libcall.cu
index bf33c2a..9bc3f2c 100644
--- a/libomptarget/deviceRTLs/nvptx/src/libcall.cu
+++ b/libomptarget/deviceRTLs/nvptx/src/libcall.cu
@@ -164,7 +164,8 @@ EXTERN int omp_get_level(void) {
if (isRuntimeUninitialized()) {
ASSERT0(LT_FUSSY, isSPMDMode(),
"Expected SPMD mode only with uninitialized runtime.");
- return parallelLevel;
+ // parallelLevel starts from 0, need to add 1 for correct level.
+ return parallelLevel + 1;
}
int level = 0;
omptarget_nvptx_TaskDescr *currTaskDescr =