Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Diagnostic 15003: PARTIAL LOOP WAS VECTORIZED (Fortran)

$
0
0

Cause:

This message is emitted when only part of the loop body is vectorized. The loop is distributed (divided) into two loops, one of which is vectorized and one of which is not.

Example:

subroutine d_15003(a,b,n)
  implicit none
  integer, intent(out), dimension(n) :: a,b
  integer, intent(in )               :: n
  integer                            :: i,j

  j=1
  do i=1,n
     a(i) = i
     b(i) = j
     j = mod(j+1,12)
  enddo

end subroutine d_15003

ifort -c -vec-report2 d_15003_1.f90

d_15003_1.f90(8): (col. 3) remark: PARTIAL LOOP WAS VECTORIZED
d_15003_1.f90(8): (col. 3) remark: loop was not vectorized: existence of vector dependence
 

Additional information:

You can see how the compiler split up the loop by looking at the optimization report:

ifort -c -vec-report2 d_15003_1.f90 -opt-report-phase hlo

d_15003_1.f90(8): (col. 3) remark: PARTIAL LOOP WAS VECTORIZED
d_15003_1.f90(8): (col. 3) remark: loop was not vectorized: existence of vector dependence
.....
High Level Optimizer Report (d_15003_)
LOOP DISTRIBUTION in d_15003_ at line 8
LOOP DISTRIBUTION in d_15003_ at line 8
LOOP DISTRIBUTION in d_15003_ at line 8
 

The generated code is equivalent to the following:

subroutine d_15003(a,b,n)
  implicit none
  integer, intent(out), dimension(n) :: a,b
  integer, intent(in )               :: n
  integer                            :: i,j

  j=1
  do i=1,n
     a(i) = i
  enddo     
  do i=1,n
     b(i) = j
     j = mod(j+1,12)
  enddo

end subroutine d_15003
ifort -c -vec-report3 d_15003_2.f90
d_15003_2.f90(8): (col. 3) remark: LOOP WAS VECTORIZED
d_15003_2.f90(11): (col. 3) remark: loop was not vectorized: existence of vector dependence
d_15003_2.f90(13): (col. 6) remark: vector dependence: assumed ANTI dependence between j line 13 and j line 13
d_15003_2.f90(13): (col. 6) remark: vector dependence: assumed FLOW dependence between j line 13 and j line 13
d_15003_2.f90(13): (col. 6) remark: vector dependence: assumed FLOW dependence between j line 13 and j line 12
d_15003_2.f90(12): (col. 6) remark: vector dependence: assumed ANTI dependence between j line 12 and j line 13
 

The second loop is not vectorized because the statement j=mod(j+1,12) introduces a dependency between loop iterations.

Back to the list of vectorization diagnostics for Intel Fortran

  • Developers
  • Apple OS X*
  • Linux*
  • Microsoft Windows* (XP, Vista, 7)
  • Microsoft Windows* 8
  • Fortran
  • Intel® Composer XE
  • Intel® Fortran Compiler
  • Intel® Fortran Composer XE
  • Intel® Visual Fortran Composer XE
  • Intel® Fortran Studio XE
  • Intel® Parallel Studio XE
  • Development Tools
  • Vectorization
  • URL

  • Viewing all articles
    Browse latest Browse all 3270

    Trending Articles



    <script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>