I see, that vectorization fails because each successive diff value depends on previous. But there is an another way. As far as I know, all non kernel functions are inlined in OpenCL, so instead of vectorizationgetNumEigensLess itself, compiler can vectorize function calls. Make signature something like
int4 getNumEigensLess(float4 c, int n, __global float *d, __global float *e, float pivmin)
Obviously I use same n, e, d and pivmin parameters between calls, changing only c.
How can I change my code, to make compiler vectorize function calls like this?