diff --git a/llvm/include/llvm/Support/ThreadPool.h b/llvm/include/llvm/Support/ThreadPool.h index 2036f46c6d56..57bddd8145b6 100644 --- a/llvm/include/llvm/Support/ThreadPool.h +++ b/llvm/include/llvm/Support/ThreadPool.h @@ -43,7 +43,7 @@ public: /// Construct a pool using the hardware strategy \p S for mapping hardware /// execution resources (threads, cores, CPUs) /// Defaults to using the maximum execution resources in the system, but - /// excluding any resources contained in the affinity mask. + /// accounting for the affinity mask. ThreadPool(ThreadPoolStrategy S = hardware_concurrency()); /// Blocking destructor: the pool will wait for all the threads to complete. diff --git a/llvm/include/llvm/Support/Threading.h b/llvm/include/llvm/Support/Threading.h index d3d4a37e69c6..24a0789e0964 100644 --- a/llvm/include/llvm/Support/Threading.h +++ b/llvm/include/llvm/Support/Threading.h @@ -148,8 +148,9 @@ void llvm_execute_on_thread_async( class ThreadPoolStrategy { public: // The default value (0) means all available threads should be used, - // excluding affinity mask. If set, this value only represents a suggested - // high bound, the runtime might choose a lower value (not higher). + // taking the affinity mask into account. If set, this value only represents + // a suggested high bound, the runtime might choose a lower value (not + // higher). unsigned ThreadsRequested = 0; // If SMT is active, use hyper threads. If false, there will be only one @@ -172,7 +173,7 @@ void llvm_execute_on_thread_async( /// be less efficient. Avoid this strategy if doing lots of I/O. Currently /// based on physical cores, if available for the host system, otherwise falls /// back to hardware_concurrency(). Returns 1 when LLVM is configured with - /// LLVM_ENABLE_THREADS = OFF + /// LLVM_ENABLE_THREADS = OFF. inline ThreadPoolStrategy heavyweight_hardware_concurrency(unsigned ThreadCount = 0) { ThreadPoolStrategy S; @@ -219,7 +220,7 @@ void llvm_execute_on_thread_async( /// Returns a mask that represents on which hardware thread, core, CPU, NUMA /// group, the calling thread can be executed. On Windows, threads cannot - /// cross CPU boundaries. + /// cross CPU sockets boundaries. llvm::BitVector get_thread_affinity_mask(); /// Returns how many physical CPUs or NUMA groups the system has. diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index 152f0afcf12e..0346954c7a0a 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -80,7 +80,9 @@ extern cl::opt RemarksFormat; namespace { -// Default to using one job per hardware core in the system +// Default to using all available threads in the system, but using only one +// thred per core, as indicated by the usage of +// heavyweight_hardware_concurrency() below. static cl::opt ThreadCount("threads", cl::init(0)); // Simple helper to save temporary files for debug. diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp index fc86fd969efb..ee16a473dbc2 100644 --- a/llvm/tools/llvm-lto2/llvm-lto2.cpp +++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp @@ -65,7 +65,9 @@ static cl::opt "import files for the " "distributed backend case")); -// Default to using all hardware cores in the system. +// Default to using all available threads in the system, but using only one +// thread per core, as indicated by the usage of +// heavyweight_hardware_concurrency() in the InProcessThinBackend constructor. static cl::opt Threads("thinlto-threads", cl::init(0)); static cl::list SymbolResolutions(