Module Backend_impl.Device

Parameters

Signature

include module type of struct include Device_types end
include Backend_intf.Device_config
include Backend_intf.Device_config_common
type dev = Device_types.dev

Interface to a device driver.

val sexp_of_dev : dev -> Sexplib0.Sexp.t
type runner = Device_types.runner

Interface to a stream driver.

val sexp_of_runner : runner -> Sexplib0.Sexp.t
type event = Device_types.event

An event tracks if a device's runner finished computing past a particular point in its schedule. These values are used internally for scheduling across devices/queues of the backend, and can be used for explicit scheduling.

val sexp_of_event : event -> Sexplib0.Sexp.t
val name : Base.string
type optimize_ctx = Device_types.optimize_ctx

The optimization context for compiling code, in particular Low_level.optimize_ctx for low-level backends.

val sexp_of_optimize_ctx : optimize_ctx -> Sexplib0.Sexp.t
val empty_optimize_ctx : Base.unit -> optimize_ctx
type nonrec device = (dev, runner, event) Backend_intf.device
val sexp_of_device : device -> Sexplib0.Sexp.t
type nonrec context = (dev, runner, event, optimize_ctx) Backend_intf.context
val sexp_of_context : context -> Sexplib0.Sexp.t
include module type of struct include Slab end
include Backend_intf.Slab_alloc with type device := Device_types.device
val alloc_pool : ?mode:Tnode.memory_mode -> Device_types.device -> pool_id:Base.int -> size_in_bytes:Base.int -> alignment:Base.int -> Base.unit

Allocates 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_types.device -> pool_id:Base.int -> Base.unit) Base.option

Frees the slab for pool_id and drops its table entry. None for backends that rely on GC.

val memset_zero : Device_types.device -> pool_id:Base.int -> offset:Base.int -> size_in_bytes:Base.int -> Base.unit

Zero-initializes size_in_bytes at base_of pool_id + offset.

type buffer_ptr = Slab.buffer_ptr
val make_device : 'a -> 'b -> ordinal:Base.int -> ('a, 'b, 'c) Backend_intf.device
val get_name : ('a, 'b, 'c) Backend_intf.device -> string
val make_context : ?ctx_buffers: (Tnode.t, Backend_intf.buffer_loc, Tnode.comparator_witness) Base.Map.t -> ?optimize_ctx:optimize_ctx -> ('a, 'b, 'c) Backend_intf.device -> ('a, 'b, 'c, optimize_ctx) Backend_intf.context
val make_child : ?ctx_buffers:Backend_intf.ctx_buffers -> ?optimize_ctx:'a -> ?merge_buffer_node:Tnode.t Base.option -> ('b, 'c, 'd, 'a) Backend_intf.context -> ('b, 'c, 'd, 'a) Backend_intf.context