[PATCH] D102633: [clang-scan-deps] Improvements to thread usage

Alexandre Ganea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 21 06:08:09 PDT 2021


aganea added a subscriber: mehdi_amini.
aganea added a comment.

In D102633#2769762 <https://reviews.llvm.org/D102633#2769762>, @arphaman wrote:

> It might be good for @aganea to take a look as well.

Thanks! I actually work with @saudi, I already took a look at the patch before uploading. However I'm stil torn about running one of the workers on the main thread. I fear that we could have random errors because of the stack size of the "main" thread that could be different from the stack size of the "satellite" threads. There's 99.99% chance that this won't happen, but I'd prefer that behavior to be explicit.

We could have:

  -j0 : use all hardware threads
  -j1: don't use multi-threading, run all the tasks on the main thread
  -jN: use the specified number of threads

The rationale is that we're using clang-scan-deps as-a-DLL in Fastbuild, to extract the dependencies. Since Fastbuild already has its own thread pool management, we call into clang-scan-deps with -j1 from different Fastbuild threads (but keeping the `DependencyScanningService` alive between calls). It would great if each call to clang-scan-deps wouldn't create a extra new thread.

Perhaps any of you would like to comment? + at mehdi_amini


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102633



More information about the cfe-commits mailing list