Operator overloading in the OpenCL kernel

I switched from CUDA to OpenCL.

In CUDA, I was able to overload the statement:

__device__ bool operator != (const uint2 a, const uint b) 
{ 
    return ((a.x != b) && (a.y != b)); 
}

Can I do the same inside the OpenCL kernel?

+3
source share
2 answers

No. The OpenCL core language of any current version of OpenCL (1.0, 1.1, or 1.2) is OpenCL C - an extended and subset version of C99 that does not contain operator overloads or, what is more, user function overloads.

Future versions of OpenCL may expand it to include the C ++ -based OpenCL kernel language, which allows operator overloading - but this is not yet standardized or widely available.

+4
source
+1

All Articles