Skip to content

Commit f55ad8c

Browse files
committed
Arm backend: Document the new Arm runner workflow
- Explain the auto-configured runner build flow and scratch directory expectations in examples/arm/README.md. - Update the Ethos-U notebook to export EXECUTORCH_ROOT before calling standalone cmake. Change-Id: If9f4f456c03b7a36a27ffdd1dfd1873ec286d07b Signed-off-by: Usamah Zaheer <usamah.zaheer@arm.com>
1 parent a8fb28f commit f55ad8c

4 files changed

Lines changed: 26 additions & 26 deletions

File tree

examples/arm/README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<!--
2+
Copyright 2023-2026 Arm Limited and/or its affiliates.
3+
4+
This source code is licensed under the BSD-style license found in the
5+
LICENSE file in the root directory of this source tree.
6+
-->
7+
18
## ExecuTorch for Arm backends Ethos-U, VGF and Cortex-M
29

310
This project contains scripts to help you setup and run a PyTorch
@@ -11,12 +18,19 @@ The main scripts are `setup.sh`, `run.sh` and
1118
`setup.sh` will install the needed tools and with --root-dir <FOLDER>
1219
you can change the path to a scratch folder where it will download and generate build
1320
artifacts. If supplied, you must also supply the same folder to run.sh with
14-
--scratch-dir=<FOLDER> If not supplied both script will use examples/arm/arm-scratch
21+
--scratch-dir=<FOLDER> If not supplied both scripts will use examples/arm/arm-scratch.
1522

1623
`run.sh` can be used to build, run and test a model in an easy way and it will call cmake for you
1724
and in cases you want to run a simulator it will start it also. The script will call `aot_arm_compiler.py`
1825
to convert a model and include it in the build/run.
1926

27+
For bare-metal Ethos-U builds `run.sh` configures the standalone
28+
`examples/arm/executor_runner/standalone` CMake entry point automatically. If
29+
`--build-dir` is omitted, the script creates and owns a build tree under
30+
`arm_test/<target>_<build_type>`. Supplying `--build-dir` reuses an existing tree
31+
(for example a VGF host build or out-of-tree configuration) and `run.sh`
32+
verifies it exposes the runner options it needs before compiling.
33+
2034
Build and test artifacts are by default placed under the folder arm_test folder
2135
this can be changed with --et_build_root=<FOLDER>
2236

examples/arm/cortex_m_mv2_example.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
"execution_count": null,
137137
"metadata": {},
138138
"outputs": [],
139-
"source": "%%bash \n# Build example executor runner application to examples/arm/cortex_m_mv2_example\n# Note that this is the same runner as used in the Ethos-U example, creating some overlap in the config even though the Ethos-U is not used.\ncmake -DCMAKE_TOOLCHAIN_FILE=$(pwd)/ethos-u-setup/arm-none-eabi-gcc.cmake \\\n -DCMAKE_BUILD_TYPE=Release \\\n -DET_PTE_FILE_PATH=cortex_m_mv2_example.bpte \\\n -DTARGET_CPU=cortex-m55 \\\n -DETHOSU_TARGET_NPU_CONFIG=ethos-u55-128 \\\n -DMEMORY_MODE=Shared_Sram \\\n -DET_BUNDLE_IO=ON \\\n -DSYSTEM_CONFIG=Ethos_U55_High_End_Embedded \\\n -Bcortex_m_mv2_example \\\n executor_runner\ncmake --build cortex_m_mv2_example -j$(nproc) -- arm_executor_runner"
139+
"source": "%%bash \n# Build example executor runner application to examples/arm/cortex_m_mv2_example\n# Note that this is the same runner as used in the Ethos-U example, creating some overlap in the config even though the Ethos-U is not used.\ncmake -DCMAKE_TOOLCHAIN_FILE=$(pwd)/ethos-u-setup/arm-none-eabi-gcc.cmake \\\n -DCMAKE_BUILD_TYPE=Release \\\n -DET_PTE_FILE_PATH=cortex_m_mv2_example.bpte \\\n -DTARGET_CPU=cortex-m55 \\\n -DETHOSU_TARGET_NPU_CONFIG=ethos-u55-128 \\\n -DMEMORY_MODE=Shared_Sram \\\n -DET_BUNDLE_IO=ON \\\n -DSYSTEM_CONFIG=Ethos_U55_High_End_Embedded \\\n -Bcortex_m_mv2_example \\\n -S executor_runner/standalone\ncmake --build cortex_m_mv2_example -j$(nproc) -- arm_executor_runner"
140140
},
141141
{
142142
"cell_type": "markdown",
@@ -179,4 +179,4 @@
179179
},
180180
"nbformat": 4,
181181
"nbformat_minor": 4
182-
}
182+
}

examples/arm/ethos_u_minimal_example.ipynb

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -171,26 +171,8 @@
171171
"source": [
172172
"## Build executor runtime\n",
173173
"\n",
174-
"After the AOT compilation flow is done, the runtime can be cross compiled and linked to the produced .pte-file using the Arm cross-compilation toolchain. This is done in two steps:\n",
175-
"1. Build and install the executorch libraries and EthosUDelegate.\n",
176-
"2. Build and link the `arm_executor_runner` and generate kernel bindings for any non delegated ops."
177-
]
178-
},
179-
{
180-
"cell_type": "code",
181-
"execution_count": null,
182-
"metadata": {},
183-
"outputs": [],
184-
"source": [
185-
"%%bash\n",
186-
"# Ensure the arm-none-eabi-gcc toolchain and FVP:s are available on $PATH\n",
187-
"source arm-scratch/setup_path.sh\n",
188-
"\n",
189-
"# Build executorch libraries cross-compiled for arm baremetal to executorch/cmake-out-arm\n",
190-
"cmake --preset arm-baremetal \\\n",
191-
"-DCMAKE_BUILD_TYPE=Release \\\n",
192-
"-B../../cmake-out-arm ../..\n",
193-
"cmake --build ../../cmake-out-arm --target install -j$(nproc) "
174+
"After the AOT compilation flow finishes, cross-compile and link the runtime by configuring the standalone `examples/arm/executor_runner/standalone` CMake project with the Arm toolchain.\n",
175+
"It automatically pulls the ExecuTorch checkout in as a dependency so the delegate, kernels, and runner util are rebuilt alongside the application, and it generates kernel bindings for any non-delegated ops found in the `.pte`.\n"
194176
]
195177
},
196178
{
@@ -201,6 +183,8 @@
201183
"source": [
202184
"%%bash \n",
203185
"source arm-scratch/setup_path.sh\n",
186+
"# Ensure CMake resolves the ExecuTorch checkout root regardless of caller env\n",
187+
"export EXECUTORCH_ROOT=$(cd ../.. && pwd)\n",
204188
"\n",
205189
"# Build example executor runner application to examples/arm/ethos_u_minimal_example\n",
206190
"cmake -DCMAKE_TOOLCHAIN_FILE=$(pwd)/ethos-u-setup/arm-none-eabi-gcc.cmake \\\n",
@@ -211,7 +195,7 @@
211195
" -DMEMORY_MODE=Shared_Sram \\\n",
212196
" -DSYSTEM_CONFIG=Ethos_U55_High_End_Embedded \\\n",
213197
" -Bethos_u_minimal_example \\\n",
214-
" executor_runner\n",
198+
" -S executor_runner/standalone\n",
215199
"cmake --build ethos_u_minimal_example -j$(nproc) -- arm_executor_runner"
216200
]
217201
},
@@ -232,6 +216,8 @@
232216
"source": [
233217
"%%bash \n",
234218
"source arm-scratch/setup_path.sh\n",
219+
"# Ensure CMake resolves the ExecuTorch checkout root regardless of caller env\n",
220+
"export EXECUTORCH_ROOT=$(cd ../.. && pwd)\n",
235221
"\n",
236222
"# Run the example\n",
237223
"../../backends/arm/scripts/run_fvp.sh --elf=ethos_u_minimal_example/arm_executor_runner --target=ethos-u55-128"

examples/arm/pruning_minimal_example.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@
453453
" -DMEMORY_MODE=Shared_Sram \\\n",
454454
" -DSYSTEM_CONFIG=Ethos_U85_SYS_DRAM_Mid \\\n",
455455
" -Bethos_u_original_model \\\n",
456-
" executor_runner\n",
456+
" -S executor_runner/standalone\n",
457457
"cmake --build ethos_u_original_model -j$(nproc) -- arm_executor_runner"
458458
]
459459
},
@@ -499,7 +499,7 @@
499499
" -DMEMORY_MODE=Shared_Sram \\\n",
500500
" -DSYSTEM_CONFIG=Ethos_U85_SYS_DRAM_Mid \\\n",
501501
" -Bethos_u_pruned_model \\\n",
502-
" executor_runner\n",
502+
" -S executor_runner/standalone\n",
503503
"cmake --build ethos_u_pruned_model -j$(nproc) -- arm_executor_runner"
504504
]
505505
},

0 commit comments

Comments
 (0)