[Openmp-commits] [PATCH] D118625: [Libomptarget] Reduce shared memory stack size to 512 and a message when it is exceeded

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Jan 31 09:18:49 PST 2022

jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, tianshilei1992, JonChesterfield.
Herald added a subscriber: mgorny.
jhuber6 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

Reduces the shared memory size used for globalization to 512 bytes from
2048 to reduce the pressure on shared memory. This patch ado adds a
debug mesage to indicate when the shared memory was insufficient.

  rG LLVM Github Monorepo



Index: openmp/libomptarget/DeviceRTL/src/State.cpp
--- openmp/libomptarget/DeviceRTL/src/State.cpp
+++ openmp/libomptarget/DeviceRTL/src/State.cpp
@@ -136,6 +136,8 @@
     return Ptr;
+  if (config::isDebugMode(config::DebugKind::CommonIssues))
+    PRINT("Insufficient shared stack memory.\n");
   void *GlobalMemory = memory::allocGlobal(
       AlignedBytes, "Slow path shared memory allocation, insufficient "
                     "shared memory stack memory!");
Index: openmp/libomptarget/DeviceRTL/CMakeLists.txt
--- openmp/libomptarget/DeviceRTL/CMakeLists.txt
+++ openmp/libomptarget/DeviceRTL/CMakeLists.txt
@@ -122,7 +122,7 @@
-set(clang_opt_flags -O1 -mllvm -openmp-opt-disable -DSHARED_SCRATCHPAD_SIZE=2048)
+set(clang_opt_flags -O1 -mllvm -openmp-opt-disable -DSHARED_SCRATCHPAD_SIZE=512)
 set(link_opt_flags  -O1        -openmp-opt-disable)
 # Prepend -I to each list element

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118625.404572.patch
Type: text/x-patch
Size: 1077 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220131/0416348c/attachment-0001.bin>

More information about the Openmp-commits mailing list