Vectorizing HIRLAM 4: complicated access patterns examined.
Toon Moene
toon@moene.indiv.nluug.nl
Fri Oct 21 13:40:00 GMT 2005
L.S.,
This code:
SUBROUTINE S(N)
DIMENSION A(N), B(N)
READ*,ISTART,ISTOP,B
DO I = ISTART, ISTOP
A(I) = B(I)
ENDDO
PRINT*,A
END
when compiled thusly:
$ gfortran -g -S -O3 -ftree-vectorize -ftree-vectorizer-verbose=2 -msse2 vect4.f
draws the following "not vectorized" message:
vect4.f:4: note: not vectorized: complicated access pattern.
vect4.f:4: note: vectorized 0 loops in function.
This sort of coding is rather prevalent in HIRLAM, especially in the
interesting inner loops. One needs this when not all of the inner area
is accessible / computable by the code at hand (for instance because there
are inaccessible "halo's" around the subarea that have to be treated
specially).
The funny thing is that replacing ISTART with a constant makes this loop
vectorizable. So what's the fundamental difference (as far as vectorizing
is concerned) between a constant and a loop invariant :-) ?
Kind regards,
--
Toon Moene - e-mail: toon@moene.indiv.nluug.nl - phone: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/
More information about the Fortran
mailing list