I have written a code for the Convolution of image using API's clCreateImage2D for creating space,clEnqueueWriteImage to write to the device and read_imageui for reading the image in a kernel and write_imageui for writing the image back to the host.
Now i want to use the result of the convolution kernel which is pointing to a buffer in another kernel argument.Without moving the result back to host and forth to the device.Is this possible.
If the result is moved back and forth...i think it will be expensive.
Any help in this regards will be invaluable.
OpenCL 2.0 spec added a new feature for dynamic paralelism. 6.13.17 Enqueuing Kernels OpenCL 2.0 allows a kernel to independently enqueue to the same device, without host interaction. ...
I don't think that is possible from within the kernel, so you'd have to create the code for the "inner" pass as a separate kernel and also call that kernel separately from your host code. The output from that kernel doesn't have to be read back to the host memory, but can stay in device memory between your kernel calls.
You can call helper functions from your kernel and they will be parallelized in the same manner as the kernel, imagine them as inlined inside your kernel code. So, each work item will invoke the helper function for the working set it handles. Show activity on this post.
From the Host's point of view, you should be able to take the buffer object, and just pass it as an argument to another kernel. After that you just treat it like any other buffer. The only trick is making sure that when you create the buffer, it has sufficient read-write permissions that it can be both output and input to your kernels.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With