This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Graphite and Loop fusion.
- From: Sebastian Pop <sebpop at gmail dot com>
- To: Toon Moene <toon at moene dot org>
- Cc: gcc mailing list <gcc at gcc dot gnu dot org>
- Date: Mon, 30 Nov 2009 15:14:35 -0600
- Subject: Re: Graphite and Loop fusion.
- References: <4B142252.6010405@moene.org>
Hi Toon,
On Mon, Nov 30, 2009 at 13:51, Toon Moene <toon@moene.org> wrote:
> Sebastian,
>
> I saw you updated the Graphite Wiki page, and I wondered if there are any
> concrete plans on loop fusion.
>
> The reason I ask is because in Fortran (as of Fortran 90) one often sees
> assignments like:
>
> REAL, ALLOCATABLE :: ÂA(:,:), B(:,:), C(:,:), D(:,:), E(:,:), F(:,:)
>
> ! ... READ IN EXTEND OF ARRAYS ...
>
> READ*,N
>
> ! ... ALLOCATE ARRAYS
>
> ALLOCATE(A(N,N),B(N,N),C(N,N),D(N,N),E(N,N),F(N,N))
>
> ! ... READ IN ARRAYS
>
> READ*,A,B
>
> C = A + B
> D = A * C
> E = B * EXP(D)
> F = C * LOG(E)
>
> where the four assignments all have the structure of loops like:
>
> DO I = 1, N
> Â DO J = 1, N
> Â Â ÂX(J,I) = OP(A(J,I), B(J,I))
> Â ENDDO
> ENDDO
>
> Obviously, this could benefit from loop fusion, by combining the four
> assignments in one loop.
>
> Is that on the horizon ?
>
Yes, that's for gcc-4.6. We just need a good heuristic based on
temporal locality: i.e. Graphite could code generate this loop fusion
already in 4.5 but there is no driver that would ask for these stmts
to be part of the same loop nest, so we need a good heuristic for it.
The idea behind the heuristic is simple: detect the connected
components of the data dependence graph, and then reduce the distance
in between the members of the same component.
Sebastian