Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

Diagnostic 15015: loop was not vectorized: unsupported data type (Fortran)

$
0
0

Cause:

The vectorizer does not support certain data types because there is no corresponding SIMD instruction. For example, the compiler supports REAL(16) arithmetic (quad precision) through a software implementation, but is unable to vectorize it:

subroutine d_15015_1(a,b,n)
   implicit none
   real(16), dimension(n), intent(in ) :: a
   real(16), dimension(n), intent(out) :: b
   integer,                intent(in ) :: n
   integer                             :: i 
   
   do i=1,n
      b(i) = a(i)**3
   enddo
   
end subroutine d_15015_1
> ifort -vec-report2 -c d_15015_1.f90
d_15015_1.f90(9): (col. 7) remark: loop was not vectorized: unsupported data type
 

By default, the compiler is unable to vectorize loops containing complex double precision variables, because an SSE register can only contain a single data element:

subroutine d_15015_2(a,b,n)
   implicit none
   complex(8), dimension(n), intent(in ) :: a
   complex(8), dimension(n), intent(out) :: b
   integer,                  intent(in ) :: n
   integer                               :: i 
   
   do i=1,n
      b(i) = 1. / sqrt(1.+a(i)**2)
   enddo
   
end subroutine d_15015_2
>ifort -vec-report2 -c d_15015_2.f90
d_15015_2.f90(8): (col. 4) remark: loop was not vectorized: unsupported data type
 

Resolution: Only use quad precision variables in places where the extra precision is really required, such as in calculations where they may be large cancellations. The first example will vectorize if it is written in double precision. Loops containing double precision complex variables can be vectorized using instruction sets that support wider vectors. The second example can be vectorized for systems supporting Intel® Advanced Vector Extensions (Intel® AVX) by compiling with the option /QxAVX (Windows*) or -xavx (Linux* or OS X*):

> ifort -xavx -vec-report2 -c d_15015_2.f90
d_15015_2.f90(8): (col. 4) remark: LOOP WAS VECTORIZED

Back to the list of vectorization diagnostics for Intel Fortran


Viewing all articles
Browse latest Browse all 3384

Trending Articles