[Openmp-commits] [PATCH] D105955: [NFC][OpenMP][Offloading] Replaced explicit parallel level computation with function `__kmpc_parallel_level`
Shilei Tian via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Thu Jul 15 13:58:12 PDT 2021
tianshilei1992 updated this revision to Diff 359128.
tianshilei1992 added a comment.
fixed comments
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105955/new/
https://reviews.llvm.org/D105955
Files:
openmp/libomptarget/deviceRTLs/common/src/libcall.cu
openmp/libomptarget/deviceRTLs/common/src/parallel.cu
openmp/libomptarget/deviceRTLs/common/src/support.cu
openmp/libomptarget/deviceRTLs/interface.h
Index: openmp/libomptarget/deviceRTLs/interface.h
===================================================================
--- openmp/libomptarget/deviceRTLs/interface.h
+++ openmp/libomptarget/deviceRTLs/interface.h
@@ -222,7 +222,7 @@
int32_t num_threads);
EXTERN void __kmpc_serialized_parallel(kmp_Ident *loc, uint32_t global_tid);
EXTERN void __kmpc_end_serialized_parallel(kmp_Ident *loc, uint32_t global_tid);
-EXTERN uint16_t __kmpc_parallel_level(kmp_Ident *loc, uint32_t global_tid);
+EXTERN uint16_t __kmpc_parallel_level();
// proc bind
EXTERN void __kmpc_push_proc_bind(kmp_Ident *loc, uint32_t global_tid,
Index: openmp/libomptarget/deviceRTLs/common/src/support.cu
===================================================================
--- openmp/libomptarget/deviceRTLs/common/src/support.cu
+++ openmp/libomptarget/deviceRTLs/common/src/support.cu
@@ -89,7 +89,7 @@
return 0;
// omp_thread_num
int rc;
- if ((parallelLevel[GetWarpId()] & (OMP_ACTIVE_PARALLEL_LEVEL - 1)) > 1) {
+ if (__kmpc_parallel_level() > 1) {
rc = 0;
} else if (__kmpc_is_spmd_exec_mode()) {
rc = tid;
Index: openmp/libomptarget/deviceRTLs/common/src/parallel.cu
===================================================================
--- openmp/libomptarget/deviceRTLs/common/src/parallel.cu
+++ openmp/libomptarget/deviceRTLs/common/src/parallel.cu
@@ -238,9 +238,7 @@
currTaskDescr->RestoreLoopData();
}
-EXTERN uint16_t __kmpc_parallel_level(kmp_Ident *loc, uint32_t global_tid) {
- PRINT0(LD_IO, "call to __kmpc_parallel_level\n");
-
+EXTERN uint16_t __kmpc_parallel_level() {
return parallelLevel[GetWarpId()] & (OMP_ACTIVE_PARALLEL_LEVEL - 1);
}
@@ -292,7 +290,7 @@
// SPMD mode we already incremented the parallel level counter, account for
// that.
bool InParallelRegion =
- (__kmpc_parallel_level(ident, global_tid) > __kmpc_is_spmd_exec_mode());
+ (__kmpc_parallel_level() > __kmpc_is_spmd_exec_mode());
if (!if_expr || InParallelRegion) {
__kmpc_serialized_parallel(ident, global_tid);
__kmp_invoke_microtask(global_tid, 0, fn, args, nargs);
Index: openmp/libomptarget/deviceRTLs/common/src/libcall.cu
===================================================================
--- openmp/libomptarget/deviceRTLs/common/src/libcall.cu
+++ openmp/libomptarget/deviceRTLs/common/src/libcall.cu
@@ -129,7 +129,7 @@
}
EXTERN int omp_get_level(void) {
- int level = parallelLevel[GetWarpId()] & (OMP_ACTIVE_PARALLEL_LEVEL - 1);
+ int level = __kmpc_parallel_level();
PRINT(LD_IO, "call omp_get_level() returns %d\n", level);
return level;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105955.359128.patch
Type: text/x-patch
Size: 2644 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210715/85e98a31/attachment.bin>
More information about the Openmp-commits
mailing list