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

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):

https://github.com/TUM-I5/SWE/blob/SSE_performance_measure/src/blocks/SW...

The solver that is called is here:

https://github.com/TUM-I5/swe_solvers/blob/master/src/solver/FWaveVec.hpp

3 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

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;

发表评论

登录添加评论。还不是成员?立即加入