Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does opencl support boolean variables?

Does openCL support boolean variables? I am currently using JOCL (java) to write my openCL calling code and I don't see anything about booleans.

like image 283
smuggledPancakes Avatar asked Dec 14 '10 16:12

smuggledPancakes


1 Answers

tl;dr: Yes, but you should avoid it in kernel function signatures.

Yes; but the size of a bool is not defined. Therefore, it does not have an associated API type (as what size the value should be is device dependent).

See section 6.1.1 Built-in Scalar Data Type of the OpenCL 1.1 specification for a list of supported scalar types.

From Section 6.8.k

Arguments to __kernel functions in a program cannot be declared with the built-in scalar types bool, half, size_t, ptrdiff_t, intptr_t, and uintptr_t. The size in bytes of these types except half are implementation-defined and in addition can also be different for the OpenCL device and the host processor making it difficult to allocate buffer objects to be passed as arguments to a kernel declared as pointer to these type

like image 97
grrussel Avatar answered Nov 04 '22 20:11

grrussel