Embedded Rust Interface

Building upon the great work of the TVM community in making microTVM a success, the natural companion for the [RFC] [uTVM] Embedded C Runtime Interface is the Embedded Rust API. Allowing us to write Rust applications such as:

#[path = "../../codegen/host/src/tvmgen_default.rs"]
mod tvmgen_default;

mod my_app_logic;

fn main() {
  let mut input_data: [i8; 25600] = my_app_logic::create_input();
  let mut output_data: [f32; 12] = my_app_logic::create_output();

  let mut model_input = tvmgen_default::Inputs::new(&mut input_data);
  let mut model_output = tvmgen_default::Outputs::new(&mut output_data);

  tvmgen_default::run(&mut model_input, &mut model_output);
  assert_eq!(output_data, my_app_logic::expected_output());
}

More detail is available on the RFC itself, all feedback welcome :smile_cat:

2 Likes