[llvm] 6f846c8 - Improve comments after 8404aeb56a73ab24f9b295111de3b37a37f0b841.
Alexandre Ganea via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 18 11:25:37 PST 2020
Author: Alexandre Ganea
Date: 2020-02-18T14:25:21-05:00
New Revision: 6f846c85045ca814b57ee495d9f85a7b0496e947
URL: https://github.com/llvm/llvm-project/commit/6f846c85045ca814b57ee495d9f85a7b0496e947
DIFF: https://github.com/llvm/llvm-project/commit/6f846c85045ca814b57ee495d9f85a7b0496e947.diff
LOG: Improve comments after 8404aeb56a73ab24f9b295111de3b37a37f0b841.
Added:
Modified:
llvm/include/llvm/Support/ThreadPool.h
llvm/include/llvm/Support/Threading.h
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
llvm/tools/llvm-lto2/llvm-lto2.cpp
Removed:
################################################################################
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 @@ class ThreadPool {
/// 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<std::string> 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<int> 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<bool>
"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<int> Threads("thinlto-threads", cl::init(0));
static cl::list<std::string> SymbolResolutions(
More information about the llvm-commits
mailing list