Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development Tools (Compilers, Debuggers, Profilers & Analyzers)
- Intel® C++ Compiler
- icc 14 produces wrong code with -O3

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Simon_H_2

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-28-2014
06:07 AM

73 Views

icc 14 produces wrong code with -O3

Hi,

below you find a small piece of code (which comes from code related to the well Cholesky decomposition, here a matrix with two 6x6 blocks on the diagonal).

- icc 13.x produces correct code with -O2 and -O3
- icc 14 produces correct code with -O2, but wrong code with -O3
- this was tested on two independent icc 14 installations, so it does not seem to be cause by our particular installation

When the "buggy" binary is run, the output varies from run to run (the output vector after the matrix-vector multiplication differs).

Cheers,

Simon

#include <stdlib.h> #include <stdio.h> #include <complex.h> // this multiplies a vector with LL^H, where L is a column-major upper-triangular matrix, // which frequently arises when using Cholesky decompositions void buggy_LLH_multiply(float complex *y, float complex *x, float complex *L) { int i, j; int n; float complex z[6]; for( n=0; n<2; n++) { // z = L^H x for(j=0; j<6; j++) { // columns for(i=0; i<j; i++) { // rows z+= conjf(*L)*x; L++; } z = conjf(*L)*x ; L++; } L-=21; // y = L*z; for(i=0; i<6; i++) { // rows y = *L * z[0]; L++; for (j=1; j<=i; j++) { // columns y+= *L * z; L++; } } x+=6; y+=6; } } int main() { float complex matrix[42]; float complex input_vector[12]; float complex output_vector[12]; int i; for(i=0; i<42; i++) matrix = i; for(i=0; i<12; i++) input_vector= i; buggy_LLH_multiply(output_vector, input_vector, matrix); for(i=0; i<12; i++) printf("%2d % e % e\n", i, creal(input_vector), creal(output_vector)); return 0; }

Link Copied

3 Replies

Alexander_W_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-28-2014
07:11 AM

73 Views

Hi Simon,

thanks for reporting this issue. I can reproduce it and unfortunately also for the actual icc 15.0 beta compiler. The issue is related to the vectorization. I will investigate more and escalate the issue to our engineering team.

Thanks,

Alex

Alexander_W_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-28-2014
08:39 AM

73 Views

Hi Simon,

the internal ID for this defect is: DPD200542049.

The loop in line 15 is the one causing the issue. If you add a "#pragma novector" in front of this loop as temporary workaround the result is correct if you compile with -O3.

Thanks,

Alex

Alexander_W_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-13-2014
07:33 AM

73 Views

Hi Simon,

a fix for this issue will be included in the next 15.0 compiler update.

Thanks again for reporting this and including such a nice reproducer!

Alex

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.