[Openmp-commits] [PATCH] D111381: [OpenMP] Avoid calling `isSPMDMode` during RT initialization

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Oct 8 19:00:56 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG85ad56633593: [OpenMP] Avoid calling `isSPMDMode` during RT initialization (authored by jhuber6).

Changed prior to commit:
  https://reviews.llvm.org/D111381?vs=378080&id=378394#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111381/new/

https://reviews.llvm.org/D111381

Files:
  openmp/libomptarget/DeviceRTL/include/Mapping.h
  openmp/libomptarget/DeviceRTL/src/Kernel.cpp
  openmp/libomptarget/DeviceRTL/src/Mapping.cpp
  openmp/libomptarget/DeviceRTL/src/Reduction.cpp


Index: openmp/libomptarget/DeviceRTL/src/Reduction.cpp
===================================================================
--- openmp/libomptarget/DeviceRTL/src/Reduction.cpp
+++ openmp/libomptarget/DeviceRTL/src/Reduction.cpp
@@ -72,7 +72,7 @@
                                             InterWarpCopyFnTy cpyFct,
                                             bool isSPMDExecutionMode, bool) {
   uint32_t BlockThreadId = mapping::getThreadIdInBlock();
-  if (mapping::isMainThreadInGenericMode())
+  if (mapping::isMainThreadInGenericMode(/* IsSPMD */ false))
     BlockThreadId = 0;
   uint32_t NumThreads = omp_get_num_threads();
   if (NumThreads == 1)
Index: openmp/libomptarget/DeviceRTL/src/Mapping.cpp
===================================================================
--- openmp/libomptarget/DeviceRTL/src/Mapping.cpp
+++ openmp/libomptarget/DeviceRTL/src/Mapping.cpp
@@ -165,8 +165,8 @@
 } // namespace impl
 } // namespace _OMP
 
-bool mapping::isMainThreadInGenericMode() {
-  if (mapping::isSPMDMode() || icv::Level)
+bool mapping::isMainThreadInGenericMode(bool IsSPMD) {
+  if (IsSPMD || icv::Level)
     return false;
 
   // Check if this is the last warp in the block.
@@ -175,6 +175,10 @@
   return mapping::getThreadIdInBlock() == MainTId;
 }
 
+bool mapping::isMainThreadInGenericMode() {
+  return mapping::isMainThreadInGenericMode(mapping::isSPMDMode());
+}
+
 bool mapping::isLeaderInWarp() {
   __kmpc_impl_lanemask_t Active = mapping::activemask();
   __kmpc_impl_lanemask_t LaneMaskLT = mapping::lanemaskLT();
Index: openmp/libomptarget/DeviceRTL/src/Kernel.cpp
===================================================================
--- openmp/libomptarget/DeviceRTL/src/Kernel.cpp
+++ openmp/libomptarget/DeviceRTL/src/Kernel.cpp
@@ -81,7 +81,7 @@
     return -1;
   }
 
-  if (mapping::isMainThreadInGenericMode())
+  if (mapping::isMainThreadInGenericMode(IsSPMD))
     return -1;
 
   if (UseGenericStateMachine)
Index: openmp/libomptarget/DeviceRTL/include/Mapping.h
===================================================================
--- openmp/libomptarget/DeviceRTL/include/Mapping.h
+++ openmp/libomptarget/DeviceRTL/include/Mapping.h
@@ -35,6 +35,7 @@
 
 /// Return true if the executing thread is the main thread in generic mode.
 bool isMainThreadInGenericMode();
+bool isMainThreadInGenericMode(bool IsSPMD);
 
 /// Return true if the executing thread has the lowest Id of the active threads
 /// in the warp.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111381.378394.patch
Type: text/x-patch
Size: 2450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211009/7d11ce1b/attachment.bin>


More information about the Openmp-commits mailing list