[PATCH] D155731: [AIX] Define llvm::thread::DefaultStackSize to 4 megabytes on AIX

wael yehia via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 10:57:37 PDT 2023


w2yehia created this revision.
w2yehia added reviewers: ZarkoCA, qiongsiwu1, MaskRay.
Herald added a subscriber: hiraditya.
Herald added a project: All.
w2yehia requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Link time thinLTO spawns pthreads to parallelize optimization and codegen of the input bitcode files.
On AIX, the pthread's stack size limit is ~192k for 64-bit programs.
If `std::optional<unsigned> llvm::thread::DefaultStackSize` is initialized, then its value is used on a call to <https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/Unix/Threading.inc#L78> `pthread_attr_setstacksize` before `pthread_create` occurs.

We think increasing the default thread stack size limit in llvm on AIX to 4mb make sense.


https://reviews.llvm.org/D155731

Files:
  llvm/lib/Support/Threading.cpp


Index: llvm/lib/Support/Threading.cpp
===================================================================
--- llvm/lib/Support/Threading.cpp
+++ llvm/lib/Support/Threading.cpp
@@ -83,6 +83,8 @@
   // the same interface as std::thread but requests the same stack size as the
   // main thread (8MB) before creation.
 const std::optional<unsigned> llvm::thread::DefaultStackSize = 8 * 1024 * 1024;
+#elif defined(_AIX)
+const std::optional<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
 #else
 const std::optional<unsigned> llvm::thread::DefaultStackSize;
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155731.542104.patch
Type: text/x-patch
Size: 576 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230719/ef869de8/attachment.bin>


More information about the llvm-commits mailing list