Diagnostic message: xxxx was not vectorized: volatile assignment was not vectorized. Try using non-volatile assignment.
Cause:
This diagnostic message is emitted when the loop in question doesn't meet the vectorization criteria in that any code involving volatile assignment within the loop prevents vectorization. In the example below the iteration control variable causes a conditional loop exit preventing vectorization.
Example:
%cat vec.c
void no_vec(float a[], float b[], float c[])
{
volatile int i;
int j,k;
while (i < 100) {
a[i] = b[i] * c[i];
++i;
}
}
Using Intel(R) C++ Compiler 16.0:
% icc -c -opt-report-phase=vec -opt-report-file=stdout vec.c
Intel(R) Advisor can now assist with vectorization and show optimization
report messages with your source code.
See "https://software.intel.com/en-us/intel-advisor-xe" for details.
Begin optimization report for: no_vec(float *, float *, float *)
Report from: Vector optimizations [vec]
Non-optimizable loops:
LOOP BEGIN at vect.c(5,4)
remark #15529: loop was not vectorized: volatile assignment was not vectorized. Try using non-volatile assignment. [ vect.c(6,16) ]
LOOP END
Recommendation
Try to see if you can redo the loop as below eliminating volatile declaration:
% cat vec.c
void no_vec(float a[], float b[], float c[])
{
int i, j,k;
while (i < 100) {
a[i] = b[i] * c[i];
++i;
}
}
% icc -c -opt-report-phase=vec -opt-report-file=stdout vec.c
Intel(R) Advisor can now assist with vectorization and show optimization
report messages with your source code.
See "https://software.intel.com/en-us/intel-advisor-xe" for details.
Begin optimization report for: no_vec(float *, float *, float *)
Report from: Vector optimizations [vec]
LOOP BEGIN at vec.c(4,4)
<Peeled loop for vectorization, Multiversioned v1>
LOOP END
LOOP BEGIN at vec.c(4,4)
<Multiversioned v1>
remark #15300: LOOP WAS VECTORIZED
LOOP END
LOOP BEGIN at vec.c(4,4)
<Alternate Alignment Vectorized Loop, Multiversioned v1>
LOOP END
LOOP BEGIN at vec.c(4,4)
<Remainder loop for vectorization, Multiversioned v1>
remark #15301: REMAINDER LOOP WAS VECTORIZED
LOOP END
LOOP BEGIN at vec.c(4,4)
<Remainder loop for vectorization, Multiversioned v1>
LOOP END
LOOP BEGIN at vec.c(4,4)
<Multiversioned v2>
remark #15304: loop was not vectorized: non-vectorizable loop instance from multiversioning
LOOP END
LOOP BEGIN at vec.c(4,4)
<Remainder, Multiversioned v2>
LOOP END