Access user-created struct objects in global and device function.

Hi there,

I have created the following struct with methods(getter/setter) to access that struct members in my CU file as shown below:-

struct XYZ
{
float3 point[5],
short value[5];
device void SetPointByIndex(int index,float3 fpoint)
{
point[index]=fpoint;
}
device void SetValueByIndex(int index,short sval)
{
value[index]=sval;
}
device float3 getPoint(int index)
{
return point[index];
}
device short getValue(int index)
{
return value[index];
}
};

now, i am making the instance of this struct in my global kernel method…

global void kernelmethod()
{
XYZ a;
//set the value of a
a.SetPointByIndex(0,some_float3_value);
device_func(a); //this is device function.
device_func2(a);
}

i am calling various device function from the kernelmthod();
now the problem is when i try to access the value of a from device functions i am getting garbage result but I can get the value inside global function.

Also i can’t change all the function to global as it is not allowed to call one global function inside another global function. ( is this true?)

so what are my option to pass my own object type among the global and device function…

thank you
miztaken