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,
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'.
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.
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:
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".