OpenCL - local memory over multiple kernels

Hi Guys!

Is it possible, to generate some kind of data on GPU, store it in the local memory and use this data in more than one kernel?

It would be nice to see a simple example, if it’s possible.

Thank you!

Is there anything preventing you from using global buffers? They keep their data between kernel runs.

I’ve read that using local memory is much faster than using global memory. At the moment i use global memory. But the point is, that the GPU-side generated data is never used by the host - so why i should write the data in the global memory?

Global memory - is the main memory of GPU. If it is not needed by host then you just don’t copy it to the host.

Local memory is invalidated after all work-items in work-group finish execution. There is no way to use it for passing data between kernel runs. Besides, it is small in size.

ah…ok, that sounds good. Is it still necessary to set the Kernel-Argument for the Kernels which use that buffer?


Ok, thank you very much. :smiley: