cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Sheeep
Journeyman III

float4+local memory

is it possible to use vload4/vstore4 with local memory?

Hi,

I try to build a vector from local memory, and get an error:

 

 

error: no matching overload found for arguments of type 'size_t, float __attribute__((address_space(3)))[4]'

        x4=vload4(lid,x);

           ^~~~~~

 

 

Is it possible to create a vector from local memory like I tried in the kernel below?

 

__kernel void test3(__global const float *a, __global const float *b, __global float *c){ int gid=get_global_id(0); int lid=get_local_id(0); __local float x[4],y[4]; x[lid] = a[gid]; y[lid] = b[gid]; float4 x4,y4,z4; x4=vload4(lid,x); y4=vload4(lid,y); z4=x4+y4; vstore4(z4,gid,c); }

0 Likes
3 Replies
omkaranathan
Adept I

Sheeep,

I don't see anything wrong with your code. Also it is not giving any error at my end. Which device are you using?

 

0 Likes

hi,

I have a hd 4870... 

do you think, the problem is localmemory on hd 48xx?

Sheeep

 

0 Likes

I'm not sure I understand your kernel. Won't your loads run off the end of the local memory array after the first work item in the group?

Also, what happens if, instead of using vload4 you cast the local pointer to a float4? That'll only work if you're using aligned loads, of course, which you're apparently not in your code at the moment. It would be an interesting test all the same.

0 Likes