Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Chaitali_C_
Beginner
94 Views

simple vector addition

 

Hello,

I have a question w.r.t below scenario on Intel Sandy Bridge,

For simple vector addition code in C,

If I do dynamic memory allocation it vectorizes the main addition loop

    C = A + B

even if I do not use any restrict keyword (icc 13)

But if I statically allocate arrays, it does not vectorize loop nor it specifies something about it in vectorization report.

Even if I do allocation using declspec(align) it does not vectorize.

What can be the causes ?

Thanks in advance,

  Chaitali

 

0 Kudos
5 Replies
Frances_R_Intel
Employee
94 Views

The forum you originally posted this to is specifically for the Intel® Xeon Phi™ coprocessor. Although you would undoubtedly have received an answer there, I decided to split your post off from the thread you had add this as a comment to and sent it off as it's own thread to what I believe is a more appropriate forum. But my first question to you would be - what level of vectorization report did you generate? Since you are still using the Intel C compiler version 13, you probably used -vec-report to generate your report. Saying '-vec-report' is the same as saying '-vec-report=2' which only tells you what loops vectorized. You will probably want to make that '-vec-report=3'.

 

TimP
Black Belt
94 Views

 

I wrote a reply but was blocked possibly due to frances starting to move it. As she said, you must choose a high enough report level for the diagnostics you want, and current compilers may give better information.

A difference with static declaration is the requirement to provide for the possibility of data set in an earlier instance of the function, possibly preventing local analysis of aliasing.

Kittur_G_Intel
Employee
94 Views

Hi Chaitali,
 The vectorization report generated depends on the level you use for reporting like Tim/Frances opined. The link below should give you a detailed info on how best you can use the new optimization report options starting with 15.X versions:

    https://software.intel.com/en-us/articles/getting-the-most-out-of-your-intel-compiler-with-the-new-o... 

_Kittur

Chaitali_C_
Beginner
94 Views

 

Hello...

I have used -vec-report=6 for it. It supposed to give details of loops which are vectorized

or not vectorized with possible causes.

As I understand alignment of data is necessary for vectorization to succeed.

It does it successfully for dynamic memory allocation but not with static memory allocation even if I do alignment

nor does it gives statement like "vectorization is not possible".

Regards,

Chaitali

Kittur_G_Intel
Employee
94 Views

Hi Chaitali, 
Could you please attach the test reproducer to this issue? Thanks

_Kittur 

 

Reply