Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ cortex_m.quantized_conv2d_nhwc.default: 2
cortex_m.transpose.default: 1
```

Before lowering, the graph contained two general convolution operations (Stride-1 and Stride-4). The `aten` prefix identifies PyTorch’s ATen operator namespace. These operators describe the computation, but not the hardware or kernel that will perform it. Lowering replaces both with `cortex_m.quantized_conv2d_nhwc`, an INT8 convolution using NHWC layout.
Before lowering, the graph contained two general convolution operations (stride-1 and stride-4). The `aten` prefix identifies PyTorch’s ATen operator namespace. These operators describe the computation, but not the hardware or kernel that will perform it. Lowering replaces both with `cortex_m.quantized_conv2d_nhwc`, an INT8 convolution using NHWC layout.

`aten.topk` is unchanged, so it will use the portable CPU kernel. The `cortex_m.quantize_*`
and `cortex_m.dequantize_*` operators mark boundaries between floating-point (FP32) and INT8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ executorch_call_delegate: 1
```

The final graph contains all three execution paths:
- `executorch_call_delegate` contains the stride-one convolution accepted by
- `executorch_call_delegate` contains the stride-1 convolution accepted by
Ethos-U55.
- `cortex_m.quantized_conv2d_nhwc` is the stride-four convolution rejected by
- `cortex_m.quantized_conv2d_nhwc` is the stride-4 convolution rejected by
Ethos-U55 and lowered to CMSIS-NN.
- `aten.topk` remains a portable FP32 operation.

## Using the CMSIS-ExecuTorch project workflow
## Using the CMSIS-Executorch project workflow

The CMSIS-Executorch project workflow uses `create_ai_layer.py` to export a model, generate a `.pte`, and select the source components required to execute it.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ FVP_MODEL=FVP_Corstone_SSE-300_Ethos-U55 bash .vscode/fvp.sh -f board/Corstone-3
{{< /tab >}}
{{< /tabpane >}}

The relevant output is:
The output is similar to:

```output
Ethos-U version info:
Expand All @@ -87,6 +87,8 @@ Output: 10 element(s): 0.0532 -0.0239 0.0541 0.1064 0.0706 0.0395 0.0881 0.1340
Test_result: PASS
```

The runner prints `Test_result: PASS` when inference returns successfully with a nonempty output list. Check that the preceding line also reports ten output values, as shown above. The runner does not assert the tensor shape, data type, or numerical accuracy. To validate a trained model, compare its outputs against a reference using the same input data and a tolerance appropriate to the quantization.

{{% notice Note %}}
On Windows, the FVP can print warnings that `python3.dll` is unavailable and
that the VIO or VSI bridges are disabled. This headless example doesn't use
Expand All @@ -95,23 +97,18 @@ successfully.
{{% /notice %}}



The FVP result proves functional execution, not physical-device latency or
power. Measure the complete graph on your target hardware before drawing
performance conclusions because delegation boundaries and tensor conversions
also have a cost.
This run checks successful execution of the mixed graph. To measure latency or power, benchmark the complete graph on your target hardware, including delegation boundaries and tensor conversions.

## What you've accomplished

You have built and run one ExecuTorch program across three execution paths, and used CMSIS-ExecuTorch to make setup easier:
You have built and run one ExecuTorch program across three execution paths, and used CMSIS-Executorch to make setup easier:

- The supported convolution runs in an Ethos-U55 delegate.
- The unsupported stride-four convolution runs on Cortex-M55 through the
- The unsupported stride-4 convolution runs on Cortex-M55 through the
ExecuTorch wrapper and optimized CMSIS-NN kernel.
- `topk` runs through the portable ExecuTorch CPU kernel.

You also verified the implementation. The exported graph shows ownership, the compilation database shows the
compiled Pack sources, and the FVP confirms that the combined firmware runs.
You also checked the implementation: the exported graph identifies each execution path, the compilation database identifies the selected Pack sources, and the successful build and FVP run confirm that the combined firmware executes.

This build uses Ethos-U55 to make one unsupported convolution predictable. The same
Pack workflow applies to another Ethos-U target when its delegated graph leaves
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@ draft: true
cascade:
draft: true

description: Build an ExecuTorch 1.5.1 application from the published ExecuTorch CMSIS Pack, that uses CMSIS-NN for optimized Cortex-M fallback.
description: Build an ExecuTorch 1.5.1 application from the published ExecuTorch CMSIS Pack and use CMSIS-NN kernels for Cortex-M fallback.

minutes_to_complete: 60

who_is_this_for: This Learning Path is for embedded machine learning developers building ExecuTorch applications for Cortex-M CPUs and Ethos-U NPUs.

learning_objectives:
- Export an ExecuTorch graph with Ethos-U, CMSIS-NN, and portable-kernel execution regions
- Lower quantized CPU fallback operations to optimized CMSIS-NN-backed Cortex-M operators, and understand the benefits in doing so
- Install and consume the published ExecuTorch CMSIS Pack for version 1.5.1 with selected runtime and operator components
- Run an application built from the ExecuTorch CMSIS Pack on a Corstone-300 Ethos-U55 FVP
- Understand when and why to use the ExecuTorch CMSIS Pack
- Lower quantized CPU fallback operations to CMSIS-NN-backed Cortex-M operators
- Trace the exported operators to selected components in the published ExecuTorch 1.5.1 and CMSIS-NN Packs
- Build and run the application on a Corstone-300 Ethos-U55 FVP

prerequisites:
- Git, VS Code, and Python 3.10 to 3.13 on Windows, macOS, or x86-64 Linux
- Docker Desktop for FVP simulation on macOS
- An internet connection and command-line access
- A host machine - Windows or Linux PC, or an Apple silicon Mac running macOS 15 or later
- Visual Studio Code installed
- Familiarity with PyTorch
- Basic familiarity with Cortex-M processors and Ethos-U NPUs

Expand All @@ -36,7 +34,7 @@ test_maintenance: false

### Tags
skilllevels: Introductory
subjects: ML
subjects: AI/ML
armips:
- Cortex-M
- Ethos-U
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading