Forum Discussion
Altera_Forum
Honored Contributor
12 years agoA __global memory that is passed to both kernels can achieve this. Lets say I wanted to pass the results from "Kernel A" to "Kernel B" then I would just allocate a __global buffer using clCreateBuffer and just pass the buffer to both kernels. Kernel A writes to this buffer and Kernel B reads from it. Since they both use the same buffer there is no need to copy the data up to the host and then back down to the target. By passing the buffer I mean sending it as an argument to both kernels, you would not need to enqueue a buffer data movement because you are just using it as a scratch pad between kernels.
If you add software pipelining into the mix so that you can operate both kernels concurrently then you would want to have multiple buffers and manage the scheduling on the host side so that you don't have Kernel B trying to read from the same buffer that Kernel A is still writing to.