Improve comments after 8404aeb56a.

This commit is contained in:
Alexandre Ganea 2020-02-18 14:25:08 -05:00
parent 89ab5c69c8
commit 6f846c8504
4 changed files with 12 additions and 7 deletions

View File

@ -43,7 +43,7 @@ public:
/// Construct a pool using the hardware strategy \p S for mapping hardware /// Construct a pool using the hardware strategy \p S for mapping hardware
/// execution resources (threads, cores, CPUs) /// execution resources (threads, cores, CPUs)
/// Defaults to using the maximum execution resources in the system, but /// 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()); ThreadPool(ThreadPoolStrategy S = hardware_concurrency());
/// Blocking destructor: the pool will wait for all the threads to complete. /// Blocking destructor: the pool will wait for all the threads to complete.

View File

@ -148,8 +148,9 @@ void llvm_execute_on_thread_async(
class ThreadPoolStrategy { class ThreadPoolStrategy {
public: public:
// The default value (0) means all available threads should be used, // The default value (0) means all available threads should be used,
// excluding affinity mask. If set, this value only represents a suggested // taking the affinity mask into account. If set, this value only represents
// high bound, the runtime might choose a lower value (not higher). // a suggested high bound, the runtime might choose a lower value (not
// higher).
unsigned ThreadsRequested = 0; unsigned ThreadsRequested = 0;
// If SMT is active, use hyper threads. If false, there will be only one // 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 /// 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 /// based on physical cores, if available for the host system, otherwise falls
/// back to hardware_concurrency(). Returns 1 when LLVM is configured with /// back to hardware_concurrency(). Returns 1 when LLVM is configured with
/// LLVM_ENABLE_THREADS = OFF /// LLVM_ENABLE_THREADS = OFF.
inline ThreadPoolStrategy inline ThreadPoolStrategy
heavyweight_hardware_concurrency(unsigned ThreadCount = 0) { heavyweight_hardware_concurrency(unsigned ThreadCount = 0) {
ThreadPoolStrategy S; ThreadPoolStrategy S;
@ -219,7 +220,7 @@ void llvm_execute_on_thread_async(
/// Returns a mask that represents on which hardware thread, core, CPU, NUMA /// Returns a mask that represents on which hardware thread, core, CPU, NUMA
/// group, the calling thread can be executed. On Windows, threads cannot /// group, the calling thread can be executed. On Windows, threads cannot
/// cross CPU boundaries. /// cross CPU sockets boundaries.
llvm::BitVector get_thread_affinity_mask(); llvm::BitVector get_thread_affinity_mask();
/// Returns how many physical CPUs or NUMA groups the system has. /// Returns how many physical CPUs or NUMA groups the system has.

View File

@ -80,7 +80,9 @@ extern cl::opt<std::string> RemarksFormat;
namespace { 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)); static cl::opt<int> ThreadCount("threads", cl::init(0));
// Simple helper to save temporary files for debug. // Simple helper to save temporary files for debug.

View File

@ -65,7 +65,9 @@ static cl::opt<bool>
"import files for the " "import files for the "
"distributed backend case")); "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::opt<int> Threads("thinlto-threads", cl::init(0));
static cl::list<std::string> SymbolResolutions( static cl::list<std::string> SymbolResolutions(