[lld] r287042 - Use one task per iteration in parallel_for_loop.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 09:03:44 PST 2016


On Wed, Nov 16, 2016 at 8:51 AM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> On 16 November 2016 at 11:36, Rui Ueyama <ruiu at google.com> wrote:
> > I think it is not beautiful to take care of granularity of tasks on
> caller
> > side, and it can be resolved with this. It works for me. What do you
> think?
>
> I really don't think we can handle this is the callee. The question of
> what is a reasonable task is very dependent on the caller and an api
> like parallel_for_each should not be trying to do aggregation.
>

I think I don't understand the point. This is a parallel_for_each. We know
the exact number of tasks from the beginning, so we can compute how many
tasks each core will take beforehand.

Let's say we have 10,000 tasks and 10 cores. Then we know we should assign
1,000 tasks for each core at the beginning, so we can spawn 10 threads and
give 1,000 tasks for each thread. Why doesn't this work?

(In reality, each job is probably not the same weight, so we want to
over-split tasks by, say, 10x, to maximize core utilization. In the
attached patch, I split given tasks up to 1024 tasks.)

Did you try my patch?


> This is specially true when we have completely different code for MSVC
> and for other compilers.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161116/42116674/attachment.html>


More information about the llvm-commits mailing list