Backend_impl.Make_slabBacks the device-level slab interface with a backend's raw byte-buffer primitives and a private (device_id, pool_id) -> 'base table.
module Device_types : Backend_intf.Device_typesmodule Raw : No_device_buffer_and_copyingtype device = Device_types.deviceinclude Backend_intf.Slab_alloc with type device := deviceval alloc_pool :
?mode:Tnode.memory_mode ->
device ->
pool_id:Base.int ->
size_in_bytes:Base.int ->
alignment:Base.int ->
Base.unitAllocates the slab for pool_id on device. The optional ?mode carries the tnode's memory mode so backends can pick a storage mode (Metal private vs. shared); backends that do not care ignore it.
val free_pool : (device -> pool_id:Base.int -> Base.unit) Base.optionFrees the slab for pool_id and drops its table entry. None for backends that rely on GC.
val zero_ranges :
device ->
(Backend_intf.buffer_loc * Base.int) Base.list ->
Base.unitZero-initializes each (loc, size_in_bytes): size_in_bytes at base_of loc.pool_id + loc.offset. When it returns, every range reads as zero to a later host write, transfer or kernel on device. One call for all of a context delta's ranges (gh-ocannl-1675): Metal fills them in one command buffer and waits once, where a call per range waited for a GPU round trip each.
type buffer_ptr = Raw.buffer_ptrval resolve_pool : device -> Backend_intf.buffer_loc -> buffer_ptr