Code like this can't be built with NV OpenCL, and it needs an explicit type converison for ternary expression if return type is uchar. uchar i = 0, j = 0; uchar t = max((uchar)j, ((i > 0) ? (uchar)1 : (uchar)0));