Diagnostic 18016: Switch statement in vector function has more than <val> case labels

Cause:

This message is emitted because the compiler spots a switch case block inside a SIMD-enabled function which has more than 16 case statements. Below is an example for this scenario:

Example:

#include<iostream>
using namespace std;
__declspec(noinline, vector(uniform(a), linear(i:1))) void switchfunc(int *a, int i){
switch(a[i]){
                case 0: break;
                case 1: a[i]++;
                        break;
                case 2: a[i]+2;
                        break;
                case 3: a[i]+3;
                        break;
                case 4: a[i]+4;
                        break;
                case 5: a[i]+5;
                        break;
                case 6: a[i]+6;
                        break;
                case 7: a[i]+7;
                        break;
                case 8: a[i]+8;
                        break;
                case 9: a[i]+9;
                        break;
                case 10: a[i]+10;
                         break;
                case 11: a[i]+11;
                         break;
                case 12: a[i]+12;
                         break;
                case 13: a[i]+13;
                         break;
                case 14: a[i]+14;
                         break;
                case 15: a[i]+15;
                         break;
                case 16: a[i]+16;
                         break;
                case 17: a[i]+17;
                         break;
                default: a[i]+11;
}
return;
}
int main(){
int a[20];
a[:] = __sec_implicit_index(0);
for(int i = 0; i < 20; i++)        
   switchfunc(a, i);
int sum = __sec_reduce_add(a[:]);
return 0;
}


$ icpc testswitch2.cc -vec-report6
testswitch2.cc(4): error #18016: Switch statement in vector function has more than 16 case labels
testswitch2.cc(46): (col. 1) remark: vectorization support: reference a has aligned access
testswitch2.cc(46): (col. 8) remark: vectorization support: unroll factor set to 5
testswitch2.cc(46): (col. 8) remark: LOOP WAS VECTORIZED
testswitch2.cc(47): (col. 1) remark: loop was not vectorized: vectorization possible but seems inefficient
testswitch2.cc(47): (col. 1) remark: vectorization support: unroll factor set to 10
testswitch2.cc(4): (col. 1) remark: vectorization support: reference a has unaligned access
testswitch2.cc(6): (col. 11) remark: vectorization support: reference a has unaligned access
testswitch2.cc(6): (col. 11) remark: vectorization support: reference a has unaligned access
testswitch2.cc(6): (col. 11) remark: vectorization support: reference a has unaligned access
testswitch2.cc(6): (col. 11) remark: vectorization support: reference a has unaligned access
testswitch2.cc(6): (col. 11) remark: vectorization support: unaligned access used inside loop body
testswitch2.cc(3): (col. 85) remark: FUNCTION WAS VECTORIZED
testswitch2.cc(3): (col. 85) remark: FUNCTION WAS VECTORIZED
remark: vectorization support: unroll factor set to 2
testswitch2.cc(4): (col. 1) remark: vectorization support: reference a has unaligned access
testswitch2.cc(6): (col. 11) remark: vectorization support: reference a has unaligned access
testswitch2.cc(6): (col. 11) remark: vectorization support: reference a has unaligned access
testswitch2.cc(6): (col. 11) remark: vectorization support: reference a has unaligned access
testswitch2.cc(6): (col. 11) remark: vectorization support: reference a has unaligned access
testswitch2.cc(6): (col. 11) remark: vectorization support: unaligned access used inside loop body
testswitch2.cc(3): (col. 85) remark: FUNCTION WAS VECTORIZED
testswitch2.cc(3): (col. 85) remark: FUNCTION WAS VECTORIZED

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

Comments

Dear Anoop,

Dear Anoop,

I have 2 questions about the above report for line 3, I mean:

testswitch2.cc(3): (col. 85) remark: FUNCTION WAS VECTORIZED
testswitch2.cc(3): (col. 85) remark: FUNCTION WAS VECTORIZED
remark: vectorization support: unroll factor set to 2

testswitch2.cc(3): (col. 85) remark: FUNCTION WAS VECTORIZED
testswitch2.cc(3): (col. 85) remark: FUNCTION WAS VECTORIZED

 

why we have 4 remarks for the function? (is that because of the simd length on you node?)

and what is the remark in between? (remark: vectorization support: unroll factor set to 2)