Passing structure array into kernel - problem

Discussion created by Alexium on Nov 1, 2010
Latest reply on Nov 4, 2010 by Alexium

I almost lost my mind trying to figure this problem out. I realize the forum is not for fixing every newbie's bug, but I think my problem is really weird, and I've read all available manuals, including OpenCL 1.1 spec. If anyone has any idea on what the problem is - please advise.

The code is attached, problem described in comments. GPU is RV770, but I suppose that's not the problem here.


typedef struct { float4 _pos; float4 _accel; float4 _velocity; float4 _force; float _invMass; } PARTICLE; kernel void integrate(int n, const global PARTICLE* world, global PARTICLE * Out) { uint gid = get_global_id(0); //Works fine PARTICLE p = world[gid]; for (uint k = 0; k < n; ++k) { if (gid != k) { //Returns zeros in all structure fields PARTICLE kP = world[k]; } } Out[gid] = p; }