[Openmp-commits] [openmp] 74d622d - [OpenMP] Add new worksharing definitions into device RTL

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Mon Sep 27 08:36:52 PDT 2021


Author: Joseph Huber
Date: 2021-09-27T11:36:41-04:00
New Revision: 74d622dea450da4b85383aa4b1758b902ef906a6

URL: https://github.com/llvm/llvm-project/commit/74d622dea450da4b85383aa4b1758b902ef906a6
DIFF: https://github.com/llvm/llvm-project/commit/74d622dea450da4b85383aa4b1758b902ef906a6.diff

LOG: [OpenMP] Add new worksharing definitions into device RTL

This path defines the newly added `__kmpc_disitrute_static_init`
functions in the device runtime library. These functions are currently
exact copies of the current worksharing method but can be tuned later.

Depends on D110429

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D110430

Added: 
    

Modified: 
    openmp/libomptarget/DeviceRTL/src/Workshare.cpp
    openmp/libomptarget/deviceRTLs/common/src/loop.cu
    openmp/libomptarget/deviceRTLs/interface.h

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/DeviceRTL/src/Workshare.cpp b/openmp/libomptarget/DeviceRTL/src/Workshare.cpp
index 12dbeeed912a..071702e1fd02 100644
--- a/openmp/libomptarget/DeviceRTL/src/Workshare.cpp
+++ b/openmp/libomptarget/DeviceRTL/src/Workshare.cpp
@@ -592,7 +592,49 @@ void __kmpc_for_static_init_8u(IdentTy *loc, int32_t global_tid,
       mapping::isSPMDMode());
 }
 
+void __kmpc_distribute_static_init_4(IdentTy *loc, int32_t global_tid,
+                                     int32_t schedtype, int32_t *plastiter,
+                                     int32_t *plower, int32_t *pupper,
+                                     int32_t *pstride, int32_t incr,
+                                     int32_t chunk) {
+  omptarget_nvptx_LoopSupport<int32_t, int32_t>::for_static_init(
+      global_tid, schedtype, plastiter, plower, pupper, pstride, chunk,
+      mapping::isSPMDMode());
+}
+
+void __kmpc_distribute_static_init_4u(IdentTy *loc, int32_t global_tid,
+                                      int32_t schedtype, int32_t *plastiter,
+                                      uint32_t *plower, uint32_t *pupper,
+                                      int32_t *pstride, int32_t incr,
+                                      int32_t chunk) {
+  omptarget_nvptx_LoopSupport<uint32_t, int32_t>::for_static_init(
+      global_tid, schedtype, plastiter, plower, pupper, pstride, chunk,
+      mapping::isSPMDMode());
+}
+
+void __kmpc_distribute_static_init_8(IdentTy *loc, int32_t global_tid,
+                                     int32_t schedtype, int32_t *plastiter,
+                                     int64_t *plower, int64_t *pupper,
+                                     int64_t *pstride, int64_t incr,
+                                     int64_t chunk) {
+  omptarget_nvptx_LoopSupport<int64_t, int64_t>::for_static_init(
+      global_tid, schedtype, plastiter, plower, pupper, pstride, chunk,
+      mapping::isSPMDMode());
+}
+
+void __kmpc_distribute_static_init_8u(IdentTy *loc, int32_t global_tid,
+                                      int32_t schedtype, int32_t *plastiter,
+                                      uint64_t *plower, uint64_t *pupper,
+                                      int64_t *pstride, int64_t incr,
+                                      int64_t chunk) {
+  omptarget_nvptx_LoopSupport<uint64_t, int64_t>::for_static_init(
+      global_tid, schedtype, plastiter, plower, pupper, pstride, chunk,
+      mapping::isSPMDMode());
+}
+
 void __kmpc_for_static_fini(IdentTy *loc, int32_t global_tid) {}
+
+void __kmpc_distribute_static_fini(IdentTy *loc, int32_t global_tid) {}
 }
 
 #pragma omp end declare target

diff  --git a/openmp/libomptarget/deviceRTLs/common/src/loop.cu b/openmp/libomptarget/deviceRTLs/common/src/loop.cu
index e6d392c4c64d..0d4e2b1e4e0a 100644
--- a/openmp/libomptarget/deviceRTLs/common/src/loop.cu
+++ b/openmp/libomptarget/deviceRTLs/common/src/loop.cu
@@ -660,6 +660,52 @@ EXTERN void __kmpc_for_static_init_8u(kmp_Ident *loc, int32_t global_tid,
       __kmpc_is_spmd_exec_mode());
 }
 
+EXTERN void __kmpc_distribute_static_init_4(kmp_Ident *loc, int32_t global_tid,
+                                            int32_t schedtype,
+                                            int32_t *plastiter, int32_t *plower,
+                                            int32_t *pupper, int32_t *pstride,
+                                            int32_t incr, int32_t chunk) {
+  PRINT0(LD_IO, "call kmpc_distribute_static_init_4\n");
+  omptarget_nvptx_LoopSupport<int32_t, int32_t>::for_static_init(
+      global_tid, schedtype, plastiter, plower, pupper, pstride, chunk,
+      __kmpc_is_spmd_exec_mode());
+}
+
+EXTERN void __kmpc_distribute_static_init_4u(kmp_Ident *loc, int32_t global_tid,
+                                             int32_t schedtype,
+                                             int32_t *plastiter,
+                                             uint32_t *plower, uint32_t *pupper,
+                                             int32_t *pstride, int32_t incr,
+                                             int32_t chunk) {
+  PRINT0(LD_IO, "call kmpc_distribute_static_init_4u\n");
+  omptarget_nvptx_LoopSupport<uint32_t, int32_t>::for_static_init(
+      global_tid, schedtype, plastiter, plower, pupper, pstride, chunk,
+      __kmpc_is_spmd_exec_mode());
+}
+
+EXTERN void __kmpc_distribute_static_init_8(kmp_Ident *loc, int32_t global_tid,
+                                            int32_t schedtype,
+                                            int32_t *plastiter, int64_t *plower,
+                                            int64_t *pupper, int64_t *pstride,
+                                            int64_t incr, int64_t chunk) {
+  PRINT0(LD_IO, "call kmpc_distribute_static_init_8\n");
+  omptarget_nvptx_LoopSupport<int64_t, int64_t>::for_static_init(
+      global_tid, schedtype, plastiter, plower, pupper, pstride, chunk,
+      __kmpc_is_spmd_exec_mode());
+}
+
+EXTERN void __kmpc_distribute_static_init_8u(kmp_Ident *loc, int32_t global_tid,
+                                             int32_t schedtype,
+                                             int32_t *plastiter,
+                                             uint64_t *plower, uint64_t *pupper,
+                                             int64_t *pstride, int64_t incr,
+                                             int64_t chunk) {
+  PRINT0(LD_IO, "call kmpc_distribute_static_init_8u\n");
+  omptarget_nvptx_LoopSupport<uint64_t, int64_t>::for_static_init(
+      global_tid, schedtype, plastiter, plower, pupper, pstride, chunk,
+      __kmpc_is_spmd_exec_mode());
+}
+
 EXTERN
 void __kmpc_for_static_init_4_simple_spmd(kmp_Ident *loc, int32_t global_tid,
                                           int32_t schedtype, int32_t *plastiter,
@@ -756,6 +802,10 @@ void __kmpc_for_static_init_8u_simple_generic(
       /*IsSPMDExecutionMode=*/false);
 }
 
+EXTERN void __kmpc_distribute_static_fini(kmp_Ident *loc, int32_t global_tid) {
+  PRINT0(LD_IO, "call kmpc_distribute_static_fini\n");
+}
+
 EXTERN void __kmpc_for_static_fini(kmp_Ident *loc, int32_t global_tid) {
   PRINT0(LD_IO, "call kmpc_for_static_fini\n");
 }

diff  --git a/openmp/libomptarget/deviceRTLs/interface.h b/openmp/libomptarget/deviceRTLs/interface.h
index 4bee5db03641..96e583c2133f 100644
--- a/openmp/libomptarget/deviceRTLs/interface.h
+++ b/openmp/libomptarget/deviceRTLs/interface.h
@@ -255,6 +255,27 @@ EXTERN void __kmpc_for_static_init_8u(kmp_Ident *loc, int32_t global_tid,
                                       uint64_t *plower, uint64_t *pupper,
                                       int64_t *pstride, int64_t incr,
                                       int64_t chunk);
+// distribute static (no chunk or chunk)
+EXTERN void __kmpc_distribute_static_init_4(kmp_Ident *loc, int32_t global_tid,
+                                            int32_t sched, int32_t *plastiter,
+                                            int32_t *plower, int32_t *pupper,
+                                            int32_t *pstride, int32_t incr,
+                                            int32_t chunk);
+EXTERN void __kmpc_distribute_static_init_4u(kmp_Ident *loc, int32_t global_tid,
+                                             int32_t sched, int32_t *plastiter,
+                                             uint32_t *plower, uint32_t *pupper,
+                                             int32_t *pstride, int32_t incr,
+                                             int32_t chunk);
+EXTERN void __kmpc_distribute_static_init_8(kmp_Ident *loc, int32_t global_tid,
+                                            int32_t sched, int32_t *plastiter,
+                                            int64_t *plower, int64_t *pupper,
+                                            int64_t *pstride, int64_t incr,
+                                            int64_t chunk);
+EXTERN void __kmpc_distribute_static_init_8u(kmp_Ident *loc, int32_t global_tid,
+                                             int32_t sched, int32_t *plastiter1,
+                                             uint64_t *plower, uint64_t *pupper,
+                                             int64_t *pstride, int64_t incr,
+                                             int64_t chunk);
 EXTERN
 void __kmpc_for_static_init_4_simple_spmd(kmp_Ident *loc, int32_t global_tid,
                                           int32_t sched, int32_t *plastiter,
@@ -304,6 +325,8 @@ void __kmpc_for_static_init_8u_simple_generic(
 
 EXTERN void __kmpc_for_static_fini(kmp_Ident *loc, int32_t global_tid);
 
+EXTERN void __kmpc_distribute_static_fini(kmp_Ident *loc, int32_t global_tid);
+
 // for dynamic
 EXTERN void __kmpc_dispatch_init_4(kmp_Ident *loc, int32_t global_tid,
                                    int32_t sched, int32_t lower, int32_t upper,


        


More information about the Openmp-commits mailing list