Can't build kernel on 32bit (works in 64bit)

I’m trying to implement an OpenCL application that sums two matrices together, using the following kernel:

[codebox]__kernel void MatrixSum (__global float* a, __global float* b, __global float* c)

{

int address = get_global_id(0) + get_global_id(1)*get_global_size(0);

c[address]=a[address]+b[address];

}[/codebox]

The Kernel builds without errors when calling clCreateProgramWithSource() targeting the x64 platform in Visual Studio 2010.

(I’m using VS2010 on Win7 x64)

However, if i switch the target architecture to x86, clCreateProgramWithSource fails with the error: CL_BINARY_INVALID (-42).

Now, if I change the code such as the first line is typecasted to float, the Kernel builds and works fine!?!?!?!:

[codebox]__kernel void MatrixSum (__global float* a, __global float* b, __global float* c)

{

int address = (float)get_global_id(0) + get_global_id(1)*get_global_size(0);

c[address]=a[address]+b[address];

}[/codebox]

I would say a type error should be thrown?

Also, if I change one of the float arrays to an Integer array instead, the code also builds fine:

[codebox]__kernel void MatrixSum (__global int* a, __global float* b, __global float* c)

{

int address = get_global_id(0) + get_global_id(1)*get_global_size(0);

c[address]=a[address]+b[address];

}[/codebox]

I’m using Toolkit v3.2.

I think theres a bug in the 32bit version of the compiler.

Anyone had similar problems?

Thanks.

I’m trying to implement an OpenCL application that sums two matrices together, using the following kernel:

[codebox]__kernel void MatrixSum (__global float* a, __global float* b, __global float* c)

{

int address = get_global_id(0) + get_global_id(1)*get_global_size(0);

c[address]=a[address]+b[address];

}[/codebox]

The Kernel builds without errors when calling clCreateProgramWithSource() targeting the x64 platform in Visual Studio 2010.

(I’m using VS2010 on Win7 x64)

However, if i switch the target architecture to x86, clCreateProgramWithSource fails with the error: CL_BINARY_INVALID (-42).

Now, if I change the code such as the first line is typecasted to float, the Kernel builds and works fine!?!?!?!:

[codebox]__kernel void MatrixSum (__global float* a, __global float* b, __global float* c)

{

int address = (float)get_global_id(0) + get_global_id(1)*get_global_size(0);

c[address]=a[address]+b[address];

}[/codebox]

I would say a type error should be thrown?

Also, if I change one of the float arrays to an Integer array instead, the code also builds fine:

[codebox]__kernel void MatrixSum (__global int* a, __global float* b, __global float* c)

{

int address = get_global_id(0) + get_global_id(1)*get_global_size(0);

c[address]=a[address]+b[address];

}[/codebox]

I’m using Toolkit v3.2.

I think theres a bug in the 32bit version of the compiler.

Anyone had similar problems?

Thanks.

I have the same problem with FW 260b. If you try to build a program on a x64 OS but your app is x86, then the compilation will fail.
I think it’s a bug.

I have the same problem with FW 260b. If you try to build a program on a x64 OS but your app is x86, then the compilation will fail.
I think it’s a bug.