Argument of type __local int[5] rejected

Argument of type __local int[5] rejected

The following code fails to compile with the 2013 beta on Linux:

void bar(__local int baz[5]) {}
__kernel void foo() {}

with the message error: parameter may not be qualified with an address space

According to C99: "A declaration of a parameter as ‘‘array of type’’ shall be adjusted to ‘‘qualified pointer to type’’, where the type qualifiers (if any) are those specified within the [ and ] of the array type derivation." Thus, the parameter to bar ought to be treated as __local int *, which is legal. The same error occurs if no size is provided.

For comparison, the NVIDIA and AMD OpenCL implementations both allow this.

2 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

The OpenCL spec says "Pointers to the __local address space are allowed as arguments to functions (including kernel functions)." and as you already pointed out, according to C99 spec says that the adjustment should be made. I did verify that this kernel fails on the CPU (windows) but compiles on the gpu.

I will file a bug and keep you updated. Thanks for bringing this up.


Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen