Skip to content

Commit c0cbc74

Browse files
authored
Arm backend: Modernise and standalone the executor runner (pytorch#19018)
## Summary This PR modernizes the ExecuTorch Arm bare-metal runner workflow so users can move from a PyTorch model to a runnable Arm executor runner with fewer manual build-system steps, stronger validation, and faster repeated local iteration. The main change is a new standalone Arm executor runner CMake entry point. `run.sh` now acts as the orchestration layer for common Ethos-U bare-metal flows: it can derive build directories, configure the standalone runner with Arm bare-metal defaults, stage generated PTE/BPTE files, validate reused CMake caches, build the needed runner target, locate the runner binary, and invoke FVP. ## Problem Before this change, the Arm runner workflow depended on manually stitching together ExecuTorch build/install artifacts, runner CMake configuration, PTE input wiring, toolchain and target settings, optional debug features, and repeated install/export steps. That made the workflow harder to explain, fragile in CI, slower to iterate on locally, and easy to break when reusing a build directory configured for a different target or feature set. And a shorter version if the PR description is already long: ## CMake Architecture Change ```mermaid flowchart LR subgraph Before A1["Build ExecuTorch<br/>arm-baremetal preset"] --> A2["Install/export artifacts"] A2 --> A3["Configure runner CMake<br/>examples/arm/executor_runner"] A4["PTE / BPTE"] --> A3 A3 --> A5["arm_executor_runner ELF"] end subgraph After B1["run.sh"] --> B2["Validate / choose build dir"] B2 --> B3["Standalone runner CMake<br/>examples/arm/executor_runner/standalone"] B4["PTE / BPTE"] --> B1 B3 --> B5["ExecuTorch top-level CMake<br/>as subdirectory"] B3 --> B6["Arm CMake helpers + presets"] B5 --> B7["arm_executor_runner ELF"] B6 --> B7 end ``` ## What Changed - Added `examples/arm/executor_runner/standalone` as the supported standalone CMake entry point for `arm_executor_runner`. - Added shared Arm CMake helpers for Ethos-U SDK setup, required target validation, and predictable runner output paths. - Updated `build_executor_runner.sh` and `run.sh` to use the standalone runner workflow. - Added deterministic default build directories under `--et_build_root`. - Added cache validation for reused build directories, including target, toolchain, selected ops, PTE placement, BundleIO, ETDump, and devtools settings. - Added PTE/BPTE staging so repeated runs can reuse the same configured CMake build directory. - Integrated selective-op handling into the standalone runner path. - Cleaned up bare-metal install/export behavior so standalone builds can consume reusable build-tree artifacts. - Updated Arm README and notebooks for the new workflow. ## Iteration Speed Repeated local PTE-to-runner iteration is now **8x faster** because `run.sh` can reuse the configured standalone CMake build directory, stage updated PTE/BPTE payloads into the existing cache wiring, and rebuild only the needed runner target instead of repeating the full manual configure/install/export flow. This is a developer workflow speedup, not a model runtime speedup. ## Result For common Ethos-U bare-metal usage, the user-facing path is now script-owned and repeatable: 1. Run Arm setup. 2. Run `examples/arm/run.sh` with a model and target. 3. Reuse or inspect the generated build directory under `--et_build_root`. 4. Iterate by regenerating the PTE/BPTE and rebuilding through the same validated CMake cache. VGF host flows remain explicit: `run.sh` requires an existing `--build-dir` for VGF-style host builds rather than auto-configuring them as bare-metal runner builds. ## Testing Validated through the Arm backend runner, bare-metal, VGF, and CI workflows covered by this stack. cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani --------- Signed-off-by: Usamah Zaheer <usamah.zaheer@arm.com>
1 parent 8debe93 commit c0cbc74

25 files changed

Lines changed: 1305 additions & 296 deletions

.ci/scripts/test_cortex_m_e2e.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ et_root_dir=$(realpath "${script_dir}/../..")
1919

2020
# Quantization is the default for the cortex-m55 target; run.sh's
2121
# arg parser only recognizes --no_quantize, so we omit any explicit flag.
22+
export ARM_FVP_INSTALL_I_AGREE_TO_THE_CONTAINED_EULA=True
2223
bash "${et_root_dir}/examples/arm/run.sh" \
2324
--model_name="${MODEL}" \
2425
--target=cortex-m55 \

CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,23 @@ announce_configured_options(BUILD_TESTING)
160160
load_build_preset()
161161
include(${PROJECT_SOURCE_DIR}/tools/cmake/preset/default.cmake)
162162

163+
# Keep bare-metal installs enabled only when ExecuTorch owns the top-level
164+
# build. Standalone consumers (e.g., the runner) set
165+
# EXECUTORCH_BAREMETAL_SKIP_INSTALL=ON but still add ExecuTorch as a subproject,
166+
# which cannot satisfy our install() export dependencies until their own targets
167+
# are configured.
168+
if(DEFINED EXECUTORCH_BAREMETAL_SKIP_INSTALL
169+
AND EXECUTORCH_BAREMETAL_SKIP_INSTALL
170+
AND NOT (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
171+
)
172+
set(CMAKE_SKIP_INSTALL_RULES
173+
ON
174+
CACHE BOOL
175+
"Skip install() rules when ExecuTorch is consumed as a subproject"
176+
FORCE
177+
)
178+
endif()
179+
163180
# Enable ccache if available
164181
find_program(CCACHE_PROGRAM ccache)
165182
if(CCACHE_PROGRAM)

backends/arm/CMakeLists.txt

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,20 @@ if(EXECUTORCH_BUILD_ARM_BAREMETAL OR EXECUTORCH_BUILD_ARM_ETHOSU_LINUX)
6363

6464
add_library(executorch_delegate_ethos_u STATIC ${_arm_backend_sources})
6565
target_link_libraries(executorch_delegate_ethos_u PUBLIC executorch_core)
66+
target_include_directories(
67+
executorch_delegate_ethos_u PRIVATE ${_common_include_directories}
68+
)
6669

6770
if(EXECUTORCH_BUILD_ARM_BAREMETAL)
6871
target_sources(
6972
executorch_delegate_ethos_u
7073
PRIVATE ${EXECUTORCH_ROOT}/backends/arm/runtime/EthosUBackend_Cortex_M.cpp
7174
)
72-
set(DRIVER_ETHOSU_INCLUDE_DIR
75+
set(_ethosu_core_driver_include
7376
"${THIRD_PARTY_ROOT}/ethos-u-core-driver/include"
7477
)
7578
target_include_directories(
76-
executorch_delegate_ethos_u PRIVATE ${DRIVER_ETHOSU_INCLUDE_DIR}
79+
executorch_delegate_ethos_u PRIVATE ${_ethosu_core_driver_include}
7780
)
7881
target_link_libraries(executorch_delegate_ethos_u PUBLIC ethosu_core_driver)
7982
elseif(EXECUTORCH_BUILD_ARM_ETHOSU_LINUX)
@@ -110,7 +113,25 @@ if(EXECUTORCH_BUILD_ARM_BAREMETAL OR EXECUTORCH_BUILD_ARM_ETHOSU_LINUX)
110113
)
111114
endif()
112115

113-
install(TARGETS executorch_delegate_ethos_u EXPORT ExecuTorchTargets)
116+
if(NOT CMAKE_SKIP_INSTALL_RULES)
117+
install(TARGETS executorch_delegate_ethos_u EXPORT ExecuTorchTargets)
118+
119+
if(TARGET ethosu_core_driver)
120+
get_property(
121+
_et_ethosu_core_driver_exported GLOBAL
122+
PROPERTY ET_ETHOSU_CORE_DRIVER_EXPORTED
123+
)
124+
if(NOT _et_ethosu_core_driver_exported)
125+
install(
126+
TARGETS ethosu_core_driver
127+
EXPORT ExecuTorchTargets
128+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
129+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
130+
)
131+
set_property(GLOBAL PROPERTY ET_ETHOSU_CORE_DRIVER_EXPORTED TRUE)
132+
endif()
133+
endif()
134+
endif()
114135

115136
endif()
116137

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Copyright 2026 Arm Limited and/or its affiliates.
2+
#
3+
# This source code is licensed under the BSD-style license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
include_guard(GLOBAL)
7+
8+
function(arm_ethos_u_content_ready SDK_PATH OUT_VAR)
9+
if(EXISTS "${SDK_PATH}/core_platform" AND EXISTS "${SDK_PATH}/core_software")
10+
set(${OUT_VAR}
11+
TRUE
12+
PARENT_SCOPE
13+
)
14+
else()
15+
set(${OUT_VAR}
16+
FALSE
17+
PARENT_SCOPE
18+
)
19+
endif()
20+
endfunction()
21+
22+
function(arm_ethos_u_default_fetch SDK_PATH OUT_VAR)
23+
arm_ethos_u_content_ready("${SDK_PATH}" _arm_ethos_ready)
24+
if(_arm_ethos_ready)
25+
set(${OUT_VAR}
26+
OFF
27+
PARENT_SCOPE
28+
)
29+
else()
30+
set(${OUT_VAR}
31+
ON
32+
PARENT_SCOPE
33+
)
34+
endif()
35+
endfunction()
36+
37+
function(arm_ensure_ethos_u_content SDK_PATH EXECUTORCH_ROOT FETCH_REQUESTED)
38+
arm_ethos_u_content_ready("${SDK_PATH}" _arm_ethos_ready_before)
39+
40+
if(_arm_ethos_ready_before)
41+
return()
42+
endif()
43+
44+
if(NOT FETCH_REQUESTED)
45+
message(
46+
FATAL_ERROR
47+
"No Ethos-U content found at ${SDK_PATH}. Run examples/arm/setup.sh or enable FETCH_ETHOS_U_CONTENT=ON."
48+
)
49+
endif()
50+
51+
fetch_ethos_u_content(${SDK_PATH} ${EXECUTORCH_ROOT})
52+
53+
arm_ethos_u_content_ready("${SDK_PATH}" _arm_ethos_ready_after)
54+
if(NOT _arm_ethos_ready_after)
55+
message(
56+
FATAL_ERROR
57+
"Failed to fetch Ethos-U content into ${SDK_PATH}. Inspect the logs above."
58+
)
59+
endif()
60+
endfunction()
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Copyright 2026 Arm Limited and/or its affiliates.
2+
#
3+
# This source code is licensed under the BSD-style license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
include_guard(GLOBAL)
7+
8+
# Helper routines shared by the standalone runner and any superbuild that reuses
9+
# the runner targets.
10+
11+
function(arm_runner_require_baremetal_targets)
12+
if(NOT TARGET extension_runner_util)
13+
message(
14+
FATAL_ERROR
15+
"extension_runner_util target missing. Configure ExecuTorch (or the standalone runner) with EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON."
16+
)
17+
endif()
18+
19+
if(NOT TARGET quantized_ops_lib OR NOT TARGET quantized_kernels)
20+
message(
21+
FATAL_ERROR
22+
"quantized kernels not found. Ensure EXECUTORCH_BUILD_KERNELS_QUANTIZED=ON when configuring ExecuTorch."
23+
)
24+
endif()
25+
26+
if(NOT TARGET cortex_m_ops_lib OR NOT TARGET cortex_m_kernels)
27+
message(
28+
FATAL_ERROR
29+
"cortex_m backend not found. Ensure EXECUTORCH_BUILD_CORTEX_M=ON when configuring ExecuTorch."
30+
)
31+
endif()
32+
endfunction()
33+
34+
# Ensure a runner target emits its binary to a predictable location. Uses
35+
# FALLBACK_DIR when TARGET_NAME has no runtime output directory set, and also
36+
# fills per-configuration runtime output directories for multi-config generators
37+
# when they are unset.
38+
function(arm_runner_configure_runtime_output TARGET_NAME FALLBACK_DIR)
39+
if(NOT TARGET ${TARGET_NAME})
40+
return()
41+
endif()
42+
43+
get_target_property(_base_runtime_dir ${TARGET_NAME} RUNTIME_OUTPUT_DIRECTORY)
44+
if(NOT _base_runtime_dir
45+
OR _base_runtime_dir STREQUAL "_base_runtime_dir-NOTFOUND"
46+
OR "${_base_runtime_dir}" STREQUAL ""
47+
)
48+
set_target_properties(
49+
${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${FALLBACK_DIR}"
50+
)
51+
set(_base_runtime_dir "${FALLBACK_DIR}")
52+
endif()
53+
54+
if(CMAKE_CONFIGURATION_TYPES)
55+
foreach(_cfg ${CMAKE_CONFIGURATION_TYPES})
56+
string(TOUPPER ${_cfg} _cfg_upper)
57+
set(_cfg_prop "RUNTIME_OUTPUT_DIRECTORY_${_cfg_upper}")
58+
get_target_property(_cfg_dir ${TARGET_NAME} ${_cfg_prop})
59+
if(NOT _cfg_dir
60+
OR _cfg_dir STREQUAL "_cfg_dir-NOTFOUND"
61+
OR "${_cfg_dir}" STREQUAL ""
62+
)
63+
set_target_properties(
64+
${TARGET_NAME} PROPERTIES ${_cfg_prop} "${_base_runtime_dir}/${_cfg}"
65+
)
66+
endif()
67+
endforeach()
68+
endif()
69+
endfunction()

backends/arm/scripts/build_executor_runner.sh

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ set -eu
99
script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
1010
et_root_dir=$(cd ${script_dir}/../../.. && pwd)
1111
et_root_dir=$(realpath ${et_root_dir})
12+
runner_source_dir=${et_root_dir}/examples/arm/executor_runner/standalone
13+
runner_source_dir=$(realpath ${runner_source_dir})
14+
preset_file=${et_root_dir}/tools/cmake/preset/arm_baremetal.cmake
1215
toolchain=arm-none-eabi-gcc
1316
setup_path_script=${et_root_dir}/examples/arm/arm-scratch/setup_path.sh
1417
_setup_msg="please refer to ${et_root_dir}/examples/arm/setup.sh to properly install necessary tools."
@@ -101,6 +104,9 @@ toolchain_cmake=$(realpath ${toolchain_cmake})
101104

102105
source ${setup_path_script}
103106

107+
[[ -f ${preset_file} ]] \
108+
|| { echo "Missing ${preset_file}. ${_setup_msg}"; exit 1; }
109+
104110
if [[ ${pte_file} == "semihosting" ]]; then
105111
pte_data="-DSEMIHOSTING=ON"
106112
else
@@ -122,13 +128,13 @@ else
122128
fi
123129
fi
124130
ethosu_tools_dir=$(realpath ${ethosu_tools_dir})
125-
ethos_u_root_dir="$ethosu_tools_dir/ethos-u"
131+
ethos_u_root_dir="${ethosu_tools_dir}/ethos-u"
126132
mkdir -p "${ethos_u_root_dir}"
127-
ethosu_tools_dir=$(realpath ${ethos_u_root_dir})
128-
129-
et_build_dir=${et_build_root}/cmake-out
130-
mkdir -p ${et_build_dir}
131-
et_build_dir=$(realpath ${et_build_dir})
133+
ethos_u_root_dir=$(realpath ${ethos_u_root_dir})
134+
cmsis_nn_local_path=""
135+
if [[ -d "${ethos_u_root_dir}/core_software/cmsis-nn" ]]; then
136+
cmsis_nn_local_path=$(realpath "${ethos_u_root_dir}/core_software/cmsis-nn")
137+
fi
132138

133139
if [[ ${system_config} == "" ]]
134140
then
@@ -160,34 +166,47 @@ echo "--------------------------------------------------------------------------
160166
echo "Build Arm ${toolchain/-gcc/} executor_runner for ${target} PTE: ${pte_file} using ${system_config} ${memory_mode} ${extra_build_flags} to '${output_folder}'"
161167
echo "--------------------------------------------------------------------------------"
162168

163-
cd ${et_root_dir}/examples/arm/executor_runner
164-
165169
if [ "$bundleio" = true ] ; then
166170
build_bundleio_flags=" -DET_BUNDLE_IO=ON "
171+
candidate_build_dir="${et_build_root}/cmake-out"
172+
if [[ -d "${candidate_build_dir}" ]]; then
173+
candidate_build_dir=$(realpath "${candidate_build_dir}")
174+
build_bundleio_flags+=" -DET_BUILD_DIR_PATH=${candidate_build_dir} "
175+
fi
176+
if [[ -n "${BUNDLED_PROGRAM_LIBRARY_DIR:-}" ]]; then
177+
build_bundleio_flags+=" -DBUNDLED_PROGRAM_LIBRARY_DIR=${BUNDLED_PROGRAM_LIBRARY_DIR} "
178+
fi
167179
fi
168180

169181
if [ "$build_with_etdump" = true ] ; then
170182
build_with_etdump_flags=" -DEXECUTORCH_ENABLE_EVENT_TRACER=ON -DET_DUMP_INTERMEDIATE_OUTPUTS=ON "
171183
fi
184+
devtools_flags=""
185+
if [ "$bundleio" = true ] || [ "$build_with_etdump" = true ] ; then
186+
devtools_flags=" -DEXECUTORCH_BUILD_DEVTOOLS=ON "
187+
fi
172188

173-
echo "Building with BundleIO/etdump/extra flags: ${build_bundleio_flags} ${build_with_etdump_flags} ${extra_build_flags}"
189+
echo "Building with BundleIO/etdump/extra flags: ${build_bundleio_flags} ${build_with_etdump_flags} ${devtools_flags} ${extra_build_flags}"
174190
cmake \
175-
-DCMAKE_BUILD_TYPE=${build_type} \
176-
-DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} \
177-
-DTARGET_CPU=${target_cpu} \
178-
-DET_DIR_PATH:PATH=${et_root_dir} \
179-
-DET_BUILD_DIR_PATH:PATH=${et_build_dir} \
180-
-DETHOS_SDK_PATH:PATH=${ethos_u_root_dir} \
181-
-DETHOSU_TARGET_NPU_CONFIG=${target} \
182-
${pte_data} \
183-
${build_bundleio_flags} \
184-
${build_with_etdump_flags} \
185-
-DPYTHON_EXECUTABLE=$(which python3) \
186-
-DSYSTEM_CONFIG=${system_config} \
187-
-DMEMORY_MODE=${memory_mode} \
191+
-S ${runner_source_dir} \
192+
-B ${output_folder} \
193+
-DEXECUTORCH_ROOT=${et_root_dir} \
194+
-DCMAKE_BUILD_TYPE=${build_type} \
195+
-DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} \
196+
-DTARGET_CPU=${target_cpu} \
197+
-DETHOSU_TARGET_NPU_CONFIG=${target} \
198+
-DEXECUTORCH_BUILD_PRESET_FILE=${preset_file} \
199+
-DEXECUTORCH_BAREMETAL_SKIP_INSTALL=OFF \
200+
${pte_data} \
201+
${build_bundleio_flags} \
202+
${build_with_etdump_flags} \
203+
${devtools_flags} \
204+
-DSYSTEM_CONFIG=${system_config} \
205+
-DMEMORY_MODE=${memory_mode} \
188206
-DEXECUTORCH_SELECT_OPS_LIST="${select_ops_list}" \
189-
${extra_build_flags} \
190-
-B ${output_folder}
207+
-DETHOS_SDK_PATH:PATH=${ethos_u_root_dir} \
208+
${cmsis_nn_local_path:+-DCMSIS_NN_LOCAL_PATH:PATH=${cmsis_nn_local_path}} \
209+
${extra_build_flags}
191210

192211
echo "[${BASH_SOURCE[0]}] Configured CMAKE"
193212

backends/arm/scripts/build_executorch.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ cmake_args=(
8585
-DCMAKE_BUILD_TYPE=${build_type}
8686
-DEXECUTORCH_BUILD_DEVTOOLS=${build_devtools}
8787
-DEXECUTORCH_BUILD_ARM_ETDUMP=${build_with_etdump}
88+
-DEXECUTORCH_BAREMETAL_SKIP_INSTALL=OFF
8889
)
8990

9091
if [[ ${is_linux_musl} -eq 1 ]]; then
@@ -108,7 +109,7 @@ parallel_jobs="$(get_parallel_jobs)"
108109
if [[ ${is_linux_musl} -eq 1 ]]; then
109110
cmake --build ${et_build_dir} -j"${parallel_jobs}" --target executorch_delegate_ethos_u executor_runner --config ${build_type} --
110111
else
111-
cmake --build ${et_build_dir} -j"${parallel_jobs}" --target install --config ${build_type} --
112+
cmake --build ${et_build_dir} -j"${parallel_jobs}" --config ${build_type}
112113
fi
113114

114115
set +x

backends/arm/scripts/docgen/ethos-u/backends-arm-ethos-u-overview.md.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ For the AOT flow, compilation of a model to `.pte` format using the Ethos-U back
2727
- [TOSA Serialization Library](https://www.mlplatform.org/tosa/software.html) for serializing the Exir IR graph into TOSA IR.
2828
- [Ethos-U Vela graph compiler](https://pypi.org/project/ethos-u-vela/) for compiling TOSA flatbuffers into an Ethos-U command stream.
2929

30-
And for building and running the example application available in `examples/arm/executor_runner/`:
30+
And for building and running the example application available in `examples/arm/executor_runner/` through the standalone CMake entry point:
3131
- [Arm GNU Toolchain](https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain) for cross compilation.
3232
- [Arm&reg; Corstone&trade; SSE-300 FVP](https://developer.arm.com/documentation/100966/1128/Arm--Corstone-SSE-300-FVP) for testing on a Arm&reg; Cortex&reg;-M55+Ethos-U55 reference design.
3333
- [Arm&reg; Corstone&trade; SSE-320 FVP](https://developer.arm.com/documentation/109760/0000/SSE-320-FVP) for testing on a Arm&reg; Cortex&reg;-M85+Ethos-U85 reference design.
@@ -55,7 +55,7 @@ For more information on quantization, see [Quantization](arm-ethos-u-quantizatio
5555

5656
## Runtime Integration
5757

58-
An example runtime application is available in [examples/arm/executor_runner](https://github.com/pytorch/executorch/blob/main/examples/arm/executor_runner/), and the steps requried for building and deploying it on a FVP it is explained in the previously mentioned [Arm Ethos-U Backend Tutorial](tutorials/ethos-u-getting-started.md). <!-- @lint-ignore -->
58+
An example runtime application is available in [examples/arm/executor_runner](https://github.com/pytorch/executorch/blob/main/examples/arm/executor_runner/), with a standalone CMake entry point in `examples/arm/executor_runner/standalone`. The steps required for building and deploying it on an FVP are explained in the previously mentioned [Arm Ethos-U Backend Tutorial](tutorials/ethos-u-getting-started.md). <!-- @lint-ignore -->
5959
The example application is recommended to use for testing basic functionality of your lowered models, as well as a starting point for developing runtime integrations for your own targets.
6060
For an in-depth explanation of the architecture of the executor_runner and the steps required for doing such an integration, please refer to [Ethos-U porting guide](https://github.com/pytorch/executorch/blob/main/examples/arm/ethos-u-porting-guide.md).
6161

backends/arm/scripts/docgen/ethos-u/ethos-u-getting-started-tutorial.md.in

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,35 +76,28 @@ To produce a pte file equivalent to the one above, run
7676

7777
### Runtime:
7878

79-
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:
79+
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. Configure the standalone Arm executor runner CMake project to pull in the ExecuTorch build graph, link the Ethos-U delegate, and generate kernel bindings for any non-delegated ops. This produces the `arm_executor_runner` program that will run on target.
8080

81-
First, build and install the ExecuTorch libraries and EthosUDelegate:
8281
```
8382
# In ExecuTorch top-level, with sourced setup_path.sh
84-
cmake -DCMAKE_BUILD_TYPE=Release --preset arm-baremetal -B cmake-out-arm .
85-
cmake --build cmake-out-arm --target install -j$(nproc)
86-
```
87-
Second, build and link the `arm_executor_runner` and generate kernel bindings for any non delegated ops. This is the actual program that will run on target.
88-
89-
```
90-
# In ExecuTorch top-level, with sourced setup_path.sh
91-
cmake -DCMAKE_TOOLCHAIN_FILE=`pwd`/examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake \
83+
cmake -S examples/arm/executor_runner/standalone \
84+
-B ethos_u_minimal_example \
85+
-DEXECUTORCH_ROOT=$(pwd) \
86+
-DCMAKE_TOOLCHAIN_FILE=$(pwd)/examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake \
9287
-DCMAKE_BUILD_TYPE=Release \
9388
-DET_PTE_FILE_PATH=ethos_u_minimal_example.pte \
9489
-DTARGET_CPU=cortex-m55 \
9590
-DETHOSU_TARGET_NPU_CONFIG=ethos-u55-128 \
9691
-DMEMORY_MODE=Shared_Sram \
97-
-DSYSTEM_CONFIG=Ethos_U55_High_End_Embedded \
98-
-Bethos_u_minimal_example \
99-
examples/arm/executor_runner
92+
-DSYSTEM_CONFIG=Ethos_U55_High_End_Embedded
10093
cmake --build ethos_u_minimal_example -j$(nproc) -- arm_executor_runner
10194
```
10295

10396
```{tip}
104-
For a quick start, you can use the script `backends/arm/scripts/build_executor_runner.sh` to build the runner.
97+
For a quick start, you can use the script `backends/arm/scripts/build_executor_runner.sh` to configure and build the standalone runner.
10598
To build a runner equivalent to the one above, run
10699
`./backends/arm/scripts/build_executor_runner.sh --pte=ethos_u_minimal_example.pte`
107-
````
100+
```
108101

109102
The block diagram below shows, at the high level, how the various build artifacts are generated and are linked together to generate the final bare-metal executable.
110103

0 commit comments

Comments
 (0)