cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

mishka_p
Journeyman III

why the atomic counters not work

Hello. My GPU (HD 6950) have "cl_ext_atomic_counters_32" extention. Why when compiling certain code I have:

OpenCL Compile Error: clBuildProgram failed (CL_BUILD_PROGRAM_FAILURE).

calclCompile failedError: Creating kernel CalculateRarityAttentionMapKernelOne failed!

 

#pragma OPENCL EXTENSION cl_ext_atomic_counters_32 : enable #pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics #pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable __kernel void SomeKernel (...) { ... counter32_t counter = 0; atomic_inc(counter); ... }

0 Likes
2 Replies
nou
Exemplar

counter32_t counter = 0; is invalid.

from specification

Variables declared to be of type counter32_t can only be specified as arguments to a kernel or a non-kernel function. These types cannot be used in any expression evaluation, or have values assigned to it inside a kernel or a function. These types cannot be used to declare local variables or as the return type of a function. A counter32_t argument to a function cannot be modified.
0 Likes

Thank you!

0 Likes