Forum Discussion
Altera_Forum
Honored Contributor
11 years agoIn your latest code, what happens is the following:
"temp[gid]" returns a struct of type "cnt" by value. This now is in private memory space, but you specify the argument to funcA has to be global. Hence why you get the error. If I understand well, you want to be able to change the "cnt" struct in global memory from funcA. In that case, you would keep the argument as a pointer to global memory space, and make sure to pass a pointer to global.
typedef struct {
int count;
} cnt;
void funcA(__global cnt * cnt_temp)
{
}
__kernel void photon(__global cnt * temp)
{
int gid = get_global_id(0);
funcA(&temp);
}