Skip to main content

irithyll_core/
lib.rs

1//! Zero-alloc inference engine for irithyll streaming ML models.
2//!
3//! `irithyll-core` provides a compact binary format and branch-free traversal
4//! for deploying trained SGBT models on embedded targets (Cortex-M0+, 32KB flash).
5//!
6//! # Features
7//!
8//! - **12-byte packed nodes** — 5 nodes per 64-byte cache line
9//! - **Zero-copy `EnsembleView`** — constructed from `&[u8]`, no allocation after validation
10//! - **Branch-free traversal** — `cmov`/`csel` child selection, no pipeline stalls
11//! - **`#![no_std]`** — zero mandatory dependencies, runs on bare metal
12//!
13//! # Usage
14//!
15//! ```ignore
16//! use irithyll_core::{EnsembleView, FormatError};
17//!
18//! // Load packed binary (e.g. from flash, file, or network)
19//! let packed_bytes: &[u8] = &[/* exported via irithyll::export_embedded() */];
20//! let view = EnsembleView::from_bytes(packed_bytes)?;
21//! let prediction = view.predict(&[1.0f32, 2.0, 3.0]);
22//! ```
23
24#![no_std]
25#![deny(unsafe_op_in_unsafe_fn)]
26#![cfg_attr(docsrs, feature(doc_cfg))]
27
28#[cfg(test)]
29extern crate alloc;
30
31pub mod error;
32pub mod packed;
33pub mod quantize;
34pub mod traverse;
35pub mod view;
36
37// Convenience re-exports
38pub use error::FormatError;
39pub use packed::{EnsembleHeader, PackedNode, TreeEntry};
40pub use view::EnsembleView;