Skip to content

Commit e7b3c23

Browse files
committed
Arm backend: Add argument to list used fallback ops for run.sh
This make it possible to specify what non EthosU ops to include in the build from the command line when running run.sh. As run.sh supports running models specified in files the hardcoded approch is inconvinent. Signed-off-by: Zingo Andersen <[email protected]> Change-Id: I98deb8a73d5178641a328d1200f04ec800c1b433
1 parent 393553c commit e7b3c23

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

examples/arm/run.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ target="ethos-u55-128"
2525
output_folder_set=false
2626
output_folder="."
2727
build_only=false
28+
portable_kernels="aten::_softmax.out"
2829

2930
help() {
3031
echo "Usage: $(basename $0) [options]"
3132
echo "Options:"
3233
echo " --model_name=<MODEL> Model to run, can be a builtin, examples/models or a filename Default to all builtin models"
3334
echo " --aot_arm_compiler_flags=<FLAGS> Only used if --model_name is used Default: ${aot_arm_compiler_flags}"
35+
echo " --portable_kernels=<OPS> Comma separated list of portable (non delagated) kernels to include Default: ${portable_kernels}"
3436
echo " --target=<TARGET> Target to build and run for Default: ${target}"
3537
echo " --output=<FOLDER> Output folder Default: ${output_folder}"
3638
echo " --build_only Only build, don't run FVP"
@@ -43,6 +45,7 @@ for arg in "$@"; do
4345
-h|--help) help ;;
4446
--model_name=*) model_name="${arg#*=}";;
4547
--aot_arm_compiler_flags=*) aot_arm_compiler_flags="${arg#*=}";;
48+
--portable_kernels=*) portable_kernels="${arg#*=}";;
4649
--target=*) target="${arg#*=}";;
4750
--output=*) output_folder="${arg#*=}" ; output_folder_set=true ;;
4851
--build_only) build_only=true ;;
@@ -74,6 +77,13 @@ fvp_model=FVP_Corstone_SSE-300_Ethos-U55
7477
toolchain_cmake=${script_dir}/ethos-u-setup/arm-none-eabi-gcc.cmake
7578
_setup_msg="please refer to ${script_dir}/ethos-u-setup/setup.sh to properly install necessary tools."
7679

80+
if ! [[ $portable_kernels =~ ^((^|,)aten::[a-zA-Z0-9_]+\.out)*$ ]]; then
81+
echo " ERROR: specified argument --portable_kernels=${portable_kernels}"
82+
echo " is in the wrong format please use \"aten::<OP1>.out,aten::<OP2>.out,...\""
83+
echo " e.g. \"aten::_softmax.out,aten::add.out\""
84+
exit 1
85+
fi
86+
7787
# Generate a pte file
7888
function generate_pte_file() {
7989
[[ $# -ne 2 ]] && { echo "[${FUNCNAME[0]}]" "Expecting model and model_compiler_flags flag, got, $*"; exit 1; }
@@ -153,7 +163,7 @@ function build_executorch() {
153163
cmake \
154164
-DCMAKE_INSTALL_PREFIX=${et_build_dir} \
155165
-DCMAKE_BUILD_TYPE=Release \
156-
-DEXECUTORCH_SELECT_OPS_LIST="aten::_softmax.out" \
166+
-DEXECUTORCH_SELECT_OPS_LIST=${portable_kernels} \
157167
-DEXECUTORCH_BUILD_ARM_BAREMETAL=ON \
158168
-DCMAKE_TOOLCHAIN_FILE="${toolchain_cmake}" \
159169
-B"${et_build_dir}"/examples/arm \

0 commit comments

Comments
 (0)