Arm backend: add SmolLM2 Ethos-U export, generation and eval flow#20063
Open
xingguo01 wants to merge 1 commit into
Open
Arm backend: add SmolLM2 Ethos-U export, generation and eval flow#20063xingguo01 wants to merge 1 commit into
xingguo01 wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20063
Note: Links to docs will display an error until the docs builds have been completed. ❌ 5 New FailuresAs of commit 42f006c with merge base 4c9c444 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an end-to-end Arm Ethos-U (Corstone-320 FVP) workflow for exporting SmolLM2, running sampled text generation from prompt(s), and evaluating Wikitext perplexity using a full-logits fixed-window artifact.
Changes:
- Added SmolLM2→Ethos-U export helper script (w8a8/w8a16, fixed seq window, full-logits support).
- Added host-side generation + Wikitext perplexity evaluation scripts that drive the semihosting runner on FVP.
- Added documentation and example prompt file for reproducing the validated seq32 flow.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/arm/smollm2_example_ethos_u/run_fvp.sh | New helper to launch Corstone-320 FVP with a runner ELF. |
| examples/arm/smollm2_example_ethos_u/README.md | Quickstart documenting export, semihosting runner build, generation, and perplexity evaluation. |
| examples/arm/smollm2_example_ethos_u/generate_sampled.py | Host-side prompt tokenization + sampling loop that drives the semihosting runner and decodes output. |
| examples/arm/smollm2_example_ethos_u/export_smollm2_ethosu.sh | Export wrapper around extension.llm.export.export_llm for Ethos-U PT2E quantization and full-logits artifacts. |
| examples/arm/smollm2_example_ethos_u/eval_wikitext_perplexity.py | Wikitext prompt building + full-logits perplexity scoring on FVP for one/two runners. |
| examples/arm/smollm2_example_ethos_u/default_prompts.txt | Example prompts for generation smoke testing. |
| examples/arm/smollm2_example_ethos_u/build_executor_runner_semihosting.sh | Helper to build a semihosting runner (optionally embedding the PTE) with tuned pool sizes. |
| examples/arm/smollm2_example_ethos_u/build_executor_runner_fvp.sh | Helper to build a non-semihosting runner that includes the PTE in the ELF. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+5
to
+14
| import argparse | ||
| import math | ||
| from pathlib import Path | ||
| from typing import Iterable, List, Optional, Tuple | ||
|
|
||
| import numpy as np | ||
| from generate_sampled import ( # type: ignore[import-not-found] | ||
| FvpRunnerSession, | ||
| prepare_input, | ||
| ) |
Comment on lines
+42
to
+51
| exec "${fvp_bin}" \ | ||
| -C mps4_board.subsystem.ethosu.num_macs=256 \ | ||
| -C mps4_board.visualisation.disable-visualisation=1 \ | ||
| -C vis_hdlcd.disable_visualisation=1 \ | ||
| -C mps4_board.telnetterminal0.start_telnet=0 \ | ||
| -C mps4_board.uart0.out_file='-' \ | ||
| -C mps4_board.uart0.unbuffered_output=1 \ | ||
| -C mps4_board.uart0.shutdown_on_eot=1 \ | ||
| -a "${runner}" \ | ||
| -C mps4_board.subsystem.ethosu.extra_args="--fast" |
Comment on lines
+60
to
+64
| --memory_mode=*) memory_mode="${arg#*=}" ;; | ||
| --ethosu_extra_flags=*) ethosu_extra_flags="${arg#*=}" ;; | ||
| --full_logits) full_logits=1 ;; | ||
| *) | ||
| echo "Unknown option: ${arg}" >&2 |
014aacf to
d82cac6
Compare
zingo
requested changes
Jun 5, 2026
d82cac6 to
1f5ae88
Compare
Comment on lines
+39
to
+63
| --ethosu_extra_flags=LIST JSON-style Hydra list of extra Vela flags, e.g. | ||
| '["--arena-cache-size=1048576"]' | ||
| --full_logits Export full logits and append _full_logits to filenames. | ||
| This is the default for calibrated static | ||
| non-KV exports. | ||
| EOF | ||
| } | ||
|
|
||
| for arg in "$@"; do | ||
| case "$arg" in | ||
| -h|--help) usage; exit 0 ;; | ||
| --mode=*) mode="${arg#*=}" ;; | ||
| --quantize_scope=*) quantize_scope="${arg#*=}" ;; | ||
| --output_dir=*) output_dir="${arg#*=}" ;; | ||
| --tokenizer=*) tokenizer_path="${arg#*=}" ;; | ||
| --max_seq_length=*) max_seq_length="${arg#*=}" ;; | ||
| --max_context_length=*) max_context_length="${arg#*=}" ;; | ||
| --calibration_limit=*) calibration_limit="${arg#*=}" ;; | ||
| --calibration_seq_length=*) calibration_seq_length="${arg#*=}" ;; | ||
| --target=*) target="${arg#*=}" ;; | ||
| --system_config=*) system_config="${arg#*=}" ;; | ||
| --memory_mode=*) memory_mode="${arg#*=}" ;; | ||
| --ethosu_extra_flags=*) ethosu_extra_flags="${arg#*=}" ;; | ||
| --full_logits) full_logits=1 ;; | ||
| *) |
Comment on lines
+58
to
+73
| cmd=( | ||
| bash "${repo_root}/backends/arm/scripts/build_executor_runner.sh" | ||
| --et_build_root=${et_build_root} | ||
| --pte=${pte_file} | ||
| --build_type=Release | ||
| --target=${target} | ||
| --system_config=${system_config} | ||
| --memory_mode=${memory_mode} | ||
| --extra_build_flags=-DET_ARM_BAREMETAL_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE=0x02000000 | ||
| --ethosu_tools_dir=${repo_root}/examples/arm/arm-scratch | ||
| --toolchain=${toolchain} | ||
| ) | ||
|
|
||
| if [[ -n "${output_dir}" ]]; then | ||
| cmd+=(--output=${output_dir}) | ||
| fi |
- semihosting and FVP runner build helpers - sampled text generation from prompt files - Wikitext full-logits perplexity evaluation on FVP - example prompts and documentation for reproducing results Change-Id: I37c3b597202e9ef9938135159a93839cee962425 Signed-off-by: Xingguo Li <xingguo.li@arm.com>
1f5ae88 to
42f006c
Compare
zingo
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani