Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

Compiler doesn't serialize calls in OpenMP SIMD loop properly in some (Windows / complex) cases

$
0
0

Description:

When calling a function from a `<complex>` library in a SIMD loop, the Intel Compiler uses implementations provided by Microsoft. These are not SIMD declared functions and from the optimization report it can be seen that some of the function calls are serialized.

The issue is even weirder, it occurs only when the `std::complex` object is constructed right before calling a function on it. See the attached minimal example. In the example. I use `std::exp(const std::complex&)` function and this was originally observed when calculating something like `std::exp(std::complex<float>{0.0, array[i]})` in a SIMD loop. I tried to remove the function call completely and the bug disappears, then I tried a different function (`std::sin(const std::complex&)`) and the bug occurred again.

The bug is Windows-specific and I wasn't able to reproduce it on GNU/Linux.

Compilation of the attached example:

icl /Qx:AVX /Qopenmp-simd /Qopt-report=3 exptest.cpp -o exptest.exe

Example output:

Copy + exp error:       0
SIMD exp error:         3.81745e-16
SIMD copy + exp error:  1.99676
Expanded formula error: 6.14074e-16

Environment:

Intel C++ Compiler Version 19.1.0.166 (but you can obtain the same results with 19.0 versions of the compiler)
Visual Studio 2017 Version 15.9.15 (Visual Studio 2019 was also tested at some point but I cannot remember the results)

 

AttachmentSize
Downloadtext/x-c++srcexptest.cpp3.62 KB

TCE Open Date: 

Monday, March 2, 2020 - 05:20

Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>