Functions called in a kernel

Hi,

this is my problem, I have 3 functions in my .cl file and I called them in a kernel. it’a an image processing functions, so I do 3 transformations on the image, now I’m working in the global memory, but I want to work in the local.

what I want to do is to transfer work-groups to local memory, do the 3 operations then write the result back to global, but since each transformation is a separate function, is this possible?

I can detail more if needed.

Separate functions should not be a problem, as long as all functions are called during the same kernel invocation.

I have 2 functions that operates on an image,

the first transfers work-groups to local memory then does the compute and writes result back to global memory, the second takes the global result and computes it, this works just fine.

Now, when I pass the local buffer of the first function to the second,(instead of global buffers), it doesn’t work. below the pseudo code for the algorithm

inline void func1(__global unsigned int *datain,

                       int width, int height, ,

                       __local unsigned int *LocalData)

{

LocalData[get_local_id(1)get_local_size(0)+ get_local_id(0)] = datain[get_global_id(1)(width) + get_global_id(0)] * A;

}

inline void func2( int width, int height,

                       __global unsigned int *dataout,

                       __local unsigned int *LocalData)

{

dataout[get_global_id(1)*(width) + get_global_id(0)] = LocalData[get_local_id(1)*get_local_size(0)+ get_local_id(0)] * B;

}

__kernel void Main(__global unsigned int *datain, int width, int height,

                       __global unsigned int *dataout,

                       __local unsigned int *LocalData)

{

func1(datain, width, height, LocalData);

func2(width, height, dataout, LocalData);

}

Hope it’s clear enough