Hello,

The following snippet is from a f90 program which contains
a loop that does not get vectorized.

SUBROUTINE foo1(nx,ny,nz,arr2)
USE globalvar_mod, ONLY : dyinv, xstart, xstop

k=1
do j=1,ny
  do i=1,nx

    arr1(i,j,k) = arr2(i,j,k  ) *dyinv

  end do
end do
END SUBROUTINE foo1

The vectorizer failure message is:

        base_address: &dyinv
        offset from base address: 0
        constant offset from base address: 0
        step: 0
        aligned to: 128
        base_object: dyinv
        FAILED as dr address is invariant

test41.f90:24: note: get vectype with 2 units of type real(kind=8)
test41.f90:24: note: vectype: vector real(kind=8)
test41.f90:24: note: not vectorized: unhandled data-ref
test41.f90:24: note: bad data references.
test41.f90:7: note: vectorized 0 loops in function.

I am not familiar with f90 at all; seemingly dyinv is a regular
variable but according to the message in the dump file
it's a reference.

One option to vectorize this loop is to extend the vectorizer's versioning
for aliasing capability to version the loop also in this case.
Other suggestions will be appreciated.

Thanks,
Revital


(See attached file: test41.f90.txt)
MODULE foo_mod
USE parameter_mod, ONLY : rfp

IMPLICIT NONE

PUBLIC foo1

PRIVATE
real(kind=rfp), dimension(:,:,:), allocatable :: arr1

CONTAINS
SUBROUTINE foo1(nx,ny,nz,arr2)
USE globalvar_mod, ONLY : dyinv, xstart, xstop

integer, intent(in) :: nx, ny, nz
real(kind=rfp), intent(inout),                                                &
         dimension(xstart:xstop+1,xstart:xstop+1,xstart:xstop+1) :: arr2

integer :: i, j, k

k=1
do j=1,ny
  do i=1,nx

    arr1(i,j,k) = arr2(i,j,k  ) *dyinv

  end do
end do


END SUBROUTINE foo1

END MODULE foo_mod

Reply via email to