Skip to content

Commit 026bcac

Browse files
NXP backend: Update docs for ET 1.4 release (#21471)
### Summary Update docs for ET 1.4 release. Revised supported ops, fix broken links, fix missing parameters docs. ### Test plan Docs update. cc @robert-kalmar @JakeStevens @digantdesai @rascani Co-authored-by: roman-janik-nxp <roman.janik@nxp.com>
1 parent d0f48cf commit 026bcac

9 files changed

Lines changed: 69 additions & 31 deletions

File tree

backends/nxp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ If you have problems or questions or have suggestions for ways to make
6262
implementation and testing better, please reach out to the NXP representative for the SoC you are interested in using,
6363
or your distribution partner contact.
6464

65-
Or raise the issue here on ExecuTorch GitHub, label it with `module: nxp` and our ML team will address it on a priority-basis.
65+
Or raise the issue here on ExecuTorch [Github](https://github.com/pytorch/executorch/issues/new), label it with `module: nxp` and our ML team will address it on a priority-basis.

backends/nxp/neutron_partitioner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,8 @@ def __init__(
345345
`edge_program` only contains fake tensors without any data. In this case,
346346
this state dict is used instead (if provided). Notice: It may potentially
347347
contain outdated data,
348+
:param preserve_ops: List of aten operators to not decompose during the lowering.
349+
:param check_op_support: Optional callable to check if an operator is supported.
348350
"""
349351
super().__init__()
350352
self.delegation_spec = DelegationSpec(NeutronBackend.__name__, compile_spec)

backends/nxp/nxp_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def neutron_compile_spec(
8282
:param config: Neutron accelerator configuration, e.g. "imxrt700"
8383
:param intermediates_dir: Directory to store intermediate artifact files.
8484
:param extra_flags: Extra flags for the Neutron compiler
85-
:param operators_not_to_delegate: List of operators that should not be delegated
85+
:param operators_not_to_delegate: List of operators that will not be delegated
8686
:param use_neutron_for_format_conversion: If True, the EdgeProgramToIRConverter will insert `Transpose` ops to
8787
ensure that the IO matches the executorch partition, which will be
8888
delegated to Neutron.

docs/source/backends/nxp/nxp-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ For up-to-date status about running ExecuTorch on Neutron backend please visit t
1111
## Features
1212

1313

14-
ExecuTorch v1.2 supports running machine learning models on selected NXP chips (for now only `i.MXRT700`).
14+
ExecuTorch v1.4 supports running machine learning models on selected NXP chips (for now only `i.MXRT700`).
1515
Among currently supported machine learning models are:
1616
- Convolution-based neutral networks
1717
- Full support for MobileNetV2 and CifarNet

docs/source/backends/nxp/nxp-partitioner.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ It has the following arguments:
99
* `compile_spec` - list of key-value pairs defining compilation,
1010
* `neutron_target_spec` - NeutronTargetSpec instance, initialized by SoC id, e.g. "imxrt700",
1111
* `custom_delegation_options` - custom options for specifying node delegation,
12-
* `preserve_ops` - list of aten operators to not be decomposed by ExecuTorch.
12+
* `post_quantization_state_dict` - state-dict of the model right after quantization. During partitioning, the
13+
`edge_program` only contains fake tensors without any data. In this case,
14+
this state dict is used instead (if provided). Notice: It may potentially
15+
contain outdated data,
16+
* `preserve_ops` - list of aten operators to not decompose during the lowering.
17+
* `check_op_support` - optional callable to check if an operator is supported.
1318

1419
--------------------
1520
Compile Spec Options
@@ -18,11 +23,13 @@ To generate the Compile Spec for Neutron backend, you can use the `generate_neut
1823
Following fields can be set:
1924

2025
* `config` - NXP platform defining the Neutron NPU configuration, e.g. "imxrt700".
26+
* `intermediates_dir` - Directory to store intermediate artifact files.
2127
* `extra_flags` - Extra flags for the Neutron compiler.
2228
* `operators_not_to_delegate` - List of operators that will not be delegated.
2329
* `use_neutron_for_format_conversion` - If True, let the eIQ Neutron NPU to handle conversion between channel-first (NCHW) and channel-last (NHWC) data formats. That is the Neutron backend will insert `Transpose` ops to ensure that the IO matches the executorch partition, which will be delegated to Neutron.
24-
* `fetch_constants_to_sram`: If True, the Neutron Converter will insert microinstructions to prefetch weights from FLASH to SRAM. This should be used when the whole model does not fit into SRAM on Neutron-C devices, like i.MX RT700
25-
* `dump_kernel_selection_code`: Whether Neutron converter dumps kernel selection code, which is used by the selective kernel registration, see :doc:`Neutron Firmware Kernel Selection support <nxp-kernel-selection.md>`.
30+
* `fetch_constants_to_sram` - If True, the Neutron Converter will insert microinstructions to prefetch weights from FLASH to SRAM. This should be used when the whole model does not fit into SRAM on Neutron-C devices, like i.MX RT700.
31+
* `dump_kernel_selection_code` - Whether Neutron converter dumps kernel selection code, which is used by the selective kernel registration, see :doc:`Neutron Firmware Kernel Selection support <nxp-kernel-selection.md>`.
32+
* `use_profiling` - If true Neutron Converter will enable profiling for neutron delegated model.
2633

2734
-------------------------
2835
Custom Delegation Options
@@ -37,7 +44,7 @@ Operator Support
3744
Operators are the building blocks of the ML model. See `IRs <https://docs.pytorch.org/docs/stable/torch.compiler_ir.html>`_ for more information on the PyTorch operator set.
3845

3946
This section lists the Edge operators supported by the Neutron backend.
40-
For detailed constraints of the operators see the ``is_supported`` / ``_is_supported_in_IR`` / ``_is_supported_on_target`` checks in the `Node converters <https://github.com/pytorch/executorch/blob/main/backends/nxp/backend/ir/converter/node_converter.py#L118>`_
47+
For detailed constraints of the operators see the ``is_supported`` / ``_is_supported_in_IR`` / ``_is_supported_on_target`` checks in the `Node converters <https://github.com/pytorch/executorch/blob/main/backends/nxp/backend/ir/converter/node_converter.py#L105>`_
4148

4249

4350
.. csv-table:: Operator Support

docs/source/backends/nxp/nxp-quantization.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,55 @@ The Neutron delegate supports the following quantization schemes:
1111
- Following operators are supported at this moment:
1212
- `aten.abs.default`
1313
- `aten.adaptive_avg_pool2d.default`
14-
- `aten.addmm.default`
1514
- `aten.add.Tensor`
15+
- `aten.addmm.default`
16+
- `aten.amax.default`
17+
- `aten.amin.default`
18+
- `aten.avg_pool1d.default`
1619
- `aten.avg_pool2d.default`
20+
- `aten.batch_norm.default`
21+
- `aten.bmm.default`
1722
- `aten.cat.default`
18-
- `aten.conv1d.default`
23+
- `aten.clamp.default`
1924
- `aten.conv2d.default`
25+
- `aten.conv2d.padding`
26+
- `aten.conv_transpose2d.input`
2027
- `aten.dropout.default`
28+
- `aten.exp.default`
2129
- `aten.flatten.using_ints`
2230
- `aten.hardtanh.default`
2331
- `aten.hardtanh_.default`
32+
- `aten.leaky_relu.default` and `aten.leaky_relu_.default`
2433
- `aten.linear.default`
34+
- `aten.log.default`
35+
- `aten.maximum.default`
36+
- `aten.max_pool1d.default`
2537
- `aten.max_pool2d.default`
2638
- `aten.mean.dim`
39+
- `aten.minimum.default`
40+
- `aten.mm.default`
2741
- `aten.mul.Tensor`
42+
- `aten.neg.default`
2843
- `aten.pad.default`
2944
- `aten.permute.default`
45+
- `aten.prelu.default`
3046
- `aten.relu.default` and `aten.relu_.default`
3147
- `aten.reshape.default`
32-
- `aten.view.default`
33-
- `aten.softmax.int`
34-
- `aten.tanh.default`, `aten.tanh_.default`
3548
- `aten.sigmoid.default`
36-
- `aten.slice_copy.Tensor`
49+
- `aten.slice.Tensor`
50+
- `aten.softmax.int`
51+
- `aten.squeeze.default`
52+
- `aten.squeeze.dim`
53+
- `aten.squeeze.dims`
54+
- `aten.sub.Tensor`
55+
- `aten.sum.default`
56+
- `aten.sum.dim_IntList`
57+
- `aten.tanh.default` and `aten.tanh_.default`
58+
- `aten.transpose.int`
59+
- `aten.unsqueeze.default`
60+
- `aten.upsample_bilinear2d.vec`
61+
- `aten.upsample_nearest2d.vec`
62+
- `aten.view.default`
3763

3864
### Static 8-bit Quantization Using the PT2E Flow
3965

docs/source/backends/nxp/op-support.csv

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,48 @@ Operator,Compute DType,Quantization,Constraints
22
aten.abs.default,int8,static int8,
33
aten._adaptive_avg_pool2d.default,int8,static int8,"ceil_mode=False, count_include_pad=False, divisor_override=False"
44
aten.addmm.default,int8,static int8,2D tensor only
5-
aten.add.Tensor,int8,static int8,"alpha = 1, input tensors of equal shape"
5+
aten.add.Tensor,int8,static int8,"alpha = 1"
66
aten.amax.default,int8,static int8,
77
aten.amin.default,int8,static int8,
88
aten.avg_pool1d.default,int8,static int8,"ceil_mode=False, count_include_pad=False, divisor_override=False"
99
aten.avg_pool2d.default,int8,static int8,"ceil_mode=False, count_include_pad=False, divisor_override=False"
10-
aten.bmm.default,int8,static int8,"width and channels dim of both args %8 = 0, 3D tensors only"
11-
aten.cat.default,int8,static int8,"input_channels % 8 = 0, output_channels %8 = 0"
10+
aten.bmm.default,int8,static int8,"quantization zero points of inputs are equal"
11+
aten.cat.default,int8,static int8,"all inputs share quantization parameters"
1212
aten.clamp.default,int8,static int8,"Bounds = (-1, 1) or (0, 1) or (0, 6) or (0, None)"
13-
aten.clone.default,int8,static int8,
13+
aten.clone.default,int8,static int8,"node has memory format specified"
1414
aten.constant_pad_nd.default,int8,static int8,"H or W padding only"
1515
aten.convolution.default,int8,static int8,"1D or 2D convolution, constant weights, groups=1 or groups=channels_count (depthwise)"
1616
aten.dim_order_ops._clone_dim_order.default,,, "See aten.clone.default"
1717
aten.div.Tensor,int8,static int8,"divisor - static tensor or scalar value, one dimension must satisfy %8 = 0 or scalar division (all dims = 1)"
1818
aten.exp.default,int8,static int8,
19-
aten.hardtanh.default,int8,static int8,"supported ranges: <0,6>, <-1, 1>, <0,1>, <0,inf>"
19+
aten.hardtanh.default,int8,static int8,"Bounds = (-1, 1) or (0, 1) or (0, 6) or (0, None)"
2020
aten.leaky_relu.default,int8,static int8,
2121
aten.log.default,int8,static int8,
22-
aten.max_pool1d.default,int8,static int8,"dilation=1, ceil_mode=False, channels%8=0, batch_size=1, stride_h=1 or 2"
23-
aten.max_pool2d.default,int8,static int8,"dilation=1, ceil_mode=False, channels%8=0, batch_size=1, stride_h=1 or 2"
24-
aten.max_pool2d_with_indices.default,int8,static int8,"dilation=1, ceil_mode=False, channels%8=0, batch_size=1, stride_h=1 or 2"
22+
aten.max_pool1d.default,int8,static int8,"dilation=1, ceil_mode=False, stride < 4096"
23+
aten.max_pool2d.default,int8,static int8,"dilation=1, ceil_mode=False, stride < 4096"
24+
aten.max_pool2d_with_indices.default,int8,static int8,"dilation=1, ceil_mode=False, stride < 4096"
2525
aten.maximum.default,int8,static int8,
26-
aten.mean.dim,int8,static int8,"4D tensor only, dims = [-1,-2] or [-2,-1]"
26+
aten.mean.dim,int8,static int8,"4D tensor only"
2727
aten.minimum.default,int8,static int8,
2828
aten.mm.default,int8,static int8,"2D tensor only"
29-
aten.mul.Tensor,int8,static int8,"tensor-size % 8 = 0"
29+
aten.mul.Tensor,int8,static int8,
3030
aten.neg.default,int8,static int8,
3131
aten.permute_copy.default,int8, static int8, "Only specific transpositions supported, see backends/nxp/backend/ir/converter/node_converters/ops_converters/permute_copy_converter.py"
32-
aten.prelu.default,int8, static int8, "rank = 4, channels % 8 = 0, flat input size / channels <= 4096"
32+
aten.prelu.default,int8, static int8,
3333
aten.relu.default,int8,static int8,
3434
aten.sigmoid.default,int8,static int8,
35-
aten.slice_copy.Tensor,int8, static int8
35+
aten.slice.Tensor,int8, static int8
3636
aten._softmax.default,int8, static int8, "rank > 1, channels % 8 = 0, channels < 2048, flat input size / channels <= 4096, flat input size <= 524288"
3737
aten.split.default,N/A, N/A, "transforming split -> getitem to slice, see aten.slice_copy.Tensor"
3838
aten.split.Tensor,N/A, N/A, "transforming split -> getitem to slice, see aten.slice_copy.Tensor"
3939
aten.split_with_sizes.default,N/A, N/A, "transforming split -> getitem to slice, see aten.slice_copy.Tensor"
4040
aten.squeeze.default,int8,static int8,
4141
aten.squeeze.dim,int8,static int8,
4242
aten.squeeze.dims,int8,static int8,
43+
aten.sub.Tensor,int8,static int8,"alpha = 1"
4344
aten.sum.dim_IntList,int8,static int8,
4445
aten.tanh.default,int8,static int8,
4546
aten.unsqueeze.default,int8,static int8,
46-
aten.upsample_bilinear2d.vec,int8,static int8,"channels % 8 = 0, H_scale = W_scale = 2 or 4"
47-
aten.upsample_nearest2d.vec,int8,static int8,"channels % 8 = 0, H_scale = W_scale = 2 or 4"
47+
aten.upsample_bilinear2d.vec,int8,static int8,"H_scale and W_scale = 1, 2, 4 or 8"
48+
aten.upsample_nearest2d.vec,int8,static int8,"H_scale and W_scale = 1, 2, 4 or 8"
4849
aten.view_copy.default,int8,static int8,

docs/source/backends/nxp/tutorials/nxp-basic-tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This tutorial demonstrates the use of the eIQ Neutron backend with the Neutron b
99
### Software
1010
First you need to have Python 3.10 - 3.12 installed.
1111

12-
You need to install the ExecuTorch. Please follow the tutorial to install the ExecuTorch [Setting Up ExecuTorch](../../../getting-started-setup.rst)
12+
You need to install the ExecuTorch. Please follow the tutorial to install the ExecuTorch [Getting Started with ExecuTorch](https://docs.pytorch.org/executorch/main/getting-started.html)
1313

1414

1515
In addition to this, you will need to install the eIQ Neutron Simulator, called NSYS,
@@ -31,7 +31,7 @@ format and delegate the model computation to eIQ Neutron NPU using the eIQ Neutr
3131

3232
### Step 1: Environment Setup
3333

34-
This tutorial is intended to be run from a Linux and uses Conda or Virtual Env for Python environment management. For full setup details and system requirements, see [Getting Started with ExecuTorch](/getting-started).
34+
This tutorial is intended to be run from a Linux and uses Conda or Virtual Env for Python environment management. For full setup details and system requirements, see [Getting Started with ExecuTorch](https://docs.pytorch.org/executorch/main/getting-started.html).
3535

3636
Create a Conda environment and install the ExecuTorch Python package.
3737
```bash

examples/nxp/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ This directory contains examples demonstrating the use of ExecuTorch AoT flow to
33
format and delegate the model computation to eIQ Neutron NPU using the eIQ Neutron Backend.
44

55
## Layout
6+
* `executor_runner` - contains utility to run compiled ExecuTorch programs on Neutron Backend.
67
* `experimental/` - contains CifarNet model example.
78
* `models` - demo models instantiation used in examples.
89
* `aot_neutron_compile.py` - script with end-to-end ExecuTorch AoT Neutron Backend workflow.
910
* `README.md` - this file.
11+
* `run.sh` - utility script to build nxp_executor_runner, convert example model and run it on NSYS.
1012
* `run_aot_example.sh` - utility script to launch _aot_neutron_compile.py_. Primarily for CI purpose.
1113
* `setup.sh` - setup script to install Neutron Backend dependencies.
1214

1315
## Setup
14-
Please finish tutorial [Setting up ExecuTorch](https://pytorch.org/executorch/main/getting-started-setup).
16+
Please finish tutorial [Getting Started with ExecuTorch](https://docs.pytorch.org/executorch/main/getting-started.html).
1517

1618
Run the setup.sh script to install the neutron-converter:
1719
```commandline
@@ -43,4 +45,4 @@ The steps are expected to be executed from the `executorch` root folder.
4345
project, presented [here](https://mcuxpresso.nxp.com/mcuxsdk/latest/html/middleware/eiq/executorch/docs/nxp/topics/example_applications.html#how-to-build-and-run-executorch-cifarnet-example).
4446
This project will guide you through the process of deploying your PTE model to the device.
4547
To get the MCUXpresso SDK follow this [guide](https://mcuxpresso.nxp.com/mcuxsdk/latest/html/middleware/eiq/executorch/docs/nxp/topics/getting_mcuxpresso.html),
46-
use the MCUXpresso SDK v25.12.00.
48+
use the MCUXpresso SDK v26.06.00.

0 commit comments

Comments
 (0)