Module Schedulers.Sync

A minimalisitc wrapper creating backends where all calls run synchronously on the main thread. There is only one device, but an arbitrary number of streams.

Parameters

Signature

include module type of struct include Backend end
include Ir.Backend_impl.No_device_buffer_and_copying
include Ir.Backend_impl.Buffer
val sexp_of_buffer_ptr : Backend.buffer_ptr -> Sexplib0.Sexp.t
include sig ... end
val sexp_of_buffer : buffer -> Sexplib0.Sexp.t

Raw slab primitives used by Make_slab to back the device-level Backend_intf.Slab_alloc. They allocate / free / zero contiguous backend buffers by byte size; pool-id bookkeeping lives in the shared slab wrapper.

val alloc_pool_raw : size_in_bytes:Base.int -> Backend.buffer_ptr
val free_pool_raw : (Backend.buffer_ptr -> Base.unit) Base.option
val memset_zero_raw : Backend.buffer_ptr -> offset:Base.int -> size_in_bytes:Base.int -> Base.unit
val offset_buffer : Backend.buffer_ptr -> bytes:Base.int -> Backend.buffer_ptr

Returns a handle for the slab pointer advanced by bytes. Used by Make_slab.resolve_pool to turn a { pool_id; offset } into the concrete pointer for a sub-region of a multi-tenant pool. For bytes = 0 this must return the base unchanged.

val buffer_to_buffer : dst:Backend.buffer_ptr -> src:Backend.buffer_ptr -> size_in_bytes:Base.int -> Base.unit
val host_to_buffer : Ir.Ndarray.t -> dst:Backend.buffer_ptr -> Base.unit
val buffer_to_host : Ir.Ndarray.t -> src:Backend.buffer_ptr -> Base.unit
module Device_config : sig ... end
module Device_types : sig ... end
include sig ... end
type dev = Device_types.dev
val sexp_of_dev : dev -> Sexplib0.Sexp.t
type runner = Device_types.runner
val sexp_of_runner : runner -> Sexplib0.Sexp.t
type event = Device_types.event
val sexp_of_event : event -> Sexplib0.Sexp.t
val name : Base.string
type optimize_ctx = Device_types.optimize_ctx
val sexp_of_optimize_ctx : optimize_ctx -> Sexplib0.Sexp.t
val empty_optimize_ctx : Base.unit -> optimize_ctx
type nonrec device
val sexp_of_device : device -> Sexplib0.Sexp.t
type nonrec context
val sexp_of_context : context -> Sexplib0.Sexp.t
val alloc_pool : ?mode:Ir.Tnode.memory_mode -> Device_types.device -> pool_id:Base.int -> size_in_bytes:Base.int -> alignment:Base.int -> Base.unit
val free_pool : (Device_types.device -> pool_id:Base.int -> Base.unit) Base.option
val memset_zero : Device_types.device -> pool_id:Base.int -> offset:Base.int -> size_in_bytes:Base.int -> Base.unit
val make_device : 'a -> 'b -> ordinal:Base.int -> ('a, 'b, 'c) Ir.Backend_intf.device
val get_name : ('a, 'b, 'c) Ir.Backend_intf.device -> string
val make_context : ?ctx_buffers: (Ir.Tnode.t, Ir.Backend_intf.buffer_loc, Ir.Tnode.comparator_witness) Base.Map.t -> ?optimize_ctx:optimize_ctx -> ('a, 'b, 'c) Ir.Backend_intf.device -> ('a, 'b, 'c, optimize_ctx) Ir.Backend_intf.context
val make_child : ?ctx_buffers:Ir.Backend_intf.ctx_buffers -> ?optimize_ctx:'a -> ?merge_buffer_node:Ir.Tnode.t Base.option -> ('b, 'c, 'd, 'a) Ir.Backend_intf.context -> ('b, 'c, 'd, 'a) Ir.Backend_intf.context
val sync : unit -> unit
val is_done : unit -> bool
val will_wait_for : 'a -> unit -> unit
val device : device
val get_device : ordinal:Base.Int.t -> device
val num_devices : unit -> int
val get_used_memory : 'a -> Base.int
val new_stream : 'a -> 'a
val all_work : 'a -> unit
val is_idle : 'a -> bool
val await : 'a -> unit
val static_properties : Base.Sexp.t
val schedule_task : 'a -> Ir.Task.t -> Base.unit
val get_global_debug_info : unit -> Sexplib0.Sexp.t
val get_debug_info : device -> Sexplib0.Sexp.t