What is special about cl specific data types?

Hi folks

I’ve just started learning OpenCL. I see many cl specific data types such as cl_int' andcl::vector’ (I am using the C++ bindings). How are these data types different from the standard ones?

Is it that only the cl data types can be used when talking to devices?


C99 does not guarantee that any basic data types such as “int”, “long”, etc. have a specific size. The cl_ data types are guaranteed to have specific sizes and sign representations, and additionally they are guaranteed to match the OpenCL C (kernel) data types.

For example, “int” could be 16-bits while “cl_int” is guaranteed to be a 32-bit signed integer in two’s complement format.

Whenever you use OpenCL, please stick to cl_ data types.

Thanks David. That makes a lot of sense. I see now that it’s all mentioned in the OpenCL spec. I’ll be careful to look at that when deciding what datatypes to use.