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

Matrix assignment vectorization creates bad code with ifort 9.1 -- still present in current version?

beelzebug
Beginner
666 Views

Hi,

attached code shows miscompilation with the Intel Fortran compiler, version 9.1 (as my institution did not purchase a newer version, don't know if it ever will) on GNU/Linux, x86-64 platform (Xeon E5345). Short: With two arrays defined like

[fortran]real(kind=8), dimension(1,1,3,3) :: simple
real(kind=8), dimension(3,3) :: totallysimple

[/fortran]

the following assignment only repeats the first value instead of copying the whole 2D array section:

[bash]totallysimple = simple(1,1,:,:)[/bash]

This is the case when building with -fast ... adding -C, or just building with default optimization prevents vectorization of this statement and thus produces correct output (please refer to the attached source).

Now, this clearly looks like a compiler bug to me. A big question is: Is it still a bug in a current version of the compiler?

Would be nice if someone here could test this (I might do that when accessing a private compiler with a personal copy of the compiler, but that won't happen soon and before I forget to report this, I rather have the thread opened here).

If my code is buggy, I would like to know, too, of course. In any case, I am really struggling to get my model code done and it doesn't help to keep finding bugs in the compilers (this is not the first by far...). So, if my code is wrong, that would also be a relief:-/

0 Kudos
4 Replies
Steven_L_Intel1
Employee
665 Views

I tried with 11.1.069 on an Intel 64 platform and it seemed to work correctly.

[plain][sblionel@f90srv34 ~]$ ifort -fast -opt_report 2 intel_metamatrix_bug.f90
 

  UNREF VAR REMOVAL ROUTINE-SYMTAB (MAIN__): VARS(1), PACKS (1) 
 
  UNREF VAR REMOVAL ROUTINE-SYMTAB (test_algebra_IP_matrix_out_): VARS(1), PACKS (1) 
 
  UNREF VAR REMOVAL ROUTINE-SYMTAB (test_algebra_IP_test_meta_): VARS(9), PACKS (9) 
 
ipo: remark #11001: performing single-file optimizations
 

  VAR ADDRESS: VARS (2) PACKS (2) 
 
 

  UNREF VAR REMOVAL: MODULE-SYMTAB: VARS(2), PACKS (2) 
 
 

  VAR ADDRESS: VARS (2) PACKS (2) 
 
 

  ROUTINE ATTRIBUTE PROPAGATION TOTALS: 
 
      RDECL: NSE(0->0), AR(0->0)
      ENTRY: SE(0->0), DSE(0->0), AR(0->0)
 
 
 

  CI-MOD: TOTAL(3): OTHER(3) 
 
  CI-REF: TOTAL(3): OTHER(3) 
 
  CS-MOD: TOTAL(3): BOTTOM(3) 
 
ipo: remark #11005: generating object file /tmp/ipo_ifortxp5wKt.o
 

WHOLE PROGRAM (SAFE) [EITHER METHOD]: TRUE
 
WHOLE PROGRAM (SEEN) [TABLE METHOD]: TRUE
 
WHOLE PROGRAM (READ) [OBJECT READER METHOD]: TRUE
 
INLINING OPTION VALUES:
  -inline-factor: 100
  -inline-min-size: 30
  -inline-max-size: 230
  -inline-max-total-size: 2000
  -inline-max-per-routine: disabled
  -inline-max-per-compile: disabled
 
 

INLINING REPORT: (MAIN__) [1/3=33.3%]
 
  -> INLINE: test_algebra_IP_test_meta_(6) (isz = 257) (sz = 260 (117+143))
    -> for_write_seq_lis(EXTERN)
    -> INLINE: test_algebra_IP_matrix_out_(8) (isz = 61) (sz = 66 (28+38))
      -> __resetsp_inlined(EXTERN)
      -> for_write_seq_lis(EXTERN)
      -> _alloca(EXTERN)
      -> __getsp_inlined(EXTERN)
    -> for_write_seq_lis(EXTERN)
    -> INLINE: test_algebra_IP_matrix_out_(7) (isz = 61) (sz = 66 (28+38))
      -> __resetsp_inlined(EXTERN)
      -> for_write_seq_lis(EXTERN)
      -> _alloca(EXTERN)
      -> __getsp_inlined(EXTERN)
  -> for_set_reentrancy(EXTERN)
 
 

  SUBSTITUTION: TOTAL(22): REPLACE(13) REMOVE(7) ADDR-TAKEN-OFF(2) 
 
 

  DATA PROMOTION: PROMOTED(2)
 
 

  UNREF VAR REMOVAL: MODULE-SYMTAB (PROMOTED): VARS(2), PACKS (2) 
 
 
HPO VECTORIZER REPORT (MAIN__) LOG OPENED ON Wed Mar  3 13:20:32 2010
 
 

HPO Vectorizer Report (MAIN__)
 
intel_metamatrix_bug.f90(27:6-27:6):VEC:MAIN__:  LOOP WAS VECTORIZED
LOOP WAS VECTORIZED
LOOP WAS VECTORIZED
loop was not vectorized: not inner loop
LOOP WAS VECTORIZED
LOOP WAS VECTORIZED
loop was not vectorized: not inner loop
LOOP WAS VECTORIZED
 
HLO REPORT LOG OPENED ON Wed Mar  3 13:20:32 2010
 
 

High Level Optimizer Report (MAIN__)
 
Block, Unroll, Jam Report:
(loop line numbers, unroll factors and type of transformation)
 

Loop at line 27 completely unrolled by 1  
Loop at line 27 completely unrolled by 1  
Loop at line 27 completely unrolled by 1  
Loop at line 27 completely unrolled by 1  
Loop at line 27 completely unrolled by 1  
Loop at line 27 completely unrolled by 1  
 
Loop Collapsing Report:
 

Loops at line:27    and line:27    collapsed
 

DEAD STATIC FUNCTION ELIMINATION: 
  (test_algebra_IP_test_meta_)
  Routine is dead static
 
 

DEAD STATIC FUNCTION ELIMINATION: 
  (test_algebra_IP_matrix_out_)
  Routine is dead static
 
 

  STATIC:   intel_metamatrix_bug.f90  test_algebra_IP_test_meta_
 

  STATIC:   intel_metamatrix_bug.f90  MAIN__
 

  STATIC:   intel_metamatrix_bug.f90  test_algebra_IP_matrix_out_
 

 
      3 FUNCTIONS HAD VALID STATIC PROFILES
 
  IPO CURRENT  QUALITY METRIC:  50.0%
  IPO POSSIBLE QUALITY METRIC:  50.0%
  IPO QUALITY  METRIC RATIO:   100.0%
 
 
[sblionel@f90srv34 ~]$ ./a.out
 simple:
   1.00000000000000        2.00000000000000        3.00000000000000     
   2.00000000000000        3.00000000000000        1.00000000000000     
   3.00000000000000        1.00000000000000        2.00000000000000     
 simple copy
   1.00000000000000        2.00000000000000        3.00000000000000     
   2.00000000000000        3.00000000000000        1.00000000000000     
   3.00000000000000        1.00000000000000        2.00000000000000    [/plain]

0 Kudos
Martyn_C_Intel
Employee
666 Views

Note that you can try out the latest compiler yourself, by downloading an evaluation copy from

http://software.intel.com/en-us/intel-compilers/ and clicking on "evaluate".

The vectorizer is enabled by default in this compiler.

0 Kudos
beelzebug
Beginner
666 Views
Ah, thanks, Steve. So I can assume that it is no current bug anymore. That is a bit reassuring.
0 Kudos
beelzebug
Beginner
666 Views

Hm. Yes... I just thought about the private install I have at home and tried not to bend the license by putting it onto my account at work. But an evaluation version should do the trick, too. So I can continue to do some OpenMP comparisons on the test systems there.

I just filled out the request form. Thanks.

0 Kudos
Reply