diff --git a/openmp/libomptarget/deviceRTLs/common/src/data_sharing.cu b/openmp/libomptarget/deviceRTLs/common/src/data_sharing.cu --- a/openmp/libomptarget/deviceRTLs/common/src/data_sharing.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/data_sharing.cu @@ -66,7 +66,7 @@ EXTERN void *__kmpc_alloc_shared(size_t Bytes) { Bytes = Bytes + (Bytes % MinBytes); - if (IsMasterThread(isSPMDMode())) { + if (IsMasterThread(__kmpc_is_spmd_exec_mode())) { // Main thread alone, use shared memory if space is available. if (MainSharedStack.Usage[0] + Bytes <= MainSharedStack.MaxSize) { void *Ptr = &MainSharedStack.Data[MainSharedStack.Usage[0]]; diff --git a/openmp/libomptarget/deviceRTLs/common/src/libcall.cu b/openmp/libomptarget/deviceRTLs/common/src/libcall.cu --- a/openmp/libomptarget/deviceRTLs/common/src/libcall.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/libcall.cu @@ -29,7 +29,7 @@ EXTERN void omp_set_num_threads(int num) { // Ignore it for SPMD mode. - if (isSPMDMode()) + if (__kmpc_is_spmd_exec_mode()) return; ASSERT0(LT_FUSSY, isRuntimeInitialized(), "Expected initialized runtime."); PRINT(LD_IO, "call omp_set_num_threads(num %d)\n", num); @@ -41,7 +41,7 @@ } EXTERN int omp_get_num_threads(void) { - int rc = GetNumberOfOmpThreads(isSPMDMode()); + int rc = GetNumberOfOmpThreads(__kmpc_is_spmd_exec_mode()); PRINT(LD_IO, "call omp_get_num_threads() return %d\n", rc); return rc; } @@ -60,7 +60,7 @@ } EXTERN int omp_get_thread_limit(void) { - if (isSPMDMode()) + if (__kmpc_is_spmd_exec_mode()) return GetNumberOfThreadsInBlock(); int rc = threadLimit; PRINT(LD_IO, "call omp_get_thread_limit() return %d\n", rc); @@ -68,7 +68,7 @@ } EXTERN int omp_get_thread_num() { - bool isSPMDExecutionMode = isSPMDMode(); + bool isSPMDExecutionMode = __kmpc_is_spmd_exec_mode(); int tid = GetLogicalThreadIdInBlock(isSPMDExecutionMode); int rc = GetOmpThreadId(tid, isSPMDExecutionMode); PRINT(LD_IO, "call omp_get_thread_num() returns %d\n", rc); @@ -76,7 +76,7 @@ } EXTERN int omp_get_num_procs(void) { - int rc = GetNumberOfProcsInDevice(isSPMDMode()); + int rc = GetNumberOfProcsInDevice(__kmpc_is_spmd_exec_mode()); PRINT(LD_IO, "call omp_get_num_procs() returns %d\n", rc); return rc; } @@ -143,7 +143,7 @@ } EXTERN int omp_get_ancestor_thread_num(int level) { - if (isSPMDMode()) + if (__kmpc_is_spmd_exec_mode()) return level == 1 ? GetThreadIdInBlock() : 0; int rc = -1; // If level is 0 or all parallel regions are not active - return 0. @@ -197,7 +197,7 @@ } EXTERN int omp_get_team_size(int level) { - if (isSPMDMode()) + if (__kmpc_is_spmd_exec_mode()) return level == 1 ? GetNumberOfThreadsInBlock() : 1; int rc = -1; unsigned parLevel = parallelLevel[GetWarpId()]; @@ -217,13 +217,13 @@ EXTERN void omp_get_schedule(omp_sched_t *kind, int *modifier) { if (isRuntimeUninitialized()) { - ASSERT0(LT_FUSSY, isSPMDMode(), + ASSERT0(LT_FUSSY, __kmpc_is_spmd_exec_mode(), "Expected SPMD mode only with uninitialized runtime."); *kind = omp_sched_static; *modifier = 1; } else { omptarget_nvptx_TaskDescr *currTaskDescr = - getMyTopTaskDescriptor(isSPMDMode()); + getMyTopTaskDescriptor(__kmpc_is_spmd_exec_mode()); *kind = currTaskDescr->GetRuntimeSched(); *modifier = currTaskDescr->RuntimeChunkSize(); } @@ -235,13 +235,13 @@ PRINT(LD_IO, "call omp_set_schedule(sched %d, modif %d)\n", (int)kind, modifier); if (isRuntimeUninitialized()) { - ASSERT0(LT_FUSSY, isSPMDMode(), + ASSERT0(LT_FUSSY, __kmpc_is_spmd_exec_mode(), "Expected SPMD mode only with uninitialized runtime."); return; } if (kind >= omp_sched_static && kind < omp_sched_auto) { omptarget_nvptx_TaskDescr *currTaskDescr = - getMyTopTaskDescriptor(isSPMDMode()); + getMyTopTaskDescriptor(__kmpc_is_spmd_exec_mode()); currTaskDescr->SetRuntimeSched(kind); currTaskDescr->RuntimeChunkSize() = modifier; PRINT(LD_IOD, "omp_set_schedule did set sched %d & modif %" PRIu64 "\n", diff --git a/openmp/libomptarget/deviceRTLs/common/src/loop.cu b/openmp/libomptarget/deviceRTLs/common/src/loop.cu --- a/openmp/libomptarget/deviceRTLs/common/src/loop.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/loop.cu @@ -508,7 +508,7 @@ PRINT(LD_LOOP, "Got sched: active %d, total %d: lb %lld, ub %lld, stride = %lld, " "last %d\n", - (int)GetNumberOfOmpThreads(isSPMDMode()), + (int)GetNumberOfOmpThreads(__kmpc_is_spmd_exec_mode()), (int)GetNumberOfWorkersInTeam(), (long long)*plower, (long long)*pupper, (long long)*pstride, (int)*plast); return DISPATCH_NOTFINISHED; diff --git a/openmp/libomptarget/deviceRTLs/common/src/omptarget.cu b/openmp/libomptarget/deviceRTLs/common/src/omptarget.cu --- a/openmp/libomptarget/deviceRTLs/common/src/omptarget.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/omptarget.cu @@ -65,7 +65,7 @@ nThreads = GetNumberOfThreadsInBlock(); threadLimit = ThreadLimit; - if (!isSPMDMode()) + if (!__kmpc_is_spmd_exec_mode()) omptarget_nvptx_globalArgs.Init(); __kmpc_data_sharing_init_stack(); @@ -162,8 +162,7 @@ // Return true if the current target region is executed in SPMD mode. EXTERN int8_t __kmpc_is_spmd_exec_mode() { - PRINT0(LD_IO | LD_PAR, "call to __kmpc_is_spmd_exec_mode\n"); - return isSPMDMode(); + return (execution_param & ModeMask) == Spmd; } #pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/common/src/support.cu b/openmp/libomptarget/deviceRTLs/common/src/support.cu --- a/openmp/libomptarget/deviceRTLs/common/src/support.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/support.cu @@ -26,8 +26,6 @@ bool isGenericMode() { return (execution_param & ModeMask) == Generic; } -bool isSPMDMode() { return (execution_param & ModeMask) == Spmd; } - bool isRuntimeUninitialized() { return (execution_param & RuntimeMask) == RuntimeUninitialized; } @@ -42,7 +40,7 @@ bool checkSPMDMode(kmp_Ident *loc) { if (!loc) - return isSPMDMode(); + return __kmpc_is_spmd_exec_mode(); // If SPMD is true then we are not in the UNDEFINED state so // we can return immediately. @@ -55,7 +53,7 @@ return false; // We are in underfined state. - return isSPMDMode(); + return __kmpc_is_spmd_exec_mode(); } bool checkGenericMode(kmp_Ident *loc) { return !checkSPMDMode(loc); } diff --git a/openmp/libomptarget/deviceRTLs/common/support.h b/openmp/libomptarget/deviceRTLs/common/support.h --- a/openmp/libomptarget/deviceRTLs/common/support.h +++ b/openmp/libomptarget/deviceRTLs/common/support.h @@ -33,7 +33,6 @@ void setExecutionParameters(ExecutionMode EMode, RuntimeMode RMode); bool isGenericMode(); -bool isSPMDMode(); bool isRuntimeUninitialized(); bool isRuntimeInitialized();