Closed bddap closed 11 months ago
use_host_slice
is a Rust wrapper that sets the CL_MEM_USE_HOST_PTR
flag under the hood, which is documented here in the reference manual for the OpenCL C API. The TL;DR is that it asks the OpenCL runtime to use the given memory for the underlying storage of the buffer. What exactly this entails varies depending on the OpenCL runtime and system - if you're using, say, an iGPU which shares memory with the CPU, it may be able to truly use the same memory range under the hood. If you're using a system with a discrete GPU with its own VRAM, it may instead implicitly copy data back and forth when the kernel runs.
That explanation definitely clears things up.
The docs have a call to action regarding documentation. Much appreciated here's my report:
Regarging the docs on use_host_slice. As someone who is new to opencl, I'm having trouble understanding what it does. I think it allows the caller to own a buffer that is accessible to the gpu but when I try to use it that way I get unexpected results:
code
```rust pub struct OnTheGpuPerhaps I am using
use_host_slice
totally wrong, but it's hard to tell. An example in the docs would be very helpful.