Quantcast
Channel: 中级
Viewing all articles
Browse latest Browse all 669

Diagnostic 15344: Loop was not vectorized: vector dependence prevents vectorization

$
0
0

Product Version: Intel(R) Visual Fortran Compiler XE 15.0.0.070

Cause:

When using Intel Visual Fortran Compiler's optimization and vectorization report options  -O2 -Qvec-report2 -Qopt-report:2 the vectorization report generated states that loop was not vectorized since vector dependence prevents vectorization.  

Example:

An example below will generate the following remark in optimization report:

integer function foo(a, n)
    implicit none
    integer, intent(in) :: n
    real, intent(inout) :: a(n)
    real :: max
    integer :: inx, i

    max = a(0)
    do i=1,n
        if (max < a(i)) then
            max = a(i)
            inx = i*i
        endif
    end do

    foo = inx

end function

Report from: Vector optimizations [vec]

LOOP BEGIN at  f15344.f90(9,5)
   remark #15344: loop was not vectorized: vector dependence prevents vectorization. First dependence is shown below. Use level 5 report for details   [ f15344.f90(12,13) ]
   remark #15346: vector dependence: assumed ANTI dependence between  line 10 and  line 10   [ f15344.f90(12,13) ]
LOOP END

Resolution:

Rewriting the code as in the following example will resolve vector dependence and the loop will be vectorized

integer function foo(a, n)
    implicit none
    integer, intent(in) :: n
    real, intent(inout) :: a(n)
    real :: max
    integer :: inx, i

    max = a(0)
    do i=1,n
        if (max < a(i)) then
            max = a(i)
            inx = i
        endif
    end do

    foo = inx*inx

end function

See also:

Requirements for Vectorizable Loops

Vectorization Essentials

Vectorization and Optimization Reports

Back to the list of vectorization diagnostics for Intel Fortran

 

 

 

  • Intel Compilers Vectorization Reports Optimization Reports
  • 开发人员
  • 英特尔 AppUp® 开发人员
  • 教授
  • 学生
  • Apple OS X*
  • Linux*
  • Microsoft Windows* (XP, Vista, 7)
  • Microsoft Windows* 8
  • Windows*
  • Fortran
  • 高级
  • 中级
  • 英特尔® Integrated Native Developer Experience(英特尔® 集成原生开发人员体验)
  • Intel® Fortran Compiler
  • 英特尔® Fortran Composer XE
  • 英特尔® Parallel Composer
  • 英特尔® Visual Fortran Composer XE
  • 英特尔® Fortran Studio XE
  • 英特尔® Integrated Native Developer Experience Build Edition(适用 OS X*)
  • 英特尔® Parallel Studio
  • 英特尔® Parallel Studio XE
  • 英特尔® Parallel Studio XE Cluster Edition
  • 英特尔® Parallel Studio XE Composer Edition
  • 英特尔® Parallel Studio XE Professional Edition
  • URL
  • 编译器主题
  • 提升性能
  • 主题专区: 

    IDZone
  • Windows*

  • Viewing all articles
    Browse latest Browse all 669

    Trending Articles



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