I am trying to compile a simple kernel using OpenCL 2.0 atomics using exactly the device, driver, and kernel described in:
However, I cannot even get the kernel to compile, as it does not seem to recognize the atomic types and functions. My error log (along with some environment info) is:
-- device info --
DEVICE_NAME: Intel(R) HD Graphics 5500
DEVICE_VENDOR: Intel(R) Corporation
DEVICE_VERSION: OpenCL 2.0
:6:62: error: unknown type name 'atomic_int'
kernel void atomics_test(global int *output, volatile global atomic_int* atomicBuffer, uint iterations, uint offset)
:10:9: error: implicit declaration of function 'atomic_fetch_add_explicit' is invalid in OpenCL
atomic_fetch_add_explicit(&atomicBuffer, MY_ADD_VALUE, memory_order_relaxed, memory_scope_device);
error: front end compiler failed build.
Am I missing an include or an extension to enable? I tried searching through the docs but couldn't find anything. For example, the Atomic Function page doesn't seem to describe any includes or extensions to use 'atomic_int':
Thanks a lot in advance!
Thanks for the fast reply Robert! That did it.
I was looking at the clBuildProgram docs for OpenCL 1.x which doesn't include this option. Of course, when I look at clBuildProgram doc for 2.0, this option is documented.