- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page