OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1663 Discussions

error: parameter may not be qualified with an address space

Istvan_Lorentz
Beginner
1,371 Views
Hi, the following code fragment:
[sectionbodytext]inline float dotProduct(
		const __local float x[], 
		const __local float y[],
		float __local dst[],
		int n ) 
{
/* details omitted */
}[/sectionbodytext]
fails to compileusing Intel OpenCL SDK 1.5 (win-x64), with "error: parameter may not be qualified with an

However the same code was correctly compiled by both NVIDIA and AMD OpenCL compilers.
As a workaround Ichanged the arguments to use pointers instead of arrays, and it compiled successfully:
inline float dotProduct(const __local float *x, .....
Another workaround is to remove the __local attribute from the parameters. The compiler accepted it,
but i'm not sure if it is semantically correct.
Am I missing something here (shouldn't use array parameters?) or is this a compiler bug?
Please advise me,
Thanks,
Istvan
0 Kudos
2 Replies
Guy_B_Intel
Employee
1,371 Views
Hi Istvan,
The OpenCL specs are quite clear about this item:
"Pointers to the __local address space are allowed as arguments to functions (including kernel functions)." (OpenCL 1.1, 6.5.2)
Even if there is only a smalldifference between "float x[]" and "float *x", the spec still requires the usage of pointers, and not arrays.
BTW, the same goes with globals:
"A buffer memory object can be declared as a pointer to a scalar, vector or user-defined struct." (OpenCL 1.1, 6.5.1)
and constants:
"Pointers to the __constant address space are allowed as arguments to functions (including kernel functions) and for variables declared inside functions." (OpenCL 1.1, 6.5.3)

Thanks
Guy
Istvan_Lorentz
Beginner
1,371 Views
Thanks for the quick answer.
However, it would be *nice* to support also the unbounded [] array decay to pointer declaration as function arguments by the compiler. The C99 specs whichOpenCL is based upon states:
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. (ISO/IEC 9899:TC2 6.7.5.3)
Furthermore, theNVIDIA and AMD OpenCL compilers do accepts this syntax.
Personally, i came upon this issue when trying to port existing, workingcode from NV to the Intel OpenCL platform.
Regards,
Istvan
Reply