[PATCH] D115019: ThreadPool: grow the pool only as needed
Mehdi AMINI via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 2 20:00:55 PST 2021
mehdi_amini added a comment.
> particularly as the ThreadPool is created even with -mlir-disable-threading.
I'm fairly sure I fixed this one or two months ago, at least the C++ API allows to setup a project without starting a ThreadPool at all. This was a bottleneck in TensorFlow for some small MLIR work we're doing there.
There might be some similar plumbing we could do in how we handle `--mlir-disable-threading` with `mlir-opt` as well, since it is a testing tool we haven't tried to "optimize" this kind of things (you're making a good case for it though!).
That said, I like this change to lazily create thread as we go: so that even in cases where I want parallelism, I won't create more threads than actually needed!
================
Comment at: llvm/lib/Support/ThreadPool.cpp:27
+ return;
+ }
+ if (ActiveThreads + Tasks.size() <= Threads.size()) {
----------------
Nit: remove trivial braces
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115019/new/
https://reviews.llvm.org/D115019
More information about the llvm-commits
mailing list