Ariel-ML: Machine Learning Support with IREE for Ariel OS
-
It is recommended to use Miniconda to set up the environment for reproducibility. All dependencies are listed in the
environment.ymlfile included in this repository. Run the following command to create the same environment:conda env create --file environment.yml
-
Set up Ariel OS Follow the official installation guide.
-
Set up IREE We use a the Rust binding of IREE, provided by eerie: Clone the eerie repository and switch to the
wip/ariel_mlbranch:git switch wip/ariel_ml
-
2.1 Install the IREE compiler
pip install iree-compiler
-
2.2 Initialize submodules (IREE runtime) The IREE runtime is embedded as a submodule under the Eerie repo. From the Eerie root, run:
git submodule update --init --recursive
⚠️ This step may consume ~3 GiB of disk space.
-
-
Configure package paths
- Update the
pathfield inlaze-project.ymlto point to your cloned Ariel OS repository. - Update the Eerie package path in
Cargo.toml. - Update the
IREE_PATHin.cargo/config.tomlto point to the IREE repository. You may find it undereerie/eerie-sys, or you may use your own version.
- Update the
Once these steps are complete, your playground environment is ready for experimenting with ML models.
Currently, we have tested two models under the native target:
- Toy model:
simple_mul - Real-world model:
resnet50
You can select a model with the --features option:
laze build -b native run --features {resnet50,simple_mul}The build system will automatically compile the chosen model.
The model file resnet50.mlir is quite large (~100 MB) and is not included in the repository.
You can either:
-
Download it directly: Google Drive link
-
Or generate your own version using the script:
python load_mlir.py cat115.jpg
This toy model performs an element-wise multiplication of two floating-point vectors (4 elements each).
no_std under native.
The issue arises because the IREE runtime loads the model code into a memory section without execution permission (heap) and then attempts to execute it, causing a SIGSEGV on our testbed.
Workaround:
To run it successfully, change the Eerie dependency features in Cargo.toml to:
eerie = { path = "/path/to/eerie", features = ["runtime, std"], default-features = false}