Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Examples for Arm backends Ethos-U, VGF and Cortex-M

This directory contains documentation and scripts to help you setup and run a PyTorch model on the Arm backend via ExecuTorch.

Python package setup

For Ethos-U examples, install the current checkout and the dependencies needed for ahead-of-time (AOT) export in a clean Python environment:

python3.12 -m venv .venv
source .venv/bin/activate
./install_executorch.sh --optional-dependency ethos_u

After the base dependencies are installed, the equivalent editable package command is pip install -e '.[ethos_u]' --no-build-isolation. The ethos_u extra provides host-side export dependencies; it does not install the Arm toolchain, FVPs, or target runtime. Run setup.sh below to install the cross compiler, FVPs, and backend tools used by these examples.

setup.sh

setup.sh downloads the Arm cross-compilation toolchain and Corstone FVP simulators, installs the backend dependencies, and generates setup_path.sh scripts for adding those tools to your environment. Optional flags also install VGF/MLSDK and Vulkan dependencies.

Example to install the default Arm backend dependencies and add them to your current shell:

./examples/arm/setup.sh --i-agree-to-the-contained-eula
source examples/arm/arm-scratch/setup_path.sh

run.sh

run.sh is an end-to-end helper for building and executing an Arm backend example. It sources the setup_path.sh script generated by setup.sh, runs aot_arm_compiler.py to convert the selected model to a .pte or .bpte, builds the matching runner with CMake, and starts the simulator or runtime for the selected target when --build_only is not set.

Build and test artifacts are written to arm_test by default. Use --et_build_root=<FOLDER> to choose another build root.

For example, after running setup.sh and sourcing the generated setup_path.sh, build and run a model on an Ethos-U85 target with:

./examples/arm/run.sh --model_name=examples/arm/example_modules/add.py --target=ethos-u85-128

For bundled input/output and ETDump testing:

./examples/arm/run.sh --model_name=lstm --target=ethos-u85-128 --bundleio --etdump

For Cortex-M testing, use a Cortex-M target and bundled I/O:

./examples/arm/run.sh --model_name=mv2 --target=cortex-m55 --bundleio

Example Contents

Notebook examples

Application examples

Utility examples and guides

  • executor_runner - Advanced test and diagnostic runner for BundleIO, ETDump, profiling, semihosted files, and backend regression tests.
  • ethos-u-porting-guide.md - Notes for adapting the example Ethos-U runtime integration to another target.
  • export_standalone_tosa_graph.py - Example of exporting a standalone TOSA graph with multiple outputs.
  • visualize.py - Helper used by run.sh --model_explorer to visualize TOSA or PTE graphs.

Project Templates

These project templates provide alternative starting points with different toolchains and build systems: