llvm.org GIT mirror llvm / 740d871
[ThinLTO] Default backend threads to heavyweight_hardware_concurrency Summary: Changes default backend parallelism from thread::hardware_concurrency to the new llvm::heavyweight_hardware_concurrency, which for X86 Linux defaults to the number of physical cores (and will fall back to thread::hardware_concurrency otherwise). This avoid oversubscribing the physical cores using hyperthreading. Reviewers: mehdi_amini, pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25775 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284618 91177308-0d34-0410-b5e6-96231b3b80d8 Teresa Johnson 4 years ago
4 changed file(s) with 10 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
2828 #include "llvm/Support/SourceMgr.h"
2929 #include "llvm/Support/TargetRegistry.h"
3030 #include "llvm/Support/ThreadPool.h"
31 #include "llvm/Support/Threading.h"
3132 #include "llvm/Support/raw_ostream.h"
3233 #include "llvm/Target/TargetMachine.h"
3334 #include "llvm/Target/TargetOptions.h"
226227
227228 LTO::ThinLTOState::ThinLTOState(ThinBackend Backend) : Backend(Backend) {
228229 if (!Backend)
229 this->Backend = createInProcessThinBackend(thread::hardware_concurrency());
230 this->Backend =
231 createInProcessThinBackend(llvm::heavyweight_hardware_concurrency());
230232 }
231233
232234 LTO::LTO(Config Conf, ThinBackend Backend,
4242 #include "llvm/Support/SHA1.h"
4343 #include "llvm/Support/TargetRegistry.h"
4444 #include "llvm/Support/ThreadPool.h"
45 #include "llvm/Support/Threading.h"
4546 #include "llvm/Target/TargetMachine.h"
4647 #include "llvm/Transforms/IPO.h"
4748 #include "llvm/Transforms/IPO/FunctionImport.h"
6364
6465 namespace {
6566
66 static cl::opt ThreadCount("threads",
67 cl::init(std::thread::hardware_concurrency()));
67 static cl::opt
68 ThreadCount("threads", cl::init(llvm::heavyweight_hardware_concurrency()));
6869
6970 static void diagnosticHandler(const DiagnosticInfo &DI) {
7071 DiagnosticPrinterRawOStream DP(errs());
117117 static unsigned OptLevel = 2;
118118 // Default parallelism of 0 used to indicate that user did not specify.
119119 // Actual parallelism default value depends on implementation.
120 // Currently only affects ThinLTO, where the default is the
121 // hardware_concurrency.
120 // Currently only affects ThinLTO, where the default is
121 // llvm::heavyweight_hardware_concurrency.
122122 static unsigned Parallelism = 0;
123123 // Default regular LTO codegen parallelism (number of partitions).
124124 static unsigned ParallelCodeGenParallelismLevel = 1;
1919 #include "llvm/LTO/LTO.h"
2020 #include "llvm/Support/CommandLine.h"
2121 #include "llvm/Support/TargetSelect.h"
22 #include "llvm/Support/Threading.h"
2223
2324 using namespace llvm;
2425 using namespace lto;
5152 "distributed backend case"));
5253
5354 static cl::opt Threads("-thinlto-threads",
54 cl::init(thread::hardware_concurrency()));
55 cl::init(llvm::heavyweight_hardware_concurrency()));
5556
5657 static cl::list SymbolResolutions(
5758 "r",