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

Andrew Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 10:49:22 PDT 2023


andrewng accepted this revision.
andrewng added a comment.

LGTM.



================
Comment at: lld/ELF/Driver.cpp:1434
     parallel::strategy = hardware_concurrency(threads);
     config->thinLTOJobs = v;
+  } else if (parallel::strategy.compute_thread_count() > 16) {
----------------
This is the "default" value that I was referring to. I wasn't suggesting that this should be capped. But assuming that this is just passed on to `llvm::heavyweight_hardware_concurrency()`, then it should be fine as is because `llvm::heavyweight_hardware_concurrency()` should sort out any CPU affinity restrictions.

AFAIK, the "heavyweight" version only counts "real" cores and ignores any SMT ones. So on most X86 CPUs it will be half as many threads. Now that some X86 CPUs have a mix of fast and low-power cores, I'm not too sure what "heavyweight" is or should be in these scenarios.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147493/new/

https://reviews.llvm.org/D147493



More information about the llvm-commits mailing list