Module Device.Allocator
Backend allocator interface.
An allocator manages device buffer lifecycle: allocation, data transfer, addressing, and optional features such as offset views and device-to-device copies. The buffer type 'buf is backend-specific and hidden behind packed at the device level.
See Lru_allocator for LRU caching on top of a raw allocator.
Types
The type for device-to-device transfers. transfer ~dest ~src nbytes copies nbytes from src to dest. Both buffers belong to the same backend.
type 'buf t = {alloc : int -> Buffer_spec.t -> 'buf;(*
*)alloc nbytes specallocates a device buffer ofnbytesbytes with optionsspec.free : 'buf -> int -> Buffer_spec.t -> unit;copyin : 'buf -> bytes -> unit;(*
*)copyin buf srccopiessrcintobuf.copyout : bytes -> 'buf -> unit;(*
*)copyout dst bufcopiesbufintodst.addr : 'buf -> nativeint;(*
*)addr bufis the device address ofbuf.offset : ('buf -> int -> int -> 'buf) option;(*
*)offset buf nbytes byte_offsetis a view intobufstarting atbyte_offsetand spanningnbytes, orNoneif the backend does not support offset views.transfer : 'buf transfer option;(*Device-to-device transfer, or
*)Noneif unsupported.supports_transfer : bool;copy_from_disk : ('buf -> 'buf -> int -> unit) option;(*Direct disk-to-device copy, or
*)Noneif unsupported.supports_copy_from_disk : bool;
}The type for backend allocators parameterised by the buffer representation 'buf.