Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
7679 Discussions

Vectorization unsing pragma simd with Compiler Version 12.1 and 13.x


I have a code (part) that I vectorized using pragma simd. This worked fine with the Compiler 12.1.

However, compiling the same code with 13.0 or 13.1 breaks it.

Regarding pragma simd, are there any code constructs that work with 12.1 but are no longer supported by 13.x??

You can finde the code here (loops starting at line 137 and 177):

The solver that is called is here:

0 Kudos
2 Replies
Black Belt

The more likely situation is that there are usages of #pragma simd that happened accidentally to work (or at least not to break) with the older compiler but don't work with the newer one.  One of the more common cases is with a reduction not being designated properly.

In the case you pose, the for loop looks far too complicated to attempt vectorization safely, so I suppose the compiler didn't try too hard even with the pragma.

#pragma simd is an assertion that you want the compiler to attempt all kinds of risky optimizations, even some which normally violate language syntax.  It does more than take away the default no-ansi-alias and treat all pointers as if declared restrict (but without necessarily checking for syntax which violates the rules).  It invites the compiler to try things in a new version which it might not have tried in an earlier version.


Yes, the loops are complicated but loop iterations are completely independent (except for the max reduction at the end). Besides, speedups show that 12.1 did vectorize the code.

I had some small local arrays in the  solver (e.g.):

float fWaves[2];

Looks like 12.1 placed those arrays in registers while 13.x puts them on the stack.
Replacing those arrays with variables seems to fix my problem:

float fWaves0, fWaves1;