Ir.Tnodemodule Lazy = Utils.Lazymodule Nd = NdarrayA possible algorithm for deciding sharing within a single device:
If a tensor node is shared cross-stream, within-device copying is a NOOP as source and destination pointers are in that case identical.
val sharing_of_sexp : Sexplib0.Sexp.t -> sharingval sexp_of_sharing : sharing -> Sexplib0.Sexp.ttype memory_type = | Unset_hosted| ConstantThe tensor node does not change after initialization.
*)| NonconstantOne of: Changed_on_devices, Volatile.
| Changed_on_devices of sharingThe tensor node will only change on host via a to_host call.
| VolatileThe tensor node will only change on any device via a from_host call possibly followed by device_to_device.
val memory_type_of_sexp : Sexplib0.Sexp.t -> memory_typeval sexp_of_memory_type : memory_type -> Sexplib0.Sexp.tval compare_memory_type : memory_type -> memory_type -> Base.intval equal_memory_type : memory_type -> memory_type -> Base.booltype memory_mode = | Effectively_constantEither Hosted Constant, or a subset of Virtual.
| VirtualThe tensor node's computations are inlined on a per-scalar basis.
*)| Never_virtualOne of: Local, On_device, Hosted.
| LocalThe full tensor node is cached for the duration of a computation but not persisted across calls to compiled functions. It is not available for merging across devices.
*)| Device_onlyOne of: Local, On_device.
| On_device of sharingThe tensor node is stored on the devices that compute with it and persisted across function calls. It is available for merging across devices (for devices that support merging / P2P), but not (directly) for visualization or storing to disk.
*)| MaterializedOne of: On_device, Hosted.
| Hosted of memory_typeval memory_mode_of_sexp : Sexplib0.Sexp.t -> memory_modeval sexp_of_memory_mode : memory_mode -> Sexplib0.Sexp.tval compare_memory_mode : memory_mode -> memory_mode -> Base.intval equal_memory_mode : memory_mode -> memory_mode -> Base.boolval delayed_prec_of_sexp : Sexplib0.Sexp.t -> delayed_precval sexp_of_delayed_prec : delayed_prec -> Sexplib0.Sexp.tval equal_delayed_prec : delayed_prec -> delayed_prec -> Base.boolval sexp_of_prepare : prepare -> Sexplib0.Sexp.ttype t = {array : Nd.t Base.option Lazy.t;prec : Ops.prec Lazy.t;dims : Base.int Base.array Lazy.t;padding : (Ops.axis_padding Base.array * Base.float) Base.option Lazy.t;If the tensor node is pre-padded, this is the pair (left padding, right padding) and the padding value.
*)size_in_bytes : Base.int Lazy.t;id : Base.int;label : Base.string Base.list;Display information. It is better if the last element of the list is the most narrow or alphanumeric, e.g. an identifier.
*)mutable delayed_prec_unsafe : delayed_prec;mutable memory_mode : (memory_mode * Base.int) Base.option;mutable backend_info : Base.Sexp.t;mutable code_name : Base.string Base.option;mutable prepare_read : prepare Base.option;mutable prepare_write : prepare Base.option;mutable devices_not_lagging_host : Base.Hash_set.M(Base.Int).t;The unique ids of devices that either read the most recent modification of the host buffer, or computed the most recent modification of the node themselves, whether or not it has been transferred to the host yet.
*)}val sexp_of_t : t -> Sexplib0.Sexp.tval num_elems : t -> Base__Int.tval dims_without_padding : t -> Base.int Base.arrayval get_padding : t -> (Ops.axis_padding Base.array * Base.float) Base.optionval id : t -> Base.String.tval label : t -> Base.String.tval prepare_read :
is_done:(Base.unit -> Base.bool) ->
sync:(Base.unit -> Base.unit) ->
transfer:(Base.unit -> Base.unit) ->
t ->
unitval prepare_write :
is_done:(Base.unit -> Base.bool) ->
sync:(Base.unit -> Base.unit) ->
t ->
unitval debug_name : t -> Base.String.tval debug_memory_mode : (memory_mode * Base.Int.t) option -> Base.String.tval log_debug_info : from_log_level:int -> t -> unitval default_to_most_local : t -> Base__Int.t -> unitThe one exception to "most local" is that the sharing property is kept at Unset.
val is_virtual_force : t -> Base.int -> boolval is_hosted_force : t -> Base__Int.t -> boolval is_materialized_force : t -> Base__Int.t -> boolval is_in_context_force :
use_host_memory:'a Base.option ->
t ->
Base.int ->
Base.boolval known_not_materialized : t -> boolval known_constant : t -> boolval known_volatile : t -> boolval known_non_virtual : t -> boolval known_virtual : t -> boolval known_non_cross_stream : t -> boolval potentially_cross_stream : t -> Base.boolval mode_is_unspecified : t -> boolval update_memory_mode : t -> memory_mode -> Base.int -> unitupdate_memory_sharing tn sharing provenance preserves the memory mode of tn while updating the cross-stream sharing property, except that Hosted Nonconstant is further specialized to Hosted (Changed_on_devices sharing).
include sig ... endval comparator : (t, comparator_witness) Base__Comparator.comparatorval hash : t -> Base__Ppx_hash_lib.Std.Hash.hash_valueval hash_fold_t :
Base__.Ppx_hash_lib.Std.Hash.state ->
t ->
Base__.Ppx_hash_lib.Std.Hash.stateval hash_t : t -> Base__Ppx_hash_lib.Std.Hash.hash_valuemodule Comp : sig ... endval sexp_of_t_set : (t, 'a) Base.Set.t -> Sexplib0.Sexp.ttype 'a t_map = (t, 'a, comparator_witness) Base.Map.tval sexp_of_t_map :
('a -> Sexplib0.Sexp.t) ->
(t, 'a, 'b) Base.Map.t ->
Sexplib0.Sexp.tval has : t -> boolval dims_to_string : ?with_axis_numbers:bool -> t -> Base.String.tval no_grad_ident_label : t -> bool * Base.String.t optionval styled_ident :
repeating_nograd_idents:(Base.String.t, 'a) Base.Hashtbl.t ->
repeating_grad_idents:(Base.String.t, 'a) Base.Hashtbl.t ->
[< `Heuristic_ocannl of [< `Dot_grad | `Under_grad ]
| `Name_and_label
| `Name_only ] ->
t ->
Base.String.tval update_code_name : t -> Base.string -> unitval header : t -> stringmodule Registry : sig ... endval registry : Registry.tval create :
delayed_prec ->
id:Base__Int.t ->
label:Base.String.t Base.List.t ->
dims:Base.int Base.array Lazy.t ->
padding:(Ops.axis_padding Base.array * Base.float) Base.option Lazy.t ->
unit ->
tval create_from_padded :
id:Base.int ->
label:Base.string Base.list ->
ndarray:Nd.t ->
padding:(Ops.axis_padding Base.array * Base.float) Base.option ->
unit ->
tval create_with_reshape :
id:Base__Int.t ->
label:Base.String.t Base.List.t ->
base_ndarray:Nd.t ->
dims:Base__Int.t Base.Array.t Lazy.t ->
padding:(Ops.axis_padding Base.array * Base.float) Base.option Lazy.t ->
from_padded:bool ->
unit ->
tval initial_default_prec : Ops.precval find : id:Base.int -> Registry.data optionval do_read : t -> unitval do_write : t -> unitval points_1d :
?from_axis:Base__Int.t ->
xdim:int ->
t ->
Base.Float.t Base.Array.tval points_2d :
?from_axis:Base__Int.t ->
xdim:int ->
ydim:int ->
t ->
(Base.Float.t * Base.Float.t) Base.Array.tval set_value : t -> Base__Int.t Base.Array.t -> Base.float -> unitval get_value : t -> Base__Int.t Base.Array.t -> Base.Float.tval set_values : t -> Base.float Base.Array.t -> unitval get_values : t -> Base.Float.t Base.Array.tval print_accessible_headers :
?pred:(Registry.data -> bool) ->
unit ->
Base.unitval log_accessible_headers : ?pred:(Registry.data -> bool) -> unit -> unit