[OG10] Fortran: delinearize multi-dimensional array accesses
Thomas Koenig
tkoenig@netcologne.de
Sat Dec 26 10:41:32 GMT 2020
Hi Sandra,
> The attached patch implements delinearization of array accesses in the
> Fortran front end, something that has been discussed for a long time.
Definitely - among others, this is the subject of PR 14741, which is by
now quite historic.
> I've been asked to try to get this patch committed on the OG10 branch
> since it is blocking some further optimization work with Graphite for
> OpenACC kernels regions. I have a mainline version of this patch as
> well that I can send to anyone interested in trying it out, but TBH, I
> don't think this is ready for mainline yet.
That would be indeed interesting. Could you post that to the list as
well?
The current status is that
> there are still two gfortran tests that are regressing
> (gfortran.dg/graphite/id-9.f and
> gfortran.dg/vect/fast-math-mgrid-resid.f), and while it's been confirmed
> that this helps with Graphite optimizations as intended, we haven't yet
> run any benchmarks to confirm that it doesn't make other things slower.
It is probably too late; this could go in for the next stage 1.
> (It might, for instance, be appropriate to only delinearize when
> Graphite optimizations are also enabled.)
Makes sense.
Does the patch actually make loop interchange for matrix multiplication
work (done with C for loops or Fortran DO loops), or is there additional
work required?
Regarding scalarized loops: We still to not collapse loops for
subroutine foo(a)
real, dimension(:,:), contiguous :: a
a = 5.
end subroutine foo
so an extension to scalarized loops would be quite valuable.
It would be interesting to see if
subroutine foo(a,n,m)
real, dimension(n,m) :: a
do j=1,m
do i=1,n
a(i,j) = 5.
end do
end do
end subroutine foo
is collapsed to a single loop with the patch and Graphite.
Best regards
Thomas
More information about the Gcc-patches
mailing list