Apparent vectorizer bug

Apparent vectorizer bug

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.

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

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

publicaciones de 13 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

The issue is still present with 14.0 in SP1.

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

Steve - Intel Developer Support

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

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

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

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

Steve - Intel Developer Support

Escalated as issue DPD200248081. Thanks for the nice example.

Steve - Intel Developer Support

Steve,

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

Linda

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.

Steve - Intel Developer Support

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.

Steve - Intel Developer Support

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 ?

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.

Steve - Intel Developer Support

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?

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.

Steve - Intel Developer Support

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya