Agent skill

ExecuTorch Cortex-M Backend

by pytorch in pytorch/executorch

Developer guide for the Cortex-M (CMSIS-NN) backend in ExecuTorch: quantization pipeline, pass manager, tests and adding new ops.

Custom licenceAuto-check passedAI & LLM Engineering

Install ExecuTorch Cortex-M Backend

skills CLI
$ npx skills add pytorch/executorch --skill cortex-m -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install pytorch/executorch cortex-m --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/pytorch/executorch.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/cortex-m .claude/skills/cortex-m && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
cortex-m
GitHub stars
5.1k
Token cost
~872 tokens
SKILL.md length
189 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
Custom licence

At a glance

Developer guide for the Cortex-M (CMSIS-NN) backend in ExecuTorch: quantization pipeline, pass manager, tests and adding new ops.

  • Works in 5 steps: Define the op schema, meta function, and… → Write the C++ kernel in… → Register the .out kernel in operators.yaml → …
  • Working on code under backends/cortex_m/
  • SKILL.md covers Architecture, Pipeline, Key Files and Testing, plus 1 more section
  • Calls pytest

What it does

The Cortex-M backend is not a delegate and has no partitioner; instead, custom ops and graph passes replace ATen quantized ops with CMSIS-NN equivalents at the graph level. The pipeline uses standard PT2E quantization with `prepare_pt2e` and `convert_pt2e` through `CortexMQuantizer`, then `CortexMPassManager` rewrites quantized ops to `cortex_m::` equivalents. A key-files table lists the quantizer, pass manager, tester, Python op definitions and the YAML that registers C++ kernels.

In tests, `CortexMTester` wraps the pipeline with `test_dialect()` and `test_implementation()`. Dialect tests check graph correctness in pure Python, while implementation tests check numerical accuracy on the Corstone-300 FVP and need the Arm toolchain set up with `examples/arm/setup.sh` and added to the PATH. A baremetal build uses `build_test_runner.sh`. Adding a new op means defining its schema, meta function and reference implementation, writing the C++ kernel against CMSIS-NN, registering the `.out` kernel in `operators.yaml` and adding a pass that rewrites the ATen op.

When your agent uses it

  • Working on code under backends/cortex_m/
  • Running the Cortex-M tests, including the Corstone-300 simulator ones
  • Exporting a model for a Cortex-M target
  • Adding a new operator to the Cortex-M backend

Example prompts

  • “Run the Cortex-M dialect tests and tell me which ones fail.”
  • “Add a CMSIS-NN backed op for average pooling to the Cortex-M backend.”
  • “Set up the Arm toolchain so I can run the implementation tests.”

Requirements

  • An ExecuTorch checkout with the Arm toolchain from `examples/arm/setup.sh`
  • Python with pytest

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Define the op schema, meta function, and reference implementation in operators.py
  2. Write the C++ kernel in backends/cortex_m/ops/ calling CMSIS-NN APIs
  3. Register the .out kernel in operators.yaml
  4. Add a pass to rewrite the ATen op → cortex_m:: op
  5. Test with CortexMTester.test_dialect() (graph correctness) and test_implementation() (numerical accuracy on FVP)

What it can do on your machine

Read from SKILL.md and the folder at commit 27d124f. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pytest

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

ExecuTorch Cortex-M Backend loads about 872 tokens when it runs. Until then it costs about 43 tokens; SKILL.md has 189 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~43
When it runs · the whole SKILL.md, loaded when a task matches
~872

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

Its licence (Custom licence) doesn't allow us to republish the file, so here is its outline and opening line. It has 189 words (~872 tokens).

“Not a delegate backend — no partitioner. Custom ops and graph passes replace ATen quantized ops with CMSIS-NN equivalents at the graph level.”

— opening of SKILL.md by pytorch, Custom licence
name
cortex-m

Read the full SKILL.md on GitHub

Files

Just SKILL.md in .claude/skills/cortex-m of pytorch/executorch.

Open the folder on GitHubat commit 27d124f

Compare with similar skills

ExecuTorch Cortex-M Backend next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

ExecuTorch Cortex-M Backend compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
ExecuTorch Cortex-M Backend this skillpytorch/executorch5.1k—~872Automated safety check: PassCustom licence
Running Testsbrendanhasz/probflow175—~657Automated safety check: PassMIT
Formattingbrendanhasz/probflow175—~381Automated safety check: PassMIT
Torch Performance Optimizationalbumentations-team/albucore123—~895Automated safety check: PassMIT
Benchmark Pyreflyfacebook/pyrefly7.1k—~1.8kAutomated safety check: PassMIT
Document Public APIspytorch/pytorch104k—~4.2kAutomated safety check: PassCustom licence

Similar skills

  • Running Tests

    brendanhasz/probflow

    Run Python unit test suites strictly using the uv package manager and pytest.

    175 GitHub stars~657 tokensUpdated 10 days ago
    Testing & QAAuto-check passed
  • Formatting

    brendanhasz/probflow

    Ensure consistent code formatting using the uv package manager and pre-commit.

    175 GitHub stars~381 tokensUpdated 10 days ago
    AI & LLM EngineeringAuto-check passed
  • Torch Performance Optimization

    albumentations-team/albucore

    Optimize or review eager CPU-only Albucore PyTorch runtime paths with benchmark-backed decisions.

    123 GitHub stars~895 tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed
  • Benchmark Pyrefly

    facebook/pyrefly

    Official

    Run Pyrefly benchmarks locally via Buck or Cargo, including PyTorch real-world LSP benchmarks.

    7.1k GitHub stars~1.8k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Document Public APIs

    pytorch/pytorch

    Document undocumented public APIs in PyTorch by removing functions from coverageignorefunctions and coverageignoreclasses in docs/source/conf.py, running Sphinx coverage, and adding the appropriate…

    104k GitHub stars~4.2k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • The Art of Debugging

    stas00/the-art-of-debugging

    Condensed debugging method and tool recipes for Unix, Python and PyTorch programs: crashes, hangs, segfaults, wrong output, CUDA OOM, NaN values and slowness.

    1.7k GitHub stars~6.1k tokensUpdated today
    DevelopmentAuto-check: notes

More from pytorch/executorch

All 10 skills in this repo
  • Measures and shrinks the ExecuTorch runtime binary by building a size test, analyzing it with bloaty and landing each reduction as its own pull request.

    5.1k GitHub stars~793 tokensUpdated today
    Auto-check passed
  • ExecuTorch Build Guide

    pytorch/executorch

    Builds ExecuTorch from source: the Python package, C++ runtime, model runners, Android and iOS cross-compilation and backend-specific builds, with environment checks.

    5.1k GitHub stars~2.3k tokensUpdated today
    Auto-check: notes
  • ExecuTorch Knowledge Base

    pytorch/executorch

    Answers ExecuTorch questions from a local wiki on backends, export pitfalls, quantization recipes, runtime errors and SoC compatibility.

    5.1k GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • ExecuTorch PR Review

    pytorch/executorch

    Reviews ExecuTorch pull requests or local branches for what CI cannot check, using a checklist, with an optional detailed line-by-line mode.

    5.1k GitHub stars~2.9k tokensUpdated today
    Auto-check passed
  • Helps build, test and extend the Qualcomm AI Engine Direct (QNN) backend in ExecuTorch, with routes for new ops, model export, Buck-vs-CMake parity fixes and per-layer accuracy debugging.

    5.1k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • ExecuTorch on Zephyr

    pytorch/executorch

    Sets up ExecuTorch as a Zephyr RTOS module, adds board support and debugs west build failures such as linker memory overflow on embedded boards.

    5.1k GitHub stars~1.9k tokensUpdated today
    Auto-check passed

Questions about ExecuTorch Cortex-M Backend

What does ExecuTorch Cortex-M Backend do?

Developer guide for the Cortex-M (CMSIS-NN) backend in ExecuTorch: quantization pipeline, pass manager, tests and adding new ops. The Cortex-M backend is not a delegate and has no partitioner; instead, custom ops and graph passes replace ATen quantized ops with CMSIS-NN equivalents at the graph level. The pipeline uses standard PT2E quantization with `prepare_pt2e` and `convert_pt2e` through `CortexMQuantizer`, then `CortexMPassManager` rewrites quantized ops to `cortex_m::` equivalents.

When should I use ExecuTorch Cortex-M Backend?

ExecuTorch Cortex-M Backend fits situations like: working on code under backends/cortex_m/; running the Cortex-M tests, including the Corstone-300 simulator ones; exporting a model for a Cortex-M target; adding a new operator to the Cortex-M backend.

How do I install ExecuTorch Cortex-M Backend in Claude Code?

Run `npx skills add pytorch/executorch --skill cortex-m -a claude-code`. Or copy the skill folder (.claude/skills/cortex-m in pytorch/executorch) into .claude/skills/cortex-m in your project. Claude Code loads it when a task matches its description.

How do I install ExecuTorch Cortex-M Backend in Codex?

Run `npx skills add pytorch/executorch --skill cortex-m -a codex`. Or copy the skill folder (.claude/skills/cortex-m in pytorch/executorch) into .agents/skills/cortex-m in your project. Codex loads it when a task matches its description.

Can I use ExecuTorch Cortex-M Backend in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add pytorch/executorch --skill cortex-m -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cortex-m, .gemini/skills/cortex-m, .github/skills/cortex-m and .opencode/skills/cortex-m in your project.

What does ExecuTorch Cortex-M Backend need to run?

Going by SKILL.md and its folder, ExecuTorch Cortex-M Backend needs the command-line tools its instructions call (pytest). Our summary lists: An ExecuTorch checkout with the Arm toolchain from `examples/arm/setup.sh`; Python with pytest.

Does ExecuTorch Cortex-M Backend access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is ExecuTorch Cortex-M Backend safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does ExecuTorch Cortex-M Backend use?

ExecuTorch Cortex-M Backend has a licence file (the repository's licence) that doesn't match a standard licence. Read it on GitHub before reusing the skill.

How many tokens does ExecuTorch Cortex-M Backend use?

About 872 tokens (SKILL.md is roughly 3.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to ExecuTorch Cortex-M Backend?

Skills that share tags, products or a category with ExecuTorch Cortex-M Backend: Running Tests (brendanhasz/probflow, 175 stars), Formatting (brendanhasz/probflow, 175 stars), Torch Performance Optimization (albumentations-team/albucore, 123 stars) and Benchmark Pyrefly (facebook/pyrefly, 7.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains ExecuTorch Cortex-M Backend?

pytorch (a GitHub organization) maintains it in pytorch/executorch, which has 5,081 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on October 7, 2026.

Source: pytorch/executorch on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.