[PATCH] D147493: [ELF] Cap parallel::strategy to 16 threads when --threads= is unspecified
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 20 09:54:15 PDT 2023
MaskRay updated this revision to Diff 515369.
MaskRay added a comment.
Keep `config->threadCount` assignment below to avoid a pitfall that `config->threadCount` may be larger than the available concurrency.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147493/new/
https://reviews.llvm.org/D147493
Files:
lld/ELF/Driver.cpp
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -1421,7 +1421,9 @@
}
// --threads= takes a positive integer and provides the default value for
- // --thinlto-jobs=.
+ // --thinlto-jobs=. If unspecified, cap the number of threads since
+ // overhead outweighs optimization for used parallel algorithms for the
+ // non-LTO parts.
if (auto *arg = args.getLastArg(OPT_threads)) {
StringRef v(arg->getValue());
unsigned threads = 0;
@@ -1430,6 +1432,9 @@
arg->getValue() + "'");
parallel::strategy = hardware_concurrency(threads);
config->thinLTOJobs = v;
+ } else if (parallel::strategy.compute_thread_count() > 16) {
+ log("set maximum concurrency to 16, specify --threads= to change");
+ parallel::strategy = hardware_concurrency(16);
}
if (auto *arg = args.getLastArg(OPT_thinlto_jobs_eq))
config->thinLTOJobs = arg->getValue();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147493.515369.patch
Type: text/x-patch
Size: 990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230420/9747d90e/attachment.bin>
More information about the llvm-commits
mailing list