KS
Killer-Skills

cortex-m — how to use cortex-m how to use cortex-m, cortex-m setup guide, cortex-m vs TensorFlow Lite, cortex-m install, what is cortex-m, cortex-m PyTorch integration, on-device AI with cortex-m, CMSIS-NN backend, cortex-m alternative

v1.0.0
GitHub

About this Skill

Perfect for Edge AI Agents needing on-device PyTorch model optimization with CMSIS-NN backend cortex-m is an on-device AI backend for PyTorch, utilizing CMSIS-NN for efficient inference on mobile, embedded, and edge devices.

Features

Uses standard PT2E quantization with `prepare_pt2e` and `convert_pt2e`
Rewrites quantized ops to `cortex_m::` equivalents using `CortexMPassManager`
Supports custom ops and graph passes for CMSIS-NN
Utilizes `CortexMQuantizer` for quantization
Integrates with PyTorch for seamless on-device AI deployment

# Core Topics

pytorch pytorch
[0]
[0]
Updated: 3/7/2026

Quality Score

Top 5%
42
Excellent
Based on code quality & docs
Installation
SYS Universal Install (Auto-Detect)
Cursor IDE Windsurf IDE VS Code IDE
> npx killer-skills add pytorch/executorch/cortex-m

Agent Capability Analysis

The cortex-m MCP Server by pytorch is an open-source Categories.community integration for Claude and other AI agents, enabling seamless task automation and capability expansion. Optimized for how to use cortex-m, cortex-m setup guide, cortex-m vs TensorFlow Lite.

Ideal Agent Persona

Perfect for Edge AI Agents needing on-device PyTorch model optimization with CMSIS-NN backend

Core Value

Empowers agents to deploy AI models on mobile and embedded devices using custom CMSIS-NN ops and graph passes, leveraging PT2E quantization and the CortexMPassManager for efficient model conversion

Capabilities Granted for cortex-m MCP Server

Optimizing PyTorch models for edge deployment
Converting models to CMSIS-NN format
Deploying AI models on resource-constrained devices

! Prerequisites & Limits

  • Requires PyTorch support
  • Limited to CMSIS-NN backend
  • Custom ops and graph passes may require additional development
Project
SKILL.md
3.1 KB
.cursorrules
1.2 KB
package.json
240 B
Ready
UTF-8

# Tags

[No tags]
SKILL.md
Readonly

Cortex-M (CMSIS-NN) Backend

Architecture

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

Pipeline

Uses standard PT2E quantization (prepare_pt2e / convert_pt2e), then CortexMPassManager rewrites quantized ops to cortex_m:: equivalents.

python
1from executorch.backends.cortex_m.quantizer.quantizer import CortexMQuantizer 2from executorch.backends.cortex_m.passes.cortex_m_pass_manager import CortexMPassManager 3from torch.export import export 4from torchao.quantization.pt2e.quantize_pt2e import convert_pt2e, prepare_pt2e 5from executorch.exir import to_edge_transform_and_lower, EdgeCompileConfig 6 7quantizer = CortexMQuantizer() 8captured = export(model, example_inputs).module() 9prepared = prepare_pt2e(captured, quantizer) 10prepared(*example_inputs) # calibration 11quantized = convert_pt2e(prepared) 12 13exported = export(quantized, example_inputs) 14edge = to_edge_transform_and_lower( 15 exported, 16 compile_config=EdgeCompileConfig(_check_ir_validity=False), 17) 18edge._edge_programs["forward"] = CortexMPassManager( 19 edge.exported_program(), CortexMPassManager.pass_list 20).transform() 21et_program = edge.to_executorch()

In tests, CortexMTester wraps this pipeline:

python
1from executorch.backends.cortex_m.test.tester import CortexMTester 2 3tester = CortexMTester(model, example_inputs) 4tester.quantize().export().to_edge().run_passes().to_executorch()

Key Files

FilePurpose
backends/cortex_m/quantizer/quantizer.pyCortexMQuantizer — quantizes model for CMSIS-NN
backends/cortex_m/passes/cortex_m_pass_manager.pyCortexMPassManager — rewrites ATen ops → cortex_m:: ops
backends/cortex_m/test/tester.pyCortexMTester — test harness with test_dialect() and test_implementation()
backends/cortex_m/ops/operators.pyPython op definitions and reference implementations (cortex_m:: namespace)
backends/cortex_m/ops/operators.yamlC++ kernel registration schemas (used by build system)

C++ kernels calling CMSIS-NN APIs live under backends/cortex_m/ops/.

Testing

Toolchain setup (required for test_implementation tests):

bash
1./examples/arm/setup.sh --i-agree-to-the-contained-eula 2source ./examples/arm/arm-scratch/setup_path.sh

Run all tests:

bash
1source ./examples/arm/arm-scratch/setup_path.sh 2pytest backends/cortex_m/test/

test_dialect_* tests verify graph correctness (pure Python, no toolchain needed). test_implementation_* tests verify numerical accuracy on the Corstone-300 FVP (requires toolchain on PATH).

Baremetal build:

bash
1backends/cortex_m/test/build_test_runner.sh

Adding a New Op

  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)

Related Skills

Looking for an alternative to cortex-m or building a Categories.community AI Agent? Explore these related open-source MCP Servers.

View All

widget-generator

Logo of f
f

widget-generator is an open-source AI agent skill for creating widget plugins that are injected into prompt feeds on prompts.chat. It supports two rendering modes: standard prompt widgets using default PromptCard styling and custom render widgets built as full React components.

149.6k
0
Design

chat-sdk

Logo of lobehub
lobehub

chat-sdk is a unified TypeScript SDK for building chat bots across multiple platforms, providing a single interface for deploying bot logic.

73.0k
0
Communication

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
Communication

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
Communication