[PATCH] D36607: [Support/Parallel] - Do not spawn thread for single/last task.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 11 08:20:47 PDT 2017
grimar added a comment.
In https://reviews.llvm.org/D36607#839160, @ruiu wrote:
> It is broken. The taskgroup should not spawn more threads than the number of physical cores however it is used. It is intended to be a thread-pool, and spawning threads per task is nonsense.
Ah, in that sense you're right I think. It even has comment about that:
// TaskGroup has a relatively high overhead, so we want to reduce
// the number of spawn() calls. We'll create up to 1024 tasks here.
// (Note that 1024 is an arbitrary number. This code probably needs
// improving to take the number of available cores into account.)
But still - for our case it spawn single thread 65k times, not 65k threads at once.
And we can simply avoid that.
So it does not spawn more threads than the number of cores for case I am trying to fix.
More information about the llvm-commits