Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Apparent vectorizer bug

Stuart_M
Beginner
1,290 Views

The code block below appears to generate bad code when the automatic vectorizer is enabled but correct code when /Qvec- is used even up to /O3 optimization. The vectorizer does not track N properly so that the values of RD for N=5-8 are repeated for N=9-12 followed by the values expected for N=9 and up.

[fortran]N = 0
R = RFI
DO I = 1, M1B
  K = M2(I)
  DR = DROD*F(I)
  DO J = 1, K
    R = R + DR
    N = N + 1
    RD(N) = R
    R = R + DR
  END DO
END DO[/fortran]

Adding a PRINT statement in the inner loop (which probably disables vectorization) also eliminates the incorrect behavior.

This occurs running Intel(R) Composer XE 2013 Update 5 (package 198). I am downloading SP1 and will try that.

If this is a confirmed bug it would be great to have it reported formally.

Thanks,
Stuart

0 Kudos
12 Replies
Stuart_M
Beginner
1,290 Views

The issue is still present with 14.0 in SP1.

0 Kudos
Steven_L_Intel1
Employee
1,290 Views

Complete example, please. Excerpts and paraphrases are not helpful in analysis.

0 Kudos
Stuart_M
Beginner
1,290 Views

OK, here it is boiled down to a simple program that shows the bug.

[fortran]PROGRAM vectorizer_bug

  INTEGER :: J, N
  REAL(8) :: DR, R, RD(7)

  N = 0
  R = 10.0
  DR = 2.0
  DO J = 1, 7
    R = R + DR
    N = N + 1
    RD(N) = R
    R = R + DR
  END DO

  PRINT *, RD

END PROGRAM[/fortran]

Built with ifort /O3 /Qvec- it outputs this as it should:
   12.0000000000000        16.0000000000000        20.0000000000000
   24.0000000000000        28.0000000000000        32.0000000000000
   36.0000000000000

Built with ifort /O3 it outputs this:
   12.0000000000000        16.0000000000000        20.0000000000000
   24.0000000000000        28.0000000000000        32.0000000000000
   24.0000000000000
where the last value is wrong.

Running: Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.0.103 Build 20130728

0 Kudos
Steven_L_Intel1
Employee
1,290 Views

Thanks - I can reproduce the problem and will investigate. I see the same results going back to 12.1, at least.

0 Kudos
Steven_L_Intel1
Employee
1,290 Views

Escalated as issue DPD200248081. Thanks for the nice example.

0 Kudos
lklawrie
Beginner
1,290 Views

Steve,

Is there any work around for this?  And, this is not just the 14 compiler, correct?  The bug goes back farther than that?

0 Kudos
Steven_L_Intel1
Employee
1,290 Views

Yes, I can see the problem in 13.1 and 12.1. I did not try other versions. Disabling vectorization is the best workaround. The developers are analyzing the issue now.

0 Kudos
Steven_L_Intel1
Employee
1,290 Views

The developers figured out what is going wrong and are working on a fix. It turns out that we have a couple of other reports with varying symptoms that end up being the same bug. I will let you know of further progress.

0 Kudos
Andrew_Smith
Valued Contributor I
1,290 Views

This error has made me wary of using AVX in released code so I have turned it off for now. Is a fix coming in the next update ?

0 Kudos
Steven_L_Intel1
Employee
1,290 Views

Actually, it looks as if it was fixed in Update 1, released in October. I missed the notice of the fix. Let me know if you find otherwise.

0 Kudos
Stuart_M
Beginner
1,290 Views

The test code runs correctly when built with 14.0.1.139 Build 20131008 but not with the current 13.1 version, 13.1.3.198 Build 20130607.

Questions:

  • Will the fix be back-ported to 13.1 (and earlier) compilers?
  • Do you believe that the vectorizer is fixed/safe in general now for the 14.0.1 C++ and Fortran compilers?
0 Kudos
Steven_L_Intel1
Employee
1,290 Views

We don't backport fixes except under extraordinary circumstances, and we have no planned further updates to 13.1.

We believe the vectorizer to be safe to use - and we did before, as our extensive testing did not reveal problems. But there are no guarantees.

0 Kudos
Reply