lib/accy/src/tensor/session/root.zig

daab053ee43316e1809a84551d573ddd1e5bf3d2

 1 //! A way to compile tensor programs for the host CPU inside the calling process and run them
 2 //! directly on memory the caller supplies. A host program, possibly written in another language,
 3 //! needs to compile and run array programs through a few calls and report failures across a
 4 //! language boundary as plain numbers. A host that hands over large buffers wants them used in
 5 //! place on every run. Host code can keep a program's name after it released the program, and a
 6 //! reused slot would then run the wrong program.
 7 //!
 8 //! A table inside the host process (*session*) holds up to 64 compiled programs, which arrive as
 9 //! versioned bytes and run on the CPU backend. Each compiled program is named by its slot and a
10 //! generation count that changes on release (*handle*), so a name kept past release is refused.
11 //! Runs use the caller's buffers in place wherever the plans allow, and inputs the program writes
12 //! are copied first so the caller's inputs stay unchanged. Every failure maps to one fixed number
13 //! that never changes meaning (*status code*).
14 //!
15 //! - *descriptor*: the element type, axes, byte length and alignment of one program input or
16 //!   output.
17 const session = @import("session.zig");
18 
19 pub const Session = session.Session;
20 pub const Handle = session.Handle;
21 pub const Descriptor = session.Descriptor;
22 pub const Error = session.Error;
23 pub const Status = session.Status;
24 pub const max_programs = session.max_programs;