These samples illustrate loops that can and cannot vectorize and explain how to use the vectorization report diagnostics.
See Included Samples for other samples included with the compiler.
Source |
Locations | ||||
---|---|---|---|---|---|
vec_sample.c.f90 novec_sample.c.f90 |
|
These samples are not meant to generate executable binaries. Instead, the samples are designed to illustrate loops the compiler will or will not vectorize.
You must include the -c (Linux and Mac OS) or /c (Windows) option when compiling the sample. This sample will not generate an valid executable.
The sample requires the -restrict (Linux and Mac OS) or /restrict (Windows) option because the sample uses the restrict keyword.
Platform |
Commands |
---|---|
Linux and Mac OS |
icc -c -xPT -restrict -vec-report3 vec_sample.c |
Windows |
icl /Qstd=c99 /c /QxPT /Qrestrict /Qvec-report:3 vec_sample.c |
Because the compilation commands shown above includes the -vec-report (Linux and Mac OS) or /Qvec-report (Windows) option the compiler generates status message about the vectorization process. The following sample output shows typical vectorization diagnostics messages.
Sample Vectorization Messages |
---|
vec_sample.c(72): (col. 3) remark: LOOP WAS VECTORIZED. vec_sample.c(72): (col. 3) remark: loop skipped: multiversioned. vec_sample.c(62): (col. 3) remark: LOOP WAS VECTORIZED. vec_sample.c(62): (col. 3) remark: loop skipped: multiversioned. vec_sample.c(54): (col. 3) remark: LOOP WAS VECTORIZED. vec_sample.c(54): (col. 3) remark: loop skipped: multiversioned. vec_sample.c(48): (col. 3) remark: LOOP WAS VECTORIZED. vec_sample.c(41): (col. 3) remark: LOOP WAS VECTORIZED. vec_sample.c(41): (col. 3) remark: loop skipped: multiversioned. vec_sample.c(34): (col. 3) remark: LOOP WAS VECTORIZED. vec_sample.c(34): (col. 3) remark: loop skipped: multiversioned. |
You must include the -c (Linux and Mac OS) or /c (Windows) when compiling the sample. This sample will not generate a valid executable.
Platform |
Commands |
---|---|
Linux and Mac OS |
icc -c -xPT -vec-report3 novec_sample.c |
Windows |
icl /Qstd=c99 /c /QxPT /Qvec-report:3 novec_sample.c |
The following sample output shows typical vectorization diagnostics messages.
Sample Vectorization Messages |
---|
novec_sample.c(67): (col. 19) remark: loop was not vectorized: top test could not be found. novec_sample.c(45): (col. 3) remark: loop was not vectorized: existence of vector dependence. novec_sample.c(46): (col. 5) remark: vector dependence: proven FLOW dependence between y line 46, and y line 46. novec_sample.c(35): (col. 3) remark: loop was not vectorized: not inner loop. novec_sample.c(36): (col. 5) remark: loop was not vectorized: not inner loop. novec_sample.c(38): (col. 7) remark: loop was not vectorized: existence of vector dependence. novec_sample.c(39): (col. 9) remark: vector dependence: proven ANTI dependence between b line 39, and c line 39. novec_sample.c(39): (col. 9) remark: vector dependence: proven FLOW dependence between c line 39, and b line 39. novec_sample.c(39): (col. 9) remark: vector dependence: proven FLOW dependence between c line 39, and b line 39. novec_sample.c(39): (col. 9) remark: vector dependence: proven ANTI dependence between b line 39, and c line 39. novec_sample.c(39): (col. 9) remark: vector dependence: proven ANTI dependence between a line 39, and c line 39. novec_sample.c(39): (col. 9) remark: vector dependence: proven FLOW dependence between c line 39, and a line 39. novec_sample.c(39): (col. 9) remark: vector dependence: proven FLOW dependence between c line 39, and a line 39. novec_sample.c(39): (col. 9) remark: vector dependence: proven ANTI dependence between a line 39, and c line 39. |