Changeset View
Changeset View
Standalone View
Standalone View
openmp/libomptarget/DeviceRTL/src/Workshare.cpp
Show First 20 Lines • Show All 468 Lines • ▼ Show 20 Lines | static void popDST() { | ||||
ThreadDSTPtr = OldDST; | ThreadDSTPtr = OldDST; | ||||
} | } | ||||
extern "C" { | extern "C" { | ||||
// init | // init | ||||
void __kmpc_dispatch_init_4(IdentTy *loc, int32_t tid, int32_t schedule, | void __kmpc_dispatch_init_4(IdentTy *loc, int32_t tid, int32_t schedule, | ||||
int32_t lb, int32_t ub, int32_t st, int32_t chunk) { | int32_t lb, int32_t ub, int32_t st, int32_t chunk) { | ||||
FunctionTracingRAII(); | |||||
DynamicScheduleTracker *DST = pushDST(); | DynamicScheduleTracker *DST = pushDST(); | ||||
omptarget_nvptx_LoopSupport<int32_t, int32_t>::dispatch_init( | omptarget_nvptx_LoopSupport<int32_t, int32_t>::dispatch_init( | ||||
loc, tid, (kmp_sched_t)schedule, lb, ub, st, chunk, DST); | loc, tid, (kmp_sched_t)schedule, lb, ub, st, chunk, DST); | ||||
} | } | ||||
void __kmpc_dispatch_init_4u(IdentTy *loc, int32_t tid, int32_t schedule, | void __kmpc_dispatch_init_4u(IdentTy *loc, int32_t tid, int32_t schedule, | ||||
uint32_t lb, uint32_t ub, int32_t st, | uint32_t lb, uint32_t ub, int32_t st, | ||||
int32_t chunk) { | int32_t chunk) { | ||||
FunctionTracingRAII(); | |||||
DynamicScheduleTracker *DST = pushDST(); | DynamicScheduleTracker *DST = pushDST(); | ||||
omptarget_nvptx_LoopSupport<uint32_t, int32_t>::dispatch_init( | omptarget_nvptx_LoopSupport<uint32_t, int32_t>::dispatch_init( | ||||
loc, tid, (kmp_sched_t)schedule, lb, ub, st, chunk, DST); | loc, tid, (kmp_sched_t)schedule, lb, ub, st, chunk, DST); | ||||
} | } | ||||
void __kmpc_dispatch_init_8(IdentTy *loc, int32_t tid, int32_t schedule, | void __kmpc_dispatch_init_8(IdentTy *loc, int32_t tid, int32_t schedule, | ||||
int64_t lb, int64_t ub, int64_t st, int64_t chunk) { | int64_t lb, int64_t ub, int64_t st, int64_t chunk) { | ||||
FunctionTracingRAII(); | |||||
DynamicScheduleTracker *DST = pushDST(); | DynamicScheduleTracker *DST = pushDST(); | ||||
omptarget_nvptx_LoopSupport<int64_t, int64_t>::dispatch_init( | omptarget_nvptx_LoopSupport<int64_t, int64_t>::dispatch_init( | ||||
loc, tid, (kmp_sched_t)schedule, lb, ub, st, chunk, DST); | loc, tid, (kmp_sched_t)schedule, lb, ub, st, chunk, DST); | ||||
} | } | ||||
void __kmpc_dispatch_init_8u(IdentTy *loc, int32_t tid, int32_t schedule, | void __kmpc_dispatch_init_8u(IdentTy *loc, int32_t tid, int32_t schedule, | ||||
uint64_t lb, uint64_t ub, int64_t st, | uint64_t lb, uint64_t ub, int64_t st, | ||||
int64_t chunk) { | int64_t chunk) { | ||||
FunctionTracingRAII(); | |||||
DynamicScheduleTracker *DST = pushDST(); | DynamicScheduleTracker *DST = pushDST(); | ||||
omptarget_nvptx_LoopSupport<uint64_t, int64_t>::dispatch_init( | omptarget_nvptx_LoopSupport<uint64_t, int64_t>::dispatch_init( | ||||
loc, tid, (kmp_sched_t)schedule, lb, ub, st, chunk, DST); | loc, tid, (kmp_sched_t)schedule, lb, ub, st, chunk, DST); | ||||
} | } | ||||
// next | // next | ||||
int __kmpc_dispatch_next_4(IdentTy *loc, int32_t tid, int32_t *p_last, | int __kmpc_dispatch_next_4(IdentTy *loc, int32_t tid, int32_t *p_last, | ||||
int32_t *p_lb, int32_t *p_ub, int32_t *p_st) { | int32_t *p_lb, int32_t *p_ub, int32_t *p_st) { | ||||
FunctionTracingRAII(); | |||||
DynamicScheduleTracker *DST = peekDST(); | DynamicScheduleTracker *DST = peekDST(); | ||||
return omptarget_nvptx_LoopSupport<int32_t, int32_t>::dispatch_next( | return omptarget_nvptx_LoopSupport<int32_t, int32_t>::dispatch_next( | ||||
loc, tid, p_last, p_lb, p_ub, p_st, DST); | loc, tid, p_last, p_lb, p_ub, p_st, DST); | ||||
} | } | ||||
int __kmpc_dispatch_next_4u(IdentTy *loc, int32_t tid, int32_t *p_last, | int __kmpc_dispatch_next_4u(IdentTy *loc, int32_t tid, int32_t *p_last, | ||||
uint32_t *p_lb, uint32_t *p_ub, int32_t *p_st) { | uint32_t *p_lb, uint32_t *p_ub, int32_t *p_st) { | ||||
FunctionTracingRAII(); | |||||
DynamicScheduleTracker *DST = peekDST(); | DynamicScheduleTracker *DST = peekDST(); | ||||
return omptarget_nvptx_LoopSupport<uint32_t, int32_t>::dispatch_next( | return omptarget_nvptx_LoopSupport<uint32_t, int32_t>::dispatch_next( | ||||
loc, tid, p_last, p_lb, p_ub, p_st, DST); | loc, tid, p_last, p_lb, p_ub, p_st, DST); | ||||
} | } | ||||
int __kmpc_dispatch_next_8(IdentTy *loc, int32_t tid, int32_t *p_last, | int __kmpc_dispatch_next_8(IdentTy *loc, int32_t tid, int32_t *p_last, | ||||
int64_t *p_lb, int64_t *p_ub, int64_t *p_st) { | int64_t *p_lb, int64_t *p_ub, int64_t *p_st) { | ||||
FunctionTracingRAII(); | |||||
DynamicScheduleTracker *DST = peekDST(); | DynamicScheduleTracker *DST = peekDST(); | ||||
return omptarget_nvptx_LoopSupport<int64_t, int64_t>::dispatch_next( | return omptarget_nvptx_LoopSupport<int64_t, int64_t>::dispatch_next( | ||||
loc, tid, p_last, p_lb, p_ub, p_st, DST); | loc, tid, p_last, p_lb, p_ub, p_st, DST); | ||||
} | } | ||||
int __kmpc_dispatch_next_8u(IdentTy *loc, int32_t tid, int32_t *p_last, | int __kmpc_dispatch_next_8u(IdentTy *loc, int32_t tid, int32_t *p_last, | ||||
uint64_t *p_lb, uint64_t *p_ub, int64_t *p_st) { | uint64_t *p_lb, uint64_t *p_ub, int64_t *p_st) { | ||||
FunctionTracingRAII(); | |||||
DynamicScheduleTracker *DST = peekDST(); | DynamicScheduleTracker *DST = peekDST(); | ||||
return omptarget_nvptx_LoopSupport<uint64_t, int64_t>::dispatch_next( | return omptarget_nvptx_LoopSupport<uint64_t, int64_t>::dispatch_next( | ||||
loc, tid, p_last, p_lb, p_ub, p_st, DST); | loc, tid, p_last, p_lb, p_ub, p_st, DST); | ||||
} | } | ||||
// fini | // fini | ||||
void __kmpc_dispatch_fini_4(IdentTy *loc, int32_t tid) { | void __kmpc_dispatch_fini_4(IdentTy *loc, int32_t tid) { | ||||
FunctionTracingRAII(); | |||||
omptarget_nvptx_LoopSupport<int32_t, int32_t>::dispatch_fini(); | omptarget_nvptx_LoopSupport<int32_t, int32_t>::dispatch_fini(); | ||||
popDST(); | popDST(); | ||||
} | } | ||||
void __kmpc_dispatch_fini_4u(IdentTy *loc, int32_t tid) { | void __kmpc_dispatch_fini_4u(IdentTy *loc, int32_t tid) { | ||||
FunctionTracingRAII(); | |||||
omptarget_nvptx_LoopSupport<uint32_t, int32_t>::dispatch_fini(); | omptarget_nvptx_LoopSupport<uint32_t, int32_t>::dispatch_fini(); | ||||
popDST(); | popDST(); | ||||
} | } | ||||
void __kmpc_dispatch_fini_8(IdentTy *loc, int32_t tid) { | void __kmpc_dispatch_fini_8(IdentTy *loc, int32_t tid) { | ||||
FunctionTracingRAII(); | |||||
omptarget_nvptx_LoopSupport<int64_t, int64_t>::dispatch_fini(); | omptarget_nvptx_LoopSupport<int64_t, int64_t>::dispatch_fini(); | ||||
popDST(); | popDST(); | ||||
} | } | ||||
void __kmpc_dispatch_fini_8u(IdentTy *loc, int32_t tid) { | void __kmpc_dispatch_fini_8u(IdentTy *loc, int32_t tid) { | ||||
FunctionTracingRAII(); | |||||
omptarget_nvptx_LoopSupport<uint64_t, int64_t>::dispatch_fini(); | omptarget_nvptx_LoopSupport<uint64_t, int64_t>::dispatch_fini(); | ||||
popDST(); | popDST(); | ||||
} | } | ||||
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// | ||||
// KMP interface implementation (static loops) | // KMP interface implementation (static loops) | ||||
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// | ||||
void __kmpc_for_static_init_4(IdentTy *loc, int32_t global_tid, | void __kmpc_for_static_init_4(IdentTy *loc, int32_t global_tid, | ||||
int32_t schedtype, int32_t *plastiter, | int32_t schedtype, int32_t *plastiter, | ||||
int32_t *plower, int32_t *pupper, | int32_t *plower, int32_t *pupper, | ||||
int32_t *pstride, int32_t incr, int32_t chunk) { | int32_t *pstride, int32_t incr, int32_t chunk) { | ||||
FunctionTracingRAII(); | |||||
omptarget_nvptx_LoopSupport<int32_t, int32_t>::for_static_init( | omptarget_nvptx_LoopSupport<int32_t, int32_t>::for_static_init( | ||||
global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | ||||
mapping::isSPMDMode()); | mapping::isSPMDMode()); | ||||
} | } | ||||
void __kmpc_for_static_init_4u(IdentTy *loc, int32_t global_tid, | void __kmpc_for_static_init_4u(IdentTy *loc, int32_t global_tid, | ||||
int32_t schedtype, int32_t *plastiter, | int32_t schedtype, int32_t *plastiter, | ||||
uint32_t *plower, uint32_t *pupper, | uint32_t *plower, uint32_t *pupper, | ||||
int32_t *pstride, int32_t incr, int32_t chunk) { | int32_t *pstride, int32_t incr, int32_t chunk) { | ||||
FunctionTracingRAII(); | |||||
omptarget_nvptx_LoopSupport<uint32_t, int32_t>::for_static_init( | omptarget_nvptx_LoopSupport<uint32_t, int32_t>::for_static_init( | ||||
global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | ||||
mapping::isSPMDMode()); | mapping::isSPMDMode()); | ||||
} | } | ||||
void __kmpc_for_static_init_8(IdentTy *loc, int32_t global_tid, | void __kmpc_for_static_init_8(IdentTy *loc, int32_t global_tid, | ||||
int32_t schedtype, int32_t *plastiter, | int32_t schedtype, int32_t *plastiter, | ||||
int64_t *plower, int64_t *pupper, | int64_t *plower, int64_t *pupper, | ||||
int64_t *pstride, int64_t incr, int64_t chunk) { | int64_t *pstride, int64_t incr, int64_t chunk) { | ||||
FunctionTracingRAII(); | |||||
omptarget_nvptx_LoopSupport<int64_t, int64_t>::for_static_init( | omptarget_nvptx_LoopSupport<int64_t, int64_t>::for_static_init( | ||||
global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | ||||
mapping::isSPMDMode()); | mapping::isSPMDMode()); | ||||
} | } | ||||
void __kmpc_for_static_init_8u(IdentTy *loc, int32_t global_tid, | void __kmpc_for_static_init_8u(IdentTy *loc, int32_t global_tid, | ||||
int32_t schedtype, int32_t *plastiter, | int32_t schedtype, int32_t *plastiter, | ||||
uint64_t *plower, uint64_t *pupper, | uint64_t *plower, uint64_t *pupper, | ||||
int64_t *pstride, int64_t incr, int64_t chunk) { | int64_t *pstride, int64_t incr, int64_t chunk) { | ||||
FunctionTracingRAII(); | |||||
omptarget_nvptx_LoopSupport<uint64_t, int64_t>::for_static_init( | omptarget_nvptx_LoopSupport<uint64_t, int64_t>::for_static_init( | ||||
global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | ||||
mapping::isSPMDMode()); | mapping::isSPMDMode()); | ||||
} | } | ||||
void __kmpc_distribute_static_init_4(IdentTy *loc, int32_t global_tid, | void __kmpc_distribute_static_init_4(IdentTy *loc, int32_t global_tid, | ||||
int32_t schedtype, int32_t *plastiter, | int32_t schedtype, int32_t *plastiter, | ||||
int32_t *plower, int32_t *pupper, | int32_t *plower, int32_t *pupper, | ||||
int32_t *pstride, int32_t incr, | int32_t *pstride, int32_t incr, | ||||
int32_t chunk) { | int32_t chunk) { | ||||
FunctionTracingRAII(); | |||||
omptarget_nvptx_LoopSupport<int32_t, int32_t>::for_static_init( | omptarget_nvptx_LoopSupport<int32_t, int32_t>::for_static_init( | ||||
global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | ||||
mapping::isSPMDMode()); | mapping::isSPMDMode()); | ||||
} | } | ||||
void __kmpc_distribute_static_init_4u(IdentTy *loc, int32_t global_tid, | void __kmpc_distribute_static_init_4u(IdentTy *loc, int32_t global_tid, | ||||
int32_t schedtype, int32_t *plastiter, | int32_t schedtype, int32_t *plastiter, | ||||
uint32_t *plower, uint32_t *pupper, | uint32_t *plower, uint32_t *pupper, | ||||
int32_t *pstride, int32_t incr, | int32_t *pstride, int32_t incr, | ||||
int32_t chunk) { | int32_t chunk) { | ||||
FunctionTracingRAII(); | |||||
omptarget_nvptx_LoopSupport<uint32_t, int32_t>::for_static_init( | omptarget_nvptx_LoopSupport<uint32_t, int32_t>::for_static_init( | ||||
global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | ||||
mapping::isSPMDMode()); | mapping::isSPMDMode()); | ||||
} | } | ||||
void __kmpc_distribute_static_init_8(IdentTy *loc, int32_t global_tid, | void __kmpc_distribute_static_init_8(IdentTy *loc, int32_t global_tid, | ||||
int32_t schedtype, int32_t *plastiter, | int32_t schedtype, int32_t *plastiter, | ||||
int64_t *plower, int64_t *pupper, | int64_t *plower, int64_t *pupper, | ||||
int64_t *pstride, int64_t incr, | int64_t *pstride, int64_t incr, | ||||
int64_t chunk) { | int64_t chunk) { | ||||
FunctionTracingRAII(); | |||||
omptarget_nvptx_LoopSupport<int64_t, int64_t>::for_static_init( | omptarget_nvptx_LoopSupport<int64_t, int64_t>::for_static_init( | ||||
global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | ||||
mapping::isSPMDMode()); | mapping::isSPMDMode()); | ||||
} | } | ||||
void __kmpc_distribute_static_init_8u(IdentTy *loc, int32_t global_tid, | void __kmpc_distribute_static_init_8u(IdentTy *loc, int32_t global_tid, | ||||
int32_t schedtype, int32_t *plastiter, | int32_t schedtype, int32_t *plastiter, | ||||
uint64_t *plower, uint64_t *pupper, | uint64_t *plower, uint64_t *pupper, | ||||
int64_t *pstride, int64_t incr, | int64_t *pstride, int64_t incr, | ||||
int64_t chunk) { | int64_t chunk) { | ||||
FunctionTracingRAII(); | |||||
omptarget_nvptx_LoopSupport<uint64_t, int64_t>::for_static_init( | omptarget_nvptx_LoopSupport<uint64_t, int64_t>::for_static_init( | ||||
global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | global_tid, schedtype, plastiter, plower, pupper, pstride, chunk, | ||||
mapping::isSPMDMode()); | mapping::isSPMDMode()); | ||||
} | } | ||||
void __kmpc_for_static_fini(IdentTy *loc, int32_t global_tid) {} | void __kmpc_for_static_fini(IdentTy *loc, int32_t global_tid) { | ||||
FunctionTracingRAII(); | |||||
} | |||||
void __kmpc_distribute_static_fini(IdentTy *loc, int32_t global_tid) {} | void __kmpc_distribute_static_fini(IdentTy *loc, int32_t global_tid) { | ||||
FunctionTracingRAII(); | |||||
} | |||||
} | } | ||||
#pragma omp end declare target | #pragma omp end declare target |