Skip to content

Commit

Permalink
Define llvm::thread::DefaultStackSize to 4 megabytes on AIX
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Wael Yehia committed Jul 19, 2023
1 parent aae2eaa commit f94608a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions llvm/lib/Support/Threading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f94608a

Please sign in to comment.