3

I'm trying to compile a set of OpenCL kernels in a C++ project on OS X El Capitan 10.11.2.

The machine used is a iMac (Retina 5K, 27-inch, Late 2015), containing a AMD Radeon R9 M395X 4096 MB that is chosen as the OpenCL device. I'm using the OpenCL framework that ships with the OS.

On a particular kernel, the OpenCL program build fails with this CL_PROGRAM_BUILD_LOG:

SC failed. No reason given.

The same kernels compile fine when choosing the CPU of the same machine as an OpenCL device or a similar machine with an Nvidia GPU.

1 Answer 1

3

The problematic kernel source can be boiled down to the following:

kernel void sampleKernel (bool param) {}

Using a bool as a parameter of an OpenCL kernel is not supported by the OpenCL C specification, see e.g. https://stackoverflow.com/a/4441865/463796

Replacing the type of the parameter with a char solves the problem.

Sign up to request clarification or add additional context in comments.

2 Comments

It is not that the OpenCL spec (specifically) does not support bool. Is that OpenCL kernels are C99, and C99 (plain C) does not support booleans, if other compiler do support it they are not meeting the spec. Also be careful, because booleans are not required to be chars, although they are in most cases.
Although OpenCL C is based on C99, data types are the area where they are different. OpenCL C does support a bool type in kernel code, but does indeed explicitly disallow passing a bool as a kernel parameter. Still some compilers do (wrongly) support it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.