I'm wondering if someone from the driver team would be able to clear something up for me:
- What is the sequence of events from instantiating a buffer host-side, to copying data to that buffer, to it being used for computations on the device, to it being read, from a "where is the data" perspective?
I have read Section 3.3 of CL 1.2, but I'm still not clear on it. I'll highlight what I think is happening, and this will show what I mean by "where is the data":
1) I have some data in a container host-side
2) I create a buffer. This buffer is instantiated host-side, (in host memory)
3) I call enqueueWriteBuffer
// THIS IS WHAT I"M UNSURE ABOUT
4) enqueueWriteBuffer literally just does a mem copy HOST SIDE?
5) I call enqueueNDRangeKernel, after kernel->setArg(that buffer)
6) THE GRAPHICS DRIVER? handles sending the instruction set, and copying all "cl::Buffer" objects in host memory to available blocks on the device
7) Kernel Executes
8) Kernel finishes executing and the GRAPHICS DRIVER copies the driver side buffers back host side (is this what is considered "done", for a CommandQueue:finish block?)
9) We call enqueueReadBuffer on all of the buffers and copy back to the original containers.
See relevant discussion:
c++ - OpenCL Buffer Instantiation in a Multi Device Environment - Stack Overflow
If it hasn't been already, and I've just missed it, would it maybe be possible to highlight this somewhere in a nice little picture or something on your developer site? Thanks!