This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Autoparallelization


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]