Skip to content

Commit 00d804c

Browse files
zingofacebook-github-bot
authored andcommitted
Arm backend: Add argument to list used fallback ops for run.sh (#5815)
Summary: 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 hard coded approach is incontinent. Pull Request resolved: #5815 Reviewed By: mergennachin Differential Revision: D63813013 Pulled By: digantdesai fbshipit-source-id: f5e0e0c06fa9f804336dbc06864b6c9bbc9ec8d8
1 parent f102d06 commit 00d804c

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 ;;
@@ -80,6 +83,13 @@ fi
8083
toolchain_cmake=${script_dir}/ethos-u-setup/arm-none-eabi-gcc.cmake
8184
_setup_msg="please refer to ${script_dir}/ethos-u-setup/setup.sh to properly install necessary tools."
8285

86+
if ! [[ $portable_kernels =~ ^((^|,)aten::[a-zA-Z0-9_]+\.out)*$ ]]; then
87+
echo " ERROR: specified argument --portable_kernels=${portable_kernels}"
88+
echo " is in the wrong format please use \"aten::<OP1>.out,aten::<OP2>.out,...\""
89+
echo " e.g. \"aten::_softmax.out,aten::add.out\""
90+
exit 1
91+
fi
92+
8393
# Generate a pte file
8494
function generate_pte_file() {
8595
[[ $# -ne 2 ]] && { echo "[${FUNCNAME[0]}]" "Expecting model and model_compiler_flags flag, got, $*"; exit 1; }
@@ -157,7 +167,7 @@ function build_executorch() {
157167
cmake \
158168
-DCMAKE_INSTALL_PREFIX=${et_build_dir} \
159169
-DCMAKE_BUILD_TYPE=Release \
160-
-DEXECUTORCH_SELECT_OPS_LIST="aten::_softmax.out" \
170+
-DEXECUTORCH_SELECT_OPS_LIST=${portable_kernels} \
161171
-DEXECUTORCH_BUILD_ARM_BAREMETAL=ON \
162172
-DCMAKE_TOOLCHAIN_FILE="${toolchain_cmake}" \
163173
-B"${et_build_dir}"/examples/arm \

0 commit comments

Comments
 (0)