[PATCH] D76240: [Sanitizers][Test] If the default linker is LLD, disable threads

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 17 11:16:57 PDT 2020


MaskRay added a comment.

In D76240#1926220 <https://reviews.llvm.org/D76240#1926220>, @nemanjai wrote:

> In D76240#1925329 <https://reviews.llvm.org/D76240#1925329>, @MaskRay wrote:
>
> > The -Wl,--no-threads logic seems test machine specific. Shouldn't a site-wise configuration file added somewhere on the test machine to adapt the behavior of lit substitutions? I don't know how to do that, though. lit.site.cfg.py files are generated in the build directory. They are not used for customization.
>
>
> I don't really understand this comment. In what way is this machine-specific? If each instance of `lld` will spawn `n` threads and lit will fork off as many processes as there are CPU's reported by the system - call this number `m`, then there will be up to `n * m` threads spawned at the same time. On my machine (which I don't imagine is unique), `m == 192` and if I am interpreting the comment in `Parallel.h` correctly, `n == 1024` which makes the upper limit on any similar machine `196608` threads.


This interpretation is not correct. 1024 is the block size in the parallel loop implementation. 1024 is not the number of threads.

The number of threads on Linux is `llvm::hardware_concurrency`.  It is roughly:

  if (sched_getaffinity(0, sizeof(Set), &Set))
      return CPU_COUNT(&Set);

For lld, I think `--threads={0,1,2,...}` is better than the current `--(no-)threads`. I can take a stab to implement it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76240





More information about the llvm-commits mailing list