Skip to content

Commit 21777b9

Browse files
authored
Arm backend: Attempt using existing flatc in build_executor_runner (pytorch#21884)
It should be available if install_executorch has been run. If found, "Using ExecuTorch flatc: [...]" is echoed. This saves building flatc which takes around 5s even with a warm ccache. Multiplying this with 6 runners in setup_testing.py should save ~30s per build. Additionally reduces the size of the build. cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani Signed-off-by: Erik Lundell <erik.lundell@arm.com>
1 parent 0240bc8 commit 21777b9

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎backends/arm/scripts/build_executor_runner.sh‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ select_ops_list=""
3737
build_bundleio_flags=" -DET_BUNDLE_IO=OFF "
3838
build_with_etdump_flags=" -DEXECUTORCH_ENABLE_EVENT_TRACER=OFF "
3939

40+
find_executorch_flatc() {
41+
python3 - <<'PY' 2>/dev/null || true
42+
import os
43+
import executorch.data.bin as bin
44+
45+
path = os.path.join(os.path.dirname(bin.__file__), "flatc")
46+
if os.path.isfile(path) and os.access(path, os.X_OK):
47+
print(path)
48+
PY
49+
}
50+
4051
help() {
4152
echo "Usage: $(basename $0) [options]"
4253
echo "Note: this developer build script is not a stable public API."
@@ -208,6 +219,13 @@ if [ "$bundleio" = true ] || [ "$build_with_etdump" = true ] ; then
208219
devtools_flags=" -DEXECUTORCH_BUILD_DEVTOOLS=ON "
209220
fi
210221

222+
flatc_flags=""
223+
flatc_executable="$(find_executorch_flatc)"
224+
if [[ -n "${flatc_executable}" ]]; then
225+
flatc_flags=" -DFLATC_EXECUTABLE:FILEPATH=${flatc_executable} "
226+
echo "Using ExecuTorch flatc: ${flatc_executable}"
227+
fi
228+
211229
echo "Building with BundleIO/etdump/extra flags: ${build_bundleio_flags} ${build_with_etdump_flags} ${devtools_flags} ${extra_build_flags}"
212230
cmake \
213231
-S ${runner_source_dir} \
@@ -225,6 +243,7 @@ cmake \
225243
${devtools_flags} \
226244
-DSYSTEM_CONFIG=${system_config} \
227245
-DMEMORY_MODE=${memory_mode} \
246+
${flatc_flags} \
228247
-DEXECUTORCH_SELECT_OPS_LIST="${select_ops_list}" \
229248
-DETHOS_SDK_PATH:PATH=${ethos_u_root_dir} \
230249
${cmsis_nn_local_path:+-DCMSIS_NN_LOCAL_PATH:PATH=${cmsis_nn_local_path}} \

0 commit comments

Comments
 (0)