Skip to content

Commit 2941a98

Browse files
Fix and update run.sh script for VGF target.
(Fixed incorrect path of TOSA minimal example) Change-Id: I695c2563b3f1ebcbd6b6eb660dff36c305c0325a
1 parent 7f736fe commit 2941a98

File tree

2 files changed

+53
-45
lines changed

2 files changed

+53
-45
lines changed

backends/arm/test/test_arm_ootb.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ run_ootb_tests_tosa() {
1919
echo "$FUNCNAME: Running out-of-the-box tests for TOSA"
2020
jupyter nbconvert \
2121
--to notebook \
22-
--execute examples/arm/TOSA_minimal_example.ipynb
22+
--execute backends/arm/scripts/TOSA_minimal_example.ipynb
2323
echo "${FUNCNAME}: PASS"
2424
}
2525

examples/arm/run.sh

Lines changed: 52 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ select_ops_list="aten::_softmax.out"
4343
qdq_fusion_op=false
4444
model_explorer=false
4545
perf_overlay=false
46+
model_converter=false
4647

4748
function help() {
4849
echo "Usage: $(basename $0) [options]"
@@ -126,19 +127,8 @@ fi
126127
# Default Ethos-u tool folder override with --scratch-dir=<FOLDER>
127128
ethos_u_scratch_dir=$(realpath ${ethos_u_scratch_dir})
128129
setup_path_script=${ethos_u_scratch_dir}/setup_path.sh
129-
if [[ ${toolchain} == "arm-none-eabi-gcc" ]]; then
130-
toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake
131-
elif [[ ${toolchain} == "arm-zephyr-eabi-gcc" ]]; then
132-
toolchain_cmake=${et_root_dir}/examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake
133-
else
134-
echo "Error: Invalid toolchain selection, provided: ${toolchain}"
135-
echo " Valid options are {arm-none-eabi-gcc, arm-zephyr-eabi-gcc}"
136-
exit 1;
137-
fi
138-
toolchain_cmake=$(realpath ${toolchain_cmake})
139130
_setup_msg="please refer to ${script_dir}/setup.sh to properly install necessary tools."
140131

141-
142132
# Set target based variables
143133
if [[ ${system_config} == "" ]]
144134
then
@@ -163,26 +153,68 @@ then
163153
config="Arm/vela.ini"
164154
fi
165155

156+
# Build executorch libraries
157+
cd $et_root_dir
158+
devtools_flag=""
159+
bundleio_flag=""
160+
etrecord_flag=""
161+
et_dump_flag=""
162+
qdq_fusion_op_flag=""
163+
fvp_pmu_flag=""
164+
if [ "$build_with_etdump" = true ] ; then
165+
et_dump_flag="--etdump"
166+
etrecord_flag="--etrecord"
167+
fi
168+
169+
if [ "$bundleio" = true ] ; then
170+
devtools_flag="--devtools"
171+
bundleio_flag="--bundleio"
172+
fi
173+
174+
if [ "$qdq_fusion_op" = true ] ; then
175+
qdq_fusion_op_flag="--enable_qdq_fusion_pass"
176+
fi
177+
166178
function check_setup () {
167179
# basic checks that setup.sh did everything needed before we get started
168180

169181
# check if setup_path_script was created, if so source it
170182
if [[ -f ${setup_path_script} ]]; then
171183
source $setup_path_script
184+
echo $setup_path_script
172185
else
173186
echo "Could not find ${setup_path_script} file, ${_setup_msg}"
174187
return 1
175188
fi
176-
177189
# If setup_path_script was correct all these checks should now pass
178-
hash ${toolchain} \
179-
|| { echo "Could not find ${toolchain} toolchain on PATH, ${_setup_msg}"; return 1; }
180-
181-
[[ -f ${toolchain_cmake} ]] \
182-
|| { echo "Could not find ${toolchain_cmake} file, ${_setup_msg}"; return 1; }
183-
184-
[[ -f ${et_root_dir}/CMakeLists.txt ]] \
185-
|| { echo "Executorch repo doesn't contain CMakeLists.txt file at root level"; return 1; }
190+
if [[ ${target} =~ "ethos-u" ]]; then
191+
if [[ ${toolchain} == "arm-none-eabi-gcc" ]]; then
192+
toolchain_cmake=${et_root_dir}/examples/arm/ethos-u-setup/${toolchain}.cmake
193+
elif [[ ${toolchain} == "arm-zephyr-eabi-gcc" ]]; then
194+
toolchain_cmake=${et_root_dir}/examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake
195+
else
196+
echo "Error: Invalid toolchain selection, provided: ${toolchain}"
197+
echo " Valid options are {arm-none-eabi-gcc, arm-zephyr-eabi-gcc}"
198+
exit 1;
199+
fi
200+
toolchain_cmake=$(realpath ${toolchain_cmake})
201+
hash ${toolchain} \
202+
|| { echo "Could not find ${toolchain} toolchain on PATH, ${_setup_msg}"; return 1; }
203+
204+
[[ -f ${toolchain_cmake} ]] \
205+
|| { echo "Could not find ${toolchain_cmake} file, ${_setup_msg}"; return 1; }
206+
207+
[[ -f ${et_root_dir}/CMakeLists.txt ]] \
208+
|| { echo "Executorch repo doesn't contain CMakeLists.txt file at root level"; return 1; }
209+
210+
211+
backends/arm/scripts/build_executorch.sh --et_build_root="${et_build_root}" --build_type=$build_type $devtools_flag $et_dump_flag --toolchain="${toolchain}"
212+
elif [[ ${target} =~ "vgf" ]]; then
213+
model_converter=$(which model-converter)
214+
echo "${model_converter}"
215+
[[ "${model_converter}" == "model-converter not found" ]] \
216+
&& { echo "Could not find model-converter, ${_setup_msg}"; return 1; }
217+
fi
186218

187219
return 0
188220
}
@@ -205,30 +237,6 @@ if ! check_setup; then
205237
fi
206238
fi
207239

208-
# Build executorch libraries
209-
cd $et_root_dir
210-
devtools_flag=""
211-
bundleio_flag=""
212-
etrecord_flag=""
213-
et_dump_flag=""
214-
qdq_fusion_op_flag=""
215-
fvp_pmu_flag=""
216-
if [ "$build_with_etdump" = true ] ; then
217-
et_dump_flag="--etdump"
218-
etrecord_flag="--etrecord"
219-
fi
220-
221-
if [ "$bundleio" = true ] ; then
222-
devtools_flag="--devtools"
223-
bundleio_flag="--bundleio"
224-
fi
225-
226-
if [ "$qdq_fusion_op" = true ] ; then
227-
qdq_fusion_op_flag="--enable_qdq_fusion_pass"
228-
fi
229-
230-
backends/arm/scripts/build_executorch.sh --et_build_root="${et_build_root}" --build_type=$build_type $devtools_flag $et_dump_flag --toolchain="${toolchain}"
231-
232240
if [[ -z "$model_name" ]]; then
233241
# the test models run, and whether to delegate
234242
test_model=(

0 commit comments

Comments
 (0)