Skip to content

Commit d72ef5b

Browse files
authored
Arm backend: Make download of ethos-u dependencies optional (#9734)
### Summary This change makes the re-download of ethos-u dependencies optional during cmake configutation when building the executorch_runner. If the user opts out it is assumed that the dependencies are already downloaded.
1 parent 2d01dfc commit d72ef5b

File tree

2 files changed

+32
-29
lines changed

2 files changed

+32
-29
lines changed

examples/arm/executor_runner/CMakeLists.txt

+31-28
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ option(ET_ARM_BAREMETAL_TEMP_ALLOCATOR_POOL_SIZE "Set ET_ARM_BAREMETAL_TEMP_ALLO
1212
option(ET_BUNDLE_IO "Set to compile in BundleIO support" OFF)
1313
option(ET_ATOL "Set atol to use for BundleIO testing" OFF)
1414
option(ET_RTOL "Set rtol to use for BundleIO testing" OFF)
15+
option(FETCH_ETHOS_U_CONTENT "Fetch ethos_u dependencies instead of relying on pre-downloads" ON)
1516

1617
if(NOT DEFINED ET_PTE_FILE_PATH AND NOT ${SEMIHOSTING})
1718
message(
@@ -47,39 +48,41 @@ set(PYTHON_EXECUTABLE
4748
CACHE PATH "Define to override python executable used"
4849
)
4950

50-
# Download ethos_u dependency if needed.
51-
file(MAKE_DIRECTORY ${ETHOS_SDK_PATH}/../ethos_u)
52-
53-
include(FetchContent)
54-
set(ethos_u_base_rev "25.02")
55-
FetchContent_Declare(
56-
ethos_u
57-
GIT_REPOSITORY https://git.gitlab.arm.com/artificial-intelligence/ethos-u/ethos-u.git
58-
GIT_TAG ${ethos_u_base_rev}
59-
SOURCE_DIR ${ETHOS_SDK_PATH}
60-
BINARY_DIR ${ETHOS_SDK_PATH}
61-
SUBBUILD_DIR ${ETHOS_SDK_PATH}/../ethos_u-subbuild
62-
SOURCE_SUBDIR none
51+
if(FETCH_ETHOS_U_CONTENT)
52+
# Download ethos_u dependency if needed.
53+
file(MAKE_DIRECTORY ${ETHOS_SDK_PATH}/../ethos_u)
54+
55+
include(FetchContent)
56+
set(ethos_u_base_rev "25.02")
57+
FetchContent_Declare(
58+
ethos_u
59+
GIT_REPOSITORY https://git.gitlab.arm.com/artificial-intelligence/ethos-u/ethos-u.git
60+
GIT_TAG ${ethos_u_base_rev}
61+
SOURCE_DIR ${ETHOS_SDK_PATH}
62+
BINARY_DIR ${ETHOS_SDK_PATH}
63+
SUBBUILD_DIR ${ETHOS_SDK_PATH}/../ethos_u-subbuild
64+
SOURCE_SUBDIR none
6365
)
6466

65-
FetchContent_MakeAvailable(ethos_u)
67+
FetchContent_MakeAvailable(ethos_u)
6668

67-
# Get ethos_u externals only if core_platform folder does not already exist.
68-
if(NOT EXISTS "${ETHOS_SDK_PATH}/core_platform")
69-
execute_process(COMMAND ${PYTHON_EXECUTABLE} fetch_externals.py -c ${ethos_u_base_rev}.json fetch
70-
WORKING_DIRECTORY ${ETHOS_SDK_PATH}
71-
COMMAND_ECHO STDOUT
69+
# Get ethos_u externals only if core_platform folder does not already exist.
70+
if(NOT EXISTS "${ETHOS_SDK_PATH}/core_platform")
71+
execute_process(COMMAND ${PYTHON_EXECUTABLE} fetch_externals.py -c ${ethos_u_base_rev}.json fetch
72+
WORKING_DIRECTORY ${ETHOS_SDK_PATH}
73+
COMMAND_ECHO STDOUT
74+
)
75+
endif()
76+
77+
# Always patch the core_platform repo since this is fast enough.
78+
set(core_platform_base_rev "b728c774158248ba2cad8e78a515809e1eb9b77f")
79+
set(patch_dir "${ET_DIR_PATH}/examples/arm/ethos-u-setup")
80+
execute_process(COMMAND bash -c "pwd && source backends/arm/scripts/utils.sh && patch_repo ${ETHOS_SDK_PATH}/core_platform ${core_platform_base_rev} ${patch_dir}"
81+
WORKING_DIRECTORY ${ET_DIR_PATH}
82+
COMMAND_ECHO STDOUT
7283
)
7384
endif()
7485

75-
# Always patch the core_platform repo since this is fast enough.
76-
set(core_platform_base_rev "b728c774158248ba2cad8e78a515809e1eb9b77f")
77-
set(patch_dir "${ET_DIR_PATH}/examples/arm/ethos-u-setup")
78-
execute_process(COMMAND bash -c "pwd && source backends/arm/scripts/utils.sh && patch_repo ${ETHOS_SDK_PATH}/core_platform ${core_platform_base_rev} ${patch_dir}"
79-
WORKING_DIRECTORY ${ET_DIR_PATH}
80-
COMMAND_ECHO STDOUT
81-
)
82-
8386
# Selects timing adapter values matching system_config.
8487
# Default is Ethos_U55_High_End_Embedded, simulating optimal hardware for the Corestone-300.
8588
set(SYSTEM_CONFIG "Ethos_U55_High_End_Embedded" CACHE STRING "System config")
@@ -592,4 +595,4 @@ if(SEMIHOSTING)
592595
${ETHOS_SDK_PATH}/core_platform/targets/${TARGET_BOARD}/retarget.c
593596
PROPERTIES HEADER_FILE_ONLY TRUE
594597
)
595-
endif()
598+
endif()

examples/arm/run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function help() {
4040
echo "Options:"
4141
echo " --model_name=<MODEL> Model file .py/.pth/.pt, builtin model or a model from examples/models. Passed to aot_arm_compiler"
4242
echo " --model_input=<INPUT> Provide model input .pt file to override the input in the model file. Passed to aot_arm_compiler"
43-
echo " NOTE: Inference in FVP is done with a dummy input full of ones. Use bundleio flag to run the model in FVP with the custom input or the input from the model file."
43+
echo " NOTE: Inference in FVP is done with a dummy input full of ones. Use bundleio flag to run the model in FVP with the custom input or the input from the model file."
4444
echo " --aot_arm_compiler_flags=<FLAGS> Only used if --model_name is used Default: ${aot_arm_compiler_flags}"
4545
echo " --portable_kernels=<OPS> Comma separated list of portable (non delagated) kernels to include Default: ${portable_kernels}"
4646
echo " --target=<TARGET> Target to build and run for Default: ${target}"

0 commit comments

Comments
 (0)