This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] [parloop branch] Supporting reductions for automatic parallelization
- From: Razya Ladelsky <RAZYA at il dot ibm dot com>
- To: "Daniel Berlin" <dberlin at dberlin dot org>
- Cc: gcc-patches at gcc dot gnu dot org, "Zdenek Dvorak" <rakdver at kam dot mff dot cuni dot cz>
- Date: Mon, 20 Aug 2007 15:57:27 +0300
- Subject: Re: [RFC] [parloop branch] Supporting reductions for automatic parallelization
"Daniel Berlin" <dberlin@dberlin.org> wrote on 20/08/2007 14:50:04:
> Note that in the above, it is not the fact that all variables are
> named "sum" that make this a reduction.
> I could write it
>
> L0:
> sum_0 = phi (0, foo_37)
> ...
>
> foo_37 = sum_0 + something
> (goto L0)
>
> and it would still be a reduction.
>
No, not all varibales have to be named the same, but there is one
variable which is the reduction variable, isn't there? does it even
make sense to have a "reduction variable", which would actually be the
variable accumulating the values (or holding any other reduction result)?
(in this case, it would be foo)
So What I mean is, that each reduction can be reduced to
L0:
old_value = phi <reduction_ssa, inial_value>
reduction_ssa = old_value + something
goto L0
and SSA_NAME_VAR (reduction_ssa) is the reduction variable.
Is that true, or is this an aqward way of looking at it?
> You can detect all these reductions by using an SCC finding algorithm
> on the SSA graph.
>
> All reductions will form a cycle in the SSA graph. You then simply
> need to see if the operations involved in the cycle form a reduction
> form you can support.
>
> This is 100% guaranteed to find *all* these simple types of
> reductions, regardless of name.
>
> We have code to do this kind of cycle finding on the SSA graph in
> tree-ssa-sccvn.c
>
> > Currently I am dealing only with simple reduction patterns, that
> > are identified by vect_is_simple_reduction, which is looking for
> > the reduction in a (single block)loop in the following way:
> >
> > L0:
> > x_i = phi (x_j, x_k)
> > ...
> >
> > x_g = x_i + something
> > (goto L0)
> >
> > Where the "+" represents a reduction operation.
> >
> > More complicated patterns are not identified at the moment, and
hopefully
> > can be reduced to this form for easier handling.
> >
> > Is my conception wrong?
>
> What makes you think the names matter?