Changeset View
Changeset View
Standalone View
Standalone View
openmp/libomptarget/DeviceRTL/src/Reduction.cpp
Show First 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | |||||
static volatile uint32_t Cnt = 0; | static volatile uint32_t Cnt = 0; | ||||
} // namespace | } // namespace | ||||
extern "C" { | extern "C" { | ||||
int32_t __kmpc_nvptx_parallel_reduce_nowait_v2( | int32_t __kmpc_nvptx_parallel_reduce_nowait_v2( | ||||
IdentTy *Loc, int32_t TId, int32_t num_vars, uint64_t reduce_size, | IdentTy *Loc, int32_t TId, int32_t num_vars, uint64_t reduce_size, | ||||
void *reduce_data, ShuffleReductFnTy shflFct, InterWarpCopyFnTy cpyFct) { | void *reduce_data, ShuffleReductFnTy shflFct, InterWarpCopyFnTy cpyFct) { | ||||
FunctionTracingRAII(); | |||||
return nvptx_parallel_reduce_nowait(TId, num_vars, reduce_size, reduce_data, | return nvptx_parallel_reduce_nowait(TId, num_vars, reduce_size, reduce_data, | ||||
shflFct, cpyFct, mapping::isSPMDMode(), | shflFct, cpyFct, mapping::isSPMDMode(), | ||||
false); | false); | ||||
} | } | ||||
int32_t __kmpc_nvptx_teams_reduce_nowait_v2( | int32_t __kmpc_nvptx_teams_reduce_nowait_v2( | ||||
IdentTy *Loc, int32_t TId, void *GlobalBuffer, uint32_t num_of_records, | IdentTy *Loc, int32_t TId, void *GlobalBuffer, uint32_t num_of_records, | ||||
void *reduce_data, ShuffleReductFnTy shflFct, InterWarpCopyFnTy cpyFct, | void *reduce_data, ShuffleReductFnTy shflFct, InterWarpCopyFnTy cpyFct, | ||||
ListGlobalFnTy lgcpyFct, ListGlobalFnTy lgredFct, ListGlobalFnTy glcpyFct, | ListGlobalFnTy lgcpyFct, ListGlobalFnTy lgredFct, ListGlobalFnTy glcpyFct, | ||||
ListGlobalFnTy glredFct) { | ListGlobalFnTy glredFct) { | ||||
FunctionTracingRAII(); | |||||
// Terminate all threads in non-SPMD mode except for the master thread. | // Terminate all threads in non-SPMD mode except for the master thread. | ||||
uint32_t ThreadId = mapping::getThreadIdInBlock(); | uint32_t ThreadId = mapping::getThreadIdInBlock(); | ||||
if (mapping::isGenericMode()) { | if (mapping::isGenericMode()) { | ||||
if (!mapping::isMainThreadInGenericMode()) | if (!mapping::isMainThreadInGenericMode()) | ||||
return 0; | return 0; | ||||
ThreadId = 0; | ThreadId = 0; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | if (IsMaster && ChunkTeamCount == num_of_records - 1) { | ||||
// intermediate results to the global buffer. | // intermediate results to the global buffer. | ||||
atomic::add((uint32_t *)&IterCnt, uint32_t(num_of_records), | atomic::add((uint32_t *)&IterCnt, uint32_t(num_of_records), | ||||
__ATOMIC_SEQ_CST); | __ATOMIC_SEQ_CST); | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
void __kmpc_nvptx_end_reduce(int32_t TId) {} | void __kmpc_nvptx_end_reduce(int32_t TId) { FunctionTracingRAII(); } | ||||
void __kmpc_nvptx_end_reduce_nowait(int32_t TId) {} | void __kmpc_nvptx_end_reduce_nowait(int32_t TId) { FunctionTracingRAII(); } | ||||
} | } | ||||
#pragma omp end declare target | #pragma omp end declare target |