Skip to content

Arm backend: add SmolLM2 Ethos-U export, generation and eval flow#20063

Open
xingguo01 wants to merge 1 commit into
pytorch:mainfrom
xingguo01:arm-backend-smollm2-ethosu-demo
Open

Arm backend: add SmolLM2 Ethos-U export, generation and eval flow#20063
xingguo01 wants to merge 1 commit into
pytorch:mainfrom
xingguo01:arm-backend-smollm2-ethosu-demo

Conversation

@xingguo01
Copy link
Copy Markdown
Collaborator

@xingguo01 xingguo01 commented Jun 5, 2026

  • 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

cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani

Copilot AI review requested due to automatic review settings June 5, 2026 08:28
@xingguo01 xingguo01 requested a review from digantdesai as a code owner June 5, 2026 08:28
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Jun 5, 2026

🔗 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 Failures

As of commit 42f006c with merge base 4c9c444 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 5, 2026
@github-actions github-actions Bot added ciflow/trunk module: arm Issues related to arm backend labels Jun 5, 2026
@xingguo01 xingguo01 added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: arm Changes to the ARM backend delegate module: arm Issues related to arm backend and removed module: arm Issues related to arm backend labels Jun 5, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@xingguo01 xingguo01 force-pushed the arm-backend-smollm2-ethosu-demo branch from 014aacf to d82cac6 Compare June 5, 2026 09:06
Comment thread examples/arm/smollm2_example_ethos_u/README.md Outdated
Copilot AI review requested due to automatic review settings June 5, 2026 15:57
@xingguo01 xingguo01 force-pushed the arm-backend-smollm2-ethosu-demo branch from d82cac6 to 1f5ae88 Compare June 5, 2026 15:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

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>
@xingguo01 xingguo01 force-pushed the arm-backend-smollm2-ethosu-demo branch from 1f5ae88 to 42f006c Compare June 5, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: arm Issues related to arm backend partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: arm Changes to the ARM backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants