opencl Namespace Reference

Space-ng SDK: sol3::opencl Namespace Reference
Space-ng SDK
sol3::opencl Namespace Reference

Classes

class  OpenClManager
 

Functions

void addHook (cl::CommandQueue &queue, std::function< void()> fn)
 
void enqueueReadBack (cl::CommandQueue &queue, cl::Buffer &cl_buf, core::IBufferMutable &host_buf)
 
void enqueueWriteBuffer (cl::CommandQueue &queue, cl::Buffer &buf, size_t offset, size_t size, void const *ptr)
 
void writeBufferNow (cl::CommandQueue &queue, cl::Buffer &buf, size_t offset, size_t size, void const *ptr)
 
void enqueueReadBuffer (cl::CommandQueue &queue, cl::Buffer &buf, size_t offset, size_t size, void *ptr)
 
void readBufferNow (cl::CommandQueue &queue, cl::Buffer &buf, size_t offset, size_t size, void *ptr)
 

Function Documentation

◆ addHook()

void sol3::opencl::addHook ( cl::CommandQueue &  queue,
std::function< void()>  fn 
)

Enqueue a user callback that fires after all preceding commands on queue have completed. Inserts a marker event and registers the callback via clSetEventCallback.

◆ enqueueReadBack()

void sol3::opencl::enqueueReadBack ( cl::CommandQueue &  queue,
cl::Buffer cl_buf,
core::IBufferMutable host_buf 
)

Enqueue a read-back from a GPU cl::Buffer into host memory.

On QRB5165 (unified ION memory) this is a no-op — the host pointer already reflects GPU writes. On x64/Nvidia with discrete memory, this enqueues an async DMA copy from VRAM back to the host-side buffer (caller must order downstream host access against the queue).

◆ enqueueReadBuffer()

void sol3::opencl::enqueueReadBuffer ( cl::CommandQueue &  queue,
cl::Buffer buf,
size_t  offset,
size_t  size,
void *  ptr 
)

Asynchronous device->host read. Returns as soon as the command is queued; ptr must remain valid until the read completes.

◆ enqueueWriteBuffer()

void sol3::opencl::enqueueWriteBuffer ( cl::CommandQueue &  queue,
cl::Buffer buf,
size_t  offset,
size_t  size,
void const *  ptr 
)

Asynchronous host->device write. Returns as soon as the command is queued; ptr must remain valid until the write completes (typically observed via a queue marker or event). Prefer writeBufferNow when the host buffer's lifetime ends at the call site.

◆ readBufferNow()

void sol3::opencl::readBufferNow ( cl::CommandQueue &  queue,
cl::Buffer buf,
size_t  offset,
size_t  size,
void *  ptr 
)

Synchronous device->host read. Returns only after the copy has completed, so ptr is safe to consume as soon as this returns.

◆ writeBufferNow()

void sol3::opencl::writeBufferNow ( cl::CommandQueue &  queue,
cl::Buffer buf,
size_t  offset,
size_t  size,
void const *  ptr 
)

Synchronous host->device write. Returns only after the copy has completed, so ptr may be released or reused as soon as the call returns. Use when the source data is a temporary (e.g. a local std::string) and you do not want to manage its lifetime against queued GPU work.