[lld] 187a355 - Revert D147493 "[ELF] Cap parallel::strategy to 16 threads when --threads= is unspecified"

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 09:49:27 PDT 2023


Author: Fangrui Song
Date: 2023-04-20T09:49:22-07:00
New Revision: 187a35527d8364994e5acf0a528a758adbd617ac

URL: https://github.com/llvm/llvm-project/commit/187a35527d8364994e5acf0a528a758adbd617ac
DIFF: https://github.com/llvm/llvm-project/commit/187a35527d8364994e5acf0a528a758adbd617ac.diff

LOG: Revert D147493 "[ELF] Cap parallel::strategy to 16 threads when --threads= is unspecified"

This reverts commit da68d2164efcc1f5e57f090e2ae2219056b120a0.

This change is correct, but left a `config->threadCount` use that is error-prone
and may harm performance when parallel::strategy.compute_thread_count() > 16.

Added: 
    

Modified: 
    lld/ELF/Driver.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 5ba5eab233550..c540f573aaef9 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1420,12 +1420,8 @@ static void readConfigs(opt::InputArgList &args) {
     config->mllvmOpts.emplace_back(arg->getValue());
   }
 
-  config->threadCount = parallel::strategy.compute_thread_count();
-
   // --threads= takes a positive integer and provides the default value for
-  // --thinlto-jobs=. If unspecified, cap the number of threads since
-  // overhead outweighs optimization for used parallel algorithms for the
-  // non-LTO parts.
+  // --thinlto-jobs=.
   if (auto *arg = args.getLastArg(OPT_threads)) {
     StringRef v(arg->getValue());
     unsigned threads = 0;
@@ -1434,12 +1430,10 @@ static void readConfigs(opt::InputArgList &args) {
             arg->getValue() + "'");
     parallel::strategy = hardware_concurrency(threads);
     config->thinLTOJobs = v;
-  } else if (config->threadCount > 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();
+  config->threadCount = parallel::strategy.compute_thread_count();
 
   if (config->ltoPartitions == 0)
     error("--lto-partitions: number of threads must be > 0");


        


More information about the llvm-commits mailing list