Hi Toon,

On Mon, Nov 30, 2009 at 13:51, Toon Moene <t...@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

Reply via email to