This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Autoparallelization
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, dnovillo at redhat dot com, sebastian dot pop at cri dot ensmp dot fr
- Date: Fri, 29 Sep 2006 09:49:28 +0200
- Subject: Re: Autoparallelization
- References: <20060927210927.GA30121@atrey.karlin.mff.cuni.cz> <20060929065513.GP20982@devserv.devel.redhat.com>
Hello,
> On Wed, Sep 27, 2006 at 11:09:27PM +0200, Zdenek Dvorak wrote:
>
> + /* Or loops that roll too little. */
> + || expected_loop_iterations (loop) <= n_threads
>
> Shouldn't there be some (big) additive constant added to n_threads
> here and/or some estimation of each iteration's execution time?
the parallelized version is only used if the number of iterations is at
least (MIN_PER_THREAD * N_THREADS), see gen_parallel_loop, where
MIN_PER_THREAD is currently set to 100. This may be replaced by some
more appropriate heuristics later.
Zdenek
> The startup overhead can be quite big, especially in the first parallelized
> loop (threads have to be started etc.), but even in subsequent loops you
> need to wake up all the threads and then wait for all of them to finish,
> in both cases that means a bunch of thread synchronization primitives.
> for (int i = 0; i < 50; i++)
> mem[i] = i++;
> isn't a good auto-parallelization example, while
> for (int i = 0; i < 50; i++)
> call_some_very_expensive_function (i);
> can be, or
> for (int i = 0; i < 10000000; i++)
> mem[i] = i++;
> probably is.
>
> Jakub