mirror of
https://github.com/AmbiML/sparrow-kata-full.git
synced 2025-09-22 03:47:23 +00:00
MlCoordinator: get models in BundleImage format from SecurityCoordinator
- remove vestiges of mapped ELF file; models now come from SecurityCoordinator using a LoadModel request in the form of a BundleImage - change execute api to take a bundle_id & model_id - track loded bundle_id & model_id to handle switching between models - load_elf -> load_image (which loads a BundleImage) - add a client-side wrapper to hide marshalling details - add a copyregion (VSpace hole) for processing BundleImages - integrate with slot allocator - setup the heap (needed for various things) Change-Id: I50f3526bddefcdb67b742d42ca396bfefc10801f GitOrigin-RevId: 80aa0da34b057b334b7d76932c7ad25146364569
This commit is contained in:
@@ -4,3 +4,7 @@ cargo-features = ["edition2021"]
|
||||
name = "kata-ml-interface"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
cstr_core = { version = "0.2.3", default-features = false }
|
||||
kata-memory-interface = { path = "../../MemoryManager/kata-memory-interface" }
|
||||
|
@@ -1,14 +1,17 @@
|
||||
#![no_std]
|
||||
|
||||
use cstr_core::CString;
|
||||
use kata_memory_interface::ObjDescBundle;
|
||||
|
||||
pub trait MlCoordinatorInterface {
|
||||
fn execute(&mut self);
|
||||
fn execute(&mut self, bundle_id: &str, model_id: &str);
|
||||
fn set_continuous_mode(&mut self, mode: bool);
|
||||
}
|
||||
|
||||
pub trait MlCoreInterface {
|
||||
fn enable_interrupts(&mut self, enabled: bool);
|
||||
fn run(&mut self);
|
||||
fn load_elf(&mut self, elf_slice: &[u8]) -> Result<(), &'static str>;
|
||||
fn load_image(&mut self, frames: &ObjDescBundle) -> Result<(), &'static str>;
|
||||
fn get_return_code() -> u32;
|
||||
fn get_fault_register() -> u32;
|
||||
fn clear_host_req();
|
||||
@@ -16,3 +19,21 @@ pub trait MlCoreInterface {
|
||||
fn clear_instruction_fault();
|
||||
fn clear_data_fault();
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(dead_code)]
|
||||
pub fn kata_mlcoord_execute(bundle_id: &str, model_id: &str)
|
||||
-> Result<(),cstr_core:: NulError>
|
||||
{
|
||||
extern "C" {
|
||||
// NB: this assumes the MlCoordinator component is named "mlcoord".
|
||||
fn mlcoord_execute(
|
||||
c_bundle_id: *const cstr_core::c_char,
|
||||
c_model_id: *const cstr_core::c_char
|
||||
);
|
||||
}
|
||||
let bundle_id_cstr = CString::new(bundle_id)?;
|
||||
let model_id_cstr = CString::new(model_id)?;
|
||||
unsafe { mlcoord_execute(bundle_id_cstr.as_ptr(), model_id_cstr.as_ptr()) };
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user