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

Diagnostic 15143: loop was not vectorized: loop was transformed to memset or memcpy

$
0
0

Cause: 

When a code contains a loop or array syntax performing a simple initialization or a copy, the compiler may replace the loop with a function call to either set memory (memset) or copy memory (memcpy).  It is usually more efficient to replace these simple operations with a memset or memcpy function call. This diagnostic informs us when the compiler has chosen to call a function to replace the loop or array syntax. 

Example:

program f15143
implicit none
integer, parameter :: N=32
integer :: i,a(N)
  !...initialize array using DO
  do i=1,N
    a(i) = 0
  end do
  a = 0   !...same, with array syntax 
  print*, a(1)

end program f15143

ifort -vec-report2 f15143.f90
f15143.f90(6): (col. 3) remark: loop was not vectorized: loop was transformed to memset or memcpy
f15143.f90(9): (col. 3) remark: loop was not vectorized: loop was transformed to memset or memcpy

Solution:  It is usually beneficial (performance) to replace simple initialization or copy operations with function calls.  However, if you suspect the functions are not efficient in your case, you can disable this optimization with the compiler option -nolib-inline

$ ifort -nolib-inline -vec-report2 f15143.f90
f15143.f90(6): (col. 3) remark: LOOP WAS VECTORIZED
f15143.f90(9): (col. 3) remark: LOOP WAS VECTORIZED

Back to the list of vectorization diagnostics for Intel Fortran


Viewing all articles
Browse latest Browse all 3384

Trending Articles



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