GCC Vectorization Pragma

6.2k views Asked by At

Using intel compiler, a loop can still be vectorized if users confirm no dependencies using #pragma ivdep.

I found one in GCC #pragma GCC ivdep, but got an error as below:

warning: ignoring #pragma GCC ivdep [-Wunknown-pragmas] #pragma GCC ivdep

1

There are 1 answers

4
zam On BEST ANSWER

"#pragma ivdep" is fully supported starting from GCC4.9.

Which GCC version do you use? #pragma ivdep was not officially supported in GCC at least before 2013.

I'm not sure about official support in other GCC4.x sub-versions between 2013 and 2014, although I've seen there were some partial patches for ivdep support before version 4.9.

In ICC (which you also mentioned among question tags) #pragma ivdep is supported long ago ( at least last 5 years).

For other compilers: Microsoft supports "#pragma loop ivdep" starting from MSVS 2013. Cray and some other "old school" compilers may support it starting from 1990s, but I'm not sure.

Finally, if you look for cross-platform and standard-ized solution, take a look at OpenMP4.x #pragma omp simd. While it's different sematic and also only supported by GCC4.9 + ICC/IFORT, it could be more beneficial in future, because (as opposed to ivdep) - pragma omp simd is true standard, so all compiler vendors will more or less have to support it in future and will have to support the same syntax for it.