Changeset View
Changeset View
Standalone View
Standalone View
libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.cu
Show All 39 Lines | |||||
EXTERN void __kmpc_kernel_init(int ThreadLimit, int16_t RequiresOMPRuntime) { | EXTERN void __kmpc_kernel_init(int ThreadLimit, int16_t RequiresOMPRuntime) { | ||||
PRINT(LD_IO, "call to __kmpc_kernel_init with version %f\n", | PRINT(LD_IO, "call to __kmpc_kernel_init with version %f\n", | ||||
OMPTARGET_NVPTX_VERSION); | OMPTARGET_NVPTX_VERSION); | ||||
ASSERT0(LT_FUSSY, RequiresOMPRuntime, | ASSERT0(LT_FUSSY, RequiresOMPRuntime, | ||||
"Generic always requires initialized runtime."); | "Generic always requires initialized runtime."); | ||||
setExecutionParameters(Generic, RuntimeInitialized); | setExecutionParameters(Generic, RuntimeInitialized); | ||||
for (int I = 0; I < MAX_THREADS_PER_TEAM / WARPSIZE; ++I) | for (int I = 0; I < MAX_THREADS_PER_TEAM / WARPSIZE; ++I) | ||||
parallelLevel[I] = 0; | setParallelLevel(I, 0); | ||||
int threadIdInBlock = GetThreadIdInBlock(); | int threadIdInBlock = GetThreadIdInBlock(); | ||||
ASSERT0(LT_FUSSY, threadIdInBlock == GetMasterThreadID(), | ASSERT0(LT_FUSSY, threadIdInBlock == GetMasterThreadID(), | ||||
"__kmpc_kernel_init() must be called by team master warp only!"); | "__kmpc_kernel_init() must be called by team master warp only!"); | ||||
PRINT0(LD_IO, "call to __kmpc_kernel_init for master\n"); | PRINT0(LD_IO, "call to __kmpc_kernel_init for master\n"); | ||||
// Get a state object from the queue. | // Get a state object from the queue. | ||||
int slot = smid() % MAX_SM; | int slot = smid() % MAX_SM; | ||||
Show All 37 Lines | EXTERN void __kmpc_spmd_kernel_init(int ThreadLimit, int16_t RequiresOMPRuntime, | ||||
int16_t RequiresDataSharing) { | int16_t RequiresDataSharing) { | ||||
PRINT0(LD_IO, "call to __kmpc_spmd_kernel_init\n"); | PRINT0(LD_IO, "call to __kmpc_spmd_kernel_init\n"); | ||||
setExecutionParameters(Spmd, RequiresOMPRuntime ? RuntimeInitialized | setExecutionParameters(Spmd, RequiresOMPRuntime ? RuntimeInitialized | ||||
: RuntimeUninitialized); | : RuntimeUninitialized); | ||||
int threadId = GetThreadIdInBlock(); | int threadId = GetThreadIdInBlock(); | ||||
if (threadId == 0) { | if (threadId == 0) { | ||||
usedSlotIdx = smid() % MAX_SM; | usedSlotIdx = smid() % MAX_SM; | ||||
parallelLevel[0] = | setParallelLevel( | ||||
1 + (GetNumberOfThreadsInBlock() > 1 ? OMP_ACTIVE_PARALLEL_LEVEL : 0); | 0, | ||||
1 + (GetNumberOfThreadsInBlock() > 1 ? OMP_ACTIVE_PARALLEL_LEVEL : 0)); | |||||
} else if (GetLaneId() == 0) { | } else if (GetLaneId() == 0) { | ||||
parallelLevel[GetWarpId()] = | setParallelLevel( | ||||
1 + (GetNumberOfThreadsInBlock() > 1 ? OMP_ACTIVE_PARALLEL_LEVEL : 0); | GetWarpId(), | ||||
1 + (GetNumberOfThreadsInBlock() > 1 ? OMP_ACTIVE_PARALLEL_LEVEL : 0)); | |||||
} | } | ||||
if (!RequiresOMPRuntime) { | if (!RequiresOMPRuntime) { | ||||
// Runtime is not required - exit. | // Runtime is not required - exit. | ||||
__kmpc_impl_syncthreads(); | __kmpc_impl_syncthreads(); | ||||
return; | return; | ||||
} | } | ||||
// | // | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |