[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
Tue Jul 13 18:24:22 PDT 2021
tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, JonChesterfield, ggeorgakoudis, jhuber6.
Herald added subscribers: guansong, yaxunl.
tianshilei1992 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.
There are two places in current deviceRTLs where it computes parallel level explicitly,
which is basically the functionality of `__kmpc_parallel_level`. Starting from
D105787 <https://reviews.llvm.org/D105787>, we plan to introduce a series of function call folding based on information
that can be deducted during compilation time. Computation of parallel level is
the next target. This patch makes steps for the optimization.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D105955
Files:
openmp/libomptarget/deviceRTLs/common/src/libcall.cu
openmp/libomptarget/deviceRTLs/common/src/support.cu
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(nullptr, 0) > 1) {
rc = 0;
} else if (__kmpc_is_spmd_exec_mode()) {
rc = tid;
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(nullptr, 0);
PRINT(LD_IO, "call omp_get_level() returns %d\n", level);
return level;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105955.358476.patch
Type: text/x-patch
Size: 1013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210714/45765d5c/attachment.bin>
More information about the Openmp-commits
mailing list