type conflicts in select

Hi everyone!

I am writing a Monte-Carlo physics simulation that is highly paralellizable and relies only on bit operations and random numbers. The heart of the code is the PRNG and the stepping function which is a single select operation. I wanted to avoid flow-control, since there is only a single place where the random number is compared to a preset constant. This is the select function inside a for cycle:

factor = select(zero4, three4, ( ((particle << (uint4)i) >> (uint4)(SD - 2) ) == two4) && abs(isless(random,min(p,rp[my_share])

types are the following:

uint4 factor;
uint4 zero4;
uint4 three4;
uint4 particle;
uint SD;
uint4 two4;
float4 random;
float4 p;
float4* rp;

The OpenCL compiler gives the following error message, which I cannot resolve:

:224: error: invalid operands to binary expression (‘unsigned int attribute((ext_vector_type(4)))’ and ‘uint4’)
factor = select(zero4, three4, ( ((particle << (uint4)i) >> (uint4)(SD - 2) ) == two4) && abs(isless(random,min(p,rp[my_share])) ) );

The ^ sign points at “random”. If I’m not mistaken it some compiler related problem that it cannot compare a vector of unsigned integers and a type of uint4.

The types on the right side of &&:
p and rp[my_share] are both float4, min returns float4.
Isless returns a component-wise comparison of each either int4 or uint4, to make sure I call abs() which surely return uint4.

The types on the left side of &&:
leftshift uint4 particles by uint4 vector.
rightshift uint4 by uint4 vector of all equal values.
check if components are equal to unsigned 2.

I suspected that && operator is fishy (although the ^~~~~~ points elsewhere and I tried to cast the left side to uint4.

factor = select(zero4, three4, (uint4)( ((particle << (uint4)i) >> (uint4)(SD - 2) ) == two4) && abs(isless(random,min(p,rp[my_share])

Now the error message is:

:224: error: invalid operands to binary expression (‘uint4’ and ‘uint4’)
factor = select(zero4, three4, (uint4)( ((particle << (uint4)i) >> (uint4)(SD - 2) ) == two4) && abs(isless(random,min(p,rp[my_share])) ) );

The ^~~~~~~ is pointing to abs();

I saw that someone else is having the same trouble, that && don’t work and it throws the same error message. Could someone pls tell whether it is not supported by the NVIDIA OpenCL compiler or are we doing something wrong.

To be honest I am not a big fan of NVIDIA, but in my work I have to compare vendor efficiency on some simple physics algorithms. I have come up with a not so trivial way of vectorizing my group leaders code which implied avoiding all flow-control. Now I have a code that should be optimal for both ATi and NVIDIA cards, but I suspect that it is not me doing something wrong but NVIDIA sabotageing all attempts at writing optimal cross-vendor code. It takes ZERO effort to do a simple unrolling of vector-type logical operations such as && for Cuda Cores. Nonetheless, I fear it is not implemented.

Please, tell me that I am doing something wrong and it is not the limitation of the compiler! (Which would yet again be another reason in my personal “Wall of Shame” why to use ATi)