Hi guys,
Is anybody else having trouble creating programs that use atomic operations? The OpenCL announcement/download page here:
http://developer.nvidia.com/object/opencl-download.html
seems to indicate that atomics support is already there…
A simple kernel that uses atomics crashes my test program with a VisualC Runtime Error in clBuildProgram, with the following message:
[codebox]
Constant expressions not handled yet
i32 ptrtoint (i32 addrspace(3)* @shr_1_t to i32)
[/codebox]
I distilled a larger program I had to a simplified, unit test-like kernel that still exhibits the problem:
[codebox]
#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
__kernel void hello(__global char * out) {
__local int t;
size_t tid = get_global_id(0);
t = 0;
atom_add(&t, 32);
}
[/codebox]
Here’s the source code to the main program:
[codebox]
int main(void) {
cl_context gpu_context;
cl_int error_code;
cl_program program;
size_t kernelLength;
char *kernelSource;
gpu_context = clCreateContextFromType(0, CL_DEVICE_TYPE_GPU, NULL, NULL,
&error_code);
kernelSource = oclLoadProgSource("hello_kernel.cl",
"",
&kernelLength);
program = clCreateProgramWithSource(gpu_context,
1,
(const char **)&kernelSource,
&kernelLength, &error_code);
error_code = clBuildProgram(program, 0, NULL, NULL, NULL, NULL);
}
[/codebox]
When I comment out the atomic add, the program runs fine (and the larger version that actually did some stuff did too).
My environment is Vista x32, NVidia Driver 190.89, 2x GTX 260, Intel i7.
Thoughts?