Using a kernel leads to another kernel in OpenCL

I wrote code to convolve the image using the clCreateImage2D API to create space, clEnqueueWriteImage to write to the device, and read_imageui to read the image in the kernel, and write_imageui to write the image back to the host.

Now I want to use a convolution kernel result that points to a buffer in another kernel argument. Without transferring the result back to the host and forward to the device. It is possible.

If the result moves back and forth ... I think it will be expensive.

Any help in this regard would be invaluable.

+4
source share
1 answer

From the point of view of the node, you should be able to take a buffer object and just pass it as an argument to another kernel. After that, you simply treat it like any other buffer. The only trick is to make sure that when creating the buffer it has sufficient read and write permissions that can be either output or injected into your kernels.

+7
source

Source: https://habr.com/ru/post/1445795/


All Articles