Skip to content

Commit ad4d190

Browse files
committed
Arm backend: Fix Smollm2 model test
- Export & lower the smollm2 via extensions/llm/export_llm - Build the arm_executor_runner application - Fix the propagation of select_ops_list in the CMakeLists.txt - Test the application runs on FVP in fast mode Signed-off-by: George Gekov <george.gekov@arm.com> Change-Id: I8acd87c2f5c3e6b5b189bb987ceccfe4877e2254
1 parent 513a4ea commit ad4d190

4 files changed

Lines changed: 38 additions & 6 deletions

File tree

backends/arm/scripts/build_executorch.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ cmake_args=(
9797
-DEXECUTORCH_BUILD_ARM_ETDUMP=${build_with_etdump}
9898
-DEXECUTORCH_BAREMETAL_SKIP_INSTALL=OFF
9999
)
100+
if ((${#extra_cmake_args[@]})); then
101+
cmake_args+=("${extra_cmake_args[@]}")
102+
fi
100103

101104
if [[ ${#extra_cmake_args[@]} -gt 0 ]]; then
102105
cmake_args+=("${extra_cmake_args[@]}")

backends/arm/test/test_arm_backend.sh

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,41 @@ test_deit_e2e_ethos_u() {
302302
test_model_smollm2_135M() {
303303
echo "${TEST_SUITE_NAME}: Test SmolLM2-135M on Ethos-U85"
304304

305-
# Build common libs once
306-
python3 backends/arm/test/test_model.py --test_output=arm_test/test_model --build_libs
307-
308-
python3 backends/arm/test/test_model.py --test_output=arm_test/test_model --target=ethos-u85-128 --model=smollm2 --extra_flags="-DEXECUTORCH_SELECT_OPS_LIST=dim_order_ops::_to_dim_order_copy.out" --specify_ethosu_scratch
305+
backends/arm/scripts/build_executorch.sh
309306

307+
# Build pte for smollm2
308+
python -m extension.llm.export.export_llm \
309+
base.model_class=smollm2 \
310+
base.params=examples/models/smollm2/135M_config.json \
311+
debug.verbose=True model.enable_dynamic_shape=False quantization.pt2e_quantize="ethosu_8a8w" \
312+
backend.ethosu.enabled=True backend.ethosu.target="ethos-u85-256" backend.ethosu.memory_mode=Dedicated_Sram_384KB
313+
314+
# Build the arm_executor_runner application, pre-loading the pte in the DDR for faster linking
315+
local pte_addr="0x76000000"
316+
backends/arm/scripts/build_executor_runner.sh \
317+
--et_build_root="${et_root_dir}/arm_test" \
318+
--pte="${pte_addr}" \
319+
--build_type=Release \
320+
--target=ethos-u85-256 \
321+
--system_config=Ethos_U85_SYS_DRAM_Mid \
322+
--memory_mode=Dedicated_Sram_384KB \
323+
--ethosu_tools_dir="${scratch_dir}" \
324+
--toolchain=arm-none-eabi-gcc \
325+
--extra_build_flags="-DET_ARM_BAREMETAL_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE=0x20000" \
326+
--select_ops_list="dim_order_ops::_to_dim_order_copy.out"
327+
328+
329+
# Deploy the application on the FVP in fast mode
330+
FVP_Corstone_SSE-320 -C mps4_board.subsystem.ethosu.num_macs=256 \
331+
-C mps4_board.visualisation.disable-visualisation=1 \
332+
-C vis_hdlcd.disable_visualisation=1 \
333+
-C mps4_board.telnetterminal0.start_telnet=0 \
334+
-C mps4_board.uart0.out_file='-' \
335+
-C mps4_board.uart0.shutdown_on_eot=1 \
336+
-a "${et_root_dir}"/arm_test/ethos-u85-256_${pte_addr}/cmake-out/arm_executor_runner \
337+
-C mps4_board.subsystem.ethosu.extra_args="--fast" \
338+
--data smollm2.pte@"${pte_addr}"
339+
310340
echo "${TEST_SUITE_NAME}: PASS"
311341
}
312342

examples/arm/executor_runner/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ elseif(FOUND_OPS_IN_FILE)
349349
"gen_oplist: EXECUTORCH_SELECT_OPS_MODEL=${ET_PTE_FILE_PATH} is used to auto generate ops from"
350350
)
351351
else()
352-
set(EXECUTORCH_SELECT_OPS_LIST "")
353352
set(EXECUTORCH_SELECT_OPS_MODEL "")
354353
message(
355354
"gen_oplist: No non delagated ops was found in ${ET_PTE_FILE_PATH} no ops added to build"

examples/arm/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ configure_ethosu_scratch_if_requested() {
659659
return
660660
fi
661661
local scratch_size
662-
scratch_size=$(get_ethosu_scratch_size "$pte_path" || true)
662+
scratch_size=$(get_ethosu_scratch_size "$pte_path" | tail -n 1)
663663
if [[ -z "${scratch_size}" ]]; then
664664
echo "WARNING: Failed to derive Ethos-U scratch size from ${pte_path}" >&2
665665
return

0 commit comments

Comments
 (0)