clSetKernelArg bug for <type>3 arguments

clSetKernelArg bug for 3 arguments

I've found a bug in the 2013 beta Linux build: when using clSetKernelArg to set an int3 argument, it fails if sizeof(cl_int3) is used as the size. It accepts 3 * sizeof(cl_int), but the CL spec is pretty clear that the API type corresponding to int3 is cl_int3, not cl_int[3] (there's a table at the start of section 6.1.2 in the CL 1.1 spec). The sizes are different because cl_int3 is padded to 4*sizeof(cl_int).

Both the NVIDIA and AMD OpenCL implementations expect the size to be sizeof(cl_int3).

publicaciones de 5 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Bruce,

I don't think that's a bug. The spec clearly says this about sizeof - "When applied to an operand that is a vector type, the result is number of components * size of each scalar component (Except for 3-component vectors whose size is defined as 4 * size of each scalar component.)". So it appears that Intel's behavior is correct.

Thanks,
Raghu

Cita:

Raghupathi Muthyalampalli (Intel) escribió:

Bruce,

"When applied to an operand that is a vector type, the result is number of components * size of each scalar component (Except for 3-component vectors whose size is defined as 4 * size of each scalar component.)"


Actually I think the part in parentheses supports my point: the size of an int3 is 16, not 12, yet clSetKernelArg only works when I pass a size of 12.

Ah sorry. I thought your original post said the opposite. Can you attach a small test case?

Thanks,
Raghu

I've written and attached a testcase that uses CLU. I included the CLU runtime in the zipfile, which I had to edit slightly to get it to compile with GCC. When I run it, it outputs
intel_sizeof.c:50: clSetKernelArg(kernel, 0, sizeof(arg), &arg) failed: -51
and -51 is CL_INVALID_ARG_SIZE.

Adjuntos: 

AdjuntoTamaño
Descargar intel-sizeof.zip14.07 KB

Inicie sesión para dejar un comentario.