- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When compiling the following snippet the offline compiler does not complain:
The AMD compiler emits an error:
[cpp]__kernel void T6_f_15_355 () {
__local int x = 5 ;
x = 0;
return;
}[/cpp] According to the OpenCL 1.1 spec (6.5.2), a local variable cannot be initialized.The AMD compiler emits an error:
[plain]Line 2: error: variable "x"
may not be initialized
__local int x =1 ;
^
1 error detected.
[/plain]Moreover, local variables should only be defined at kernel function scope. The following code should thus also be rejected:[cpp]__kernel void T6_f_15_355 (int x) {
if(x < 3) {
__local int y ;
y = 0;
}
}[/cpp] But all OpenCL compilers seem to accept it without complaining.Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Phillippe,
Thanks for your post, I'll open a bug report on this issue, and we'll add these restrictions to one of our future versions.
Thanks
Guy Benyei
Thanks for your post, I'll open a bug report on this issue, and we'll add these restrictions to one of our future versions.
Thanks
Guy Benyei
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