Module Ir.Host_inits

module Nd = Ndarray
module Tn = Tnode

A weakly-owned association from a tensor node to the host buffer holding its initialization data (ndarray-backed literals and persistence-loaded nodes). After gh-ocannl-333 the data is no longer stored on Tnode.t; instead it is registered here at construction and uploaded into a backend context, on demand, at link time.

The table is:

module Init_table : sig ... end
val table : Nd.t Base.Lazy.t Init_table.t
val register : Init_table.key -> Nd.t Base.Lazy.t -> unit

Records the host initialization buffer for tn. A later registration for the same node overwrites the earlier one (the buffers describe the same node's data).

val find : Init_table.key -> Nd.t Base.Lazy.t option

Returns the host initialization buffer for tn, if any, without removing it.

val mem : Init_table.key -> bool

Whether tn has registered host initialization data.