iree-embedded 0.1.0

Safe no_std Rust API for ML inference on Cortex-M via the IREE runtime.
docs.rs failed to build iree-embedded-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

iree-embedded

CI crates.io docs.rs license

A safe, no_std Rust API for machine-learning inference on Cortex-M microcontrollers, built on IREE's bare-metal C runtime.

IREE is an ahead-of-time compiler plus a small runtime: a model is compiled once on a host into a self-contained artefact, and the device only loads and executes it. This crate wraps the runtime half in six RAII types (Arena, Instance, Device, Context, Tensor, Error) so leaks and double-frees become compile-time impossibilities and every fallible call returns a Result carrying the real IREE status message.

use iree_embedded::{Arena, Context, Device, Instance, Tensor, link_kernels, singleton};

// VMFB is the embedded compiled model (include_vmfb!).
let arena = Arena::new(singleton!([u8; 56 * 1024] = [0; 56 * 1024]));
let instance = Instance::new(&arena)?;
let device = Device::local_sync_static(&arena, &[link_kernels!(my_model_library_query)])?;
let ctx = Context::new(&instance, &device, VMFB, &arena)?;
let out = ctx.invoke(ctx.resolve("module.main")?, &[&input], &arena)?;

Runtime dependency

This crate links the IREE C runtime, which is not built by cargo itself. iree-embedded-sys's build script downloads the matching prebuilt runtime for your target from the project's GitHub releases, or uses a local build when IREE_RUNTIME_DIR / IREE_SRC_DIR are set. See the repository for details and a complete no_std firmware example (live keyword spotting on a BBC micro:bit v2).

Licence

Licensed under either of Apache-2.0 or MIT at your option.