[llvm] f94608a - Define llvm::thread::DefaultStackSize to 4 megabytes on AIX

Wael Yehia via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 11:58:02 PDT 2023


Author: Wael Yehia
Date: 2023-07-19T18:57:55Z
New Revision: f94608a164896e7108de2a8647285cc7d429f17b

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

LOG: Define llvm::thread::DefaultStackSize to 4 megabytes on AIX

Link time thinLTO spawns pthreads to parallelize optimization and
codegen of the input bitcode files. On AIX, the default pthread
stack size limit is ~192k for 64-bit programs; insufficient for a
normal LLVM compilation.

Reviewed By: ZarkoCA, MaskRay

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

Added: 
    

Modified: 
    llvm/lib/Support/Threading.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
index 923935bbca1030..7cc7ba44cc72d4 100644
--- a/llvm/lib/Support/Threading.cpp
+++ b/llvm/lib/Support/Threading.cpp
@@ -83,6 +83,11 @@ unsigned llvm::ThreadPoolStrategy::compute_thread_count() const {
   // 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)
+  // On AIX, the default pthread stack size limit is ~192k for 64-bit programs.
+  // This limit is easily reached when doing link-time thinLTO. AIX library
+  // developers have used 4MB, so we'll do the same.
+const std::optional<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
 #else
 const std::optional<unsigned> llvm::thread::DefaultStackSize;
 #endif


        


More information about the llvm-commits mailing list