Backend.MemoryGPU memory allocation and transfer
Allocate buffer for custom types with explicit element size in bytes
val alloc_zero_copy :
Device.t ->
('a, 'b, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t ->
('a, 'b) Stdlib.Bigarray.kind ->
'a buffer optionAllocate zero-copy buffer using host bigarray memory directly. For CPU OpenCL devices, this avoids memory copies entirely. Returns None if zero-copy not supported by this backend.
val free : 'a buffer -> unitval host_to_device :
src:('a, 'b, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t ->
dst:'a buffer ->
unitval device_to_host :
src:'a buffer ->
dst:('a, 'b, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t ->
unitval host_ptr_to_device :
src_ptr:nativeint ->
byte_size:int ->
dst:'a buffer ->
unitTransfer from raw pointer to device (for custom types). src_ptr is a raw machine address (as produced by raw_address_of_ptr); a nativeint is NOT a GC root, so the CALLER must keep the pointed-to allocation live across this call. Transfers are synchronous today (a live source on the caller's stack suffices); an async backend (e.g. the worker+SAB readback planned for the jsoo path) must root the source explicitly.
val device_to_host_ptr :
src:'a buffer ->
dst_ptr:nativeint ->
byte_size:int ->
unitTransfer from device to raw pointer (for custom types). Same keep-alive contract as host_ptr_to_device: the caller owns dst_ptr's liveness.
val size : 'a buffer -> intval device_ptr : 'a buffer -> nativeintval is_zero_copy : 'a buffer -> boolCheck if buffer uses zero-copy (no transfers needed)