Possible Vectorization Issue in 14.0.1

Possible Vectorization Issue in 14.0.1

Hello All,

I'm having an issue with a port from ifort 11.1 32-bit to 14.0.1 64-bit on a Linux platform.  In the test case I've attached, the 11.1 compiler with -vec-report3 reports for line 35:

     remark: loop was not vectorized: existence of vector dependence.

In the 14.0.1 compiler, no yea or nay is given about the vectorization of the loop starting on line 35.  This poses no problem in the attached test case as the output is exactly as expected.  I though that perhaps the lack of vector reporting may have something to do with the issue I'm seeing in the code from which the attached test case was derived.  In that code, the analogue of array "x" is set to 6 and 7 in the "condition == .false." branch of the code as well, however in a debugger, the 6 is placed outside the bounds of the array:

   (gdb)  x/2i $rip 
   => ....: movl  $0x6,0x15f04b84(%rdi)
      ....: movl  $0x7,0x15f04b88(%rdi,%rax,4)
   (gdb) p $rdi
   = 64
   (gdb) p $rax
   = 0
   (gdb) p &x
   = (PTR TO -> (INTEGER(4) (0:15,0:15))) 0x15f04bc8

The movl destination for 0x6 comes out to 0x15f04bc4 which is smaller than the start of the array.  This issue does not occur if optimization is disabled.

Can anyone shed any light on what's happening here?

Thanks,

Phil Bailey

AttachmentSize
Download vectorize.tar.gz686 bytes
6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Absence of a report about vectorization is a typical symptom of dead code elimination.  In the long distant past, when compiler vendors tried to provide reports on dead code elimination, customers said they didn't want those reports.

I suppose it's hard to follow across eliminated dead code in a debugger.

The optimization report generated by option "-opt-report" or "-opt-report-file" can tell what happened to loop at line 35:

<vectorize.f90;35:36;hlo_opt_pred;MAIN__;0>
Condition at line 36 hoisted from loop at line 35

......

<vectorize.f90;35:35;hlo_unroll;MAIN__;0>
Loop at line 35 peeled iterations: 1    (pre-vector)

Here the if statement at line 36 was brought outside the loop and then the loop iteration was reduced to only 1 so there is no longer vectorization report for it.

For the debug output I had a try using the test case and found different output:

(gdb) x/2i $rip
=> 0x402cf3 <p+307>:    movl   $0x6,0x29ca07(%rip)        # 0x69f704 <a_mp_x_+4>
   0x402cfd <p+317>:    movl   $0x7,0x29c9f9(%rip)        # 0x69f700 <a_mp_x_>
(gdb) p &x
$1 = (PTR TO -> ( INTEGER(4) (16,5))) 0x69f700

Are you using the same options as in the attached makefile?

Thanks,

Xiaoping

 

Thank you both for your help. Based on what you said I was able to eliminate some possible causes of the issue and was able to get create a test case that demonstrates the exact issue. I've attached vector2.tar.gz. When you unzip it and run make, it will create two executables, "good" and "bad" that have -O0 and -O2 respectively. You should be able to reproduce my gdb output from the original post using the "bad" executable.

Thanks again for any help you can provide!

-Phil

Attachments: 

AttachmentSize
Download vectorize2.tar.gz690 bytes

Are you asking now about the problem exhibited by the incomplete format at O2? Want better format checking?

I have reproduced the error and opened a bug report for it: DPD200254997

Thanks,

Xiaoping

Leave a Comment

Please sign in to add a comment. Not a member? Join today