twiig

static arrays in kernels

Discussion created by twiig on Nov 6, 2009
Latest reply on Nov 9, 2009 by MicahVillmow

I have been having a bit of trouble compiling a kernel with a static array of integers.  When compiling the kernel (see code below) on the GPU, I receive the following:

 

 

For test only: Expires on Sun Feb 28 00:00:00 2010

CL Error: clBuildProgram (-11)

Build Log:

Link failed

Press any key to continue . . .

And, when compiled for the CPU, I receive:
For test only: Expires on Sun Feb 28 00:00:00 2010
C:\Users\tyler\AppData\Local\Temp\OCLB365.tmp.obj:fake.text+0x2c): undefined reference to `__vla_alloc'
C:\Users\tyler\AppData\Local\Temp\OCLB365.tmp.obj:fake.text+0xba): undefined reference to `__vla_dealloc'
C:\Users\tyler\AppData\Local\Temp\OCLB365.tmp.obj:fake.text+0x18e): undefined reference to `__vla_alloc'
C:\Users\tyler\AppData\Local\Temp\OCLB365.tmp.obj:fake.text+0x21d): undefined reference to `__vla_dealloc'
CL Error: clBuildProgram (-11)
Build Log:
Compilation failed
Press any key to continue . . .
Any ideas?  Note that if the only line of code in the kernel is the array declaration, the same result is obtained.


__kernel void combination(const int n, const int k, __global int *out) { size_t gid = get_global_id(0); int a[k]; int index = gid*100; for(int i = 0; i < k; i++) a[i] = gid+i; while(index != -1) { for(int i = 0; i < k; i++) out[index++] = a[i]; int j = k - 1; if(a[j] < n - 1) { ++a[j]; continue; } while(a[j] - a[j-1] == 1) --j; if(j == 1) { index = -1; continue; } int z = ++a[j-1]; while(j < k) { a[j] = ++z; ++j; } } }

Outcomes