[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 12:17:41 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa8788de1c3f3: [ELF] Cap parallel::strategy to 16 threads when --threads= is unspecified (authored by MaskRay).

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.515429.patch
Type: text/x-patch
Size: 990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230420/670f3eaf/attachment.bin>


More information about the llvm-commits mailing list