Skip to content

Commit 9d72936

Browse files
authored
Update docs of moved aot_arm_compiler.py (#18943)
aot_arm_compiler.py has been moved from examples/arm to backends/arm/scripts. Update documentation and scripts invoking this script to use the new path.
1 parent 89255ab commit 9d72936

13 files changed

Lines changed: 32 additions & 28 deletions

File tree

.ci/scripts/test_cortex_m_e2e.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# Copyright 2026 Arm Limited and/or its affiliates.
34
# All rights reserved.
45
#
56
# This source code is licensed under the BSD-style license found in the
@@ -18,7 +19,7 @@ mkdir -p "./cortex_m_e2e/${MODEL}"
1819
WORK_DIR=$(realpath "./cortex_m_e2e/${MODEL}")
1920

2021
echo "=== Exporting ${MODEL} with cortex-m55+int8 ==="
21-
python -m examples.arm.aot_arm_compiler \
22+
python -m backends.arm.scripts.aot_arm_compiler \
2223
-m "${MODEL}" \
2324
--target=cortex-m55+int8 \
2425
--quantize \

backends/arm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ scp -P 2222 arm_test/cmake-out/executor_runner root@127.0.0.1:/tmp/
162162
Create a PTE file:
163163

164164
```
165-
python3 -m examples.arm.aot_arm_compiler \
165+
python3 -m backends.arm.scripts.aot_arm_compiler \
166166
--model_name examples/arm/example_modules/add.py \
167167
--delegate \
168168
--quantize \

backends/arm/scripts/aot_arm_compiler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env python3
2+
13
# Copyright (c) Meta Platforms, Inc. and affiliates.
24
# All rights reserved.
35
# Copyright 2023-2026 Arm Limited and/or its affiliates.

backends/arm/scripts/docgen/ethos-u/ethos-u-getting-started-tutorial.md.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ In this tutorial you will learn how to export a simple PyTorch model for the Exe
2020
```{tip}
2121
If you are already familiar with this delegate, you may want to jump directly to the examples:
2222
* [Examples in the ExecuTorch repository](https://github.com/pytorch/executorch/tree/main/examples/arm)
23-
* [A commandline compiler for example models](https://github.com/pytorch/executorch/blob/main/examples/arm/aot_arm_compiler.py)
23+
* [A commandline compiler for example models](https://github.com/pytorch/executorch/blob/main/backends/arm/scripts/aot_arm_compiler.py)
2424
```
2525

2626
This tutorial serves as an introduction to using ExecuTorch to deploy PyTorch models on Arm® Ethos™-U targets. It is based on `ethos_u_minimal_example.ipynb`, provided in Arm’s examples folder.
@@ -69,9 +69,9 @@ The example below shows how to quantize a model consisting of a single addition,
6969
$MINIMAL_EXAMPLE
7070

7171
```{tip}
72-
For a quick start, you can use the script `examples/arm/aot_arm_compiler.py` to produce the pte.
72+
For a quick start, you can use the script `backends/arm/scripts/aot_arm_compiler.py` to produce the pte.
7373
To produce a pte file equivalent to the one above, run
74-
`python -m examples.arm.aot_arm_compiler --model_name=add --delegate --quantize --output=ethos_u_minimal_example.pte`
74+
`python -m backends.arm.scripts.aot_arm_compiler --model_name=add --delegate --quantize --output=ethos_u_minimal_example.pte`
7575
```
7676

7777
### Runtime:

backends/arm/scripts/docgen/vgf/vgf-getting-started-tutorial.md.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ You may encounter some rough edges and features which may be documented or plann
2626
```{tip}
2727
If you are already familiar with this delegate, you may want to jump directly to the examples:
2828
* [Examples in the ExecuTorch repository](https://github.com/pytorch/executorch/tree/main/examples/arm)
29-
* [A commandline compiler for example models](https://github.com/pytorch/executorch/blob/main/examples/arm/aot_arm_compiler.py)
29+
* [A commandline compiler for example models](https://github.com/pytorch/executorch/blob/main/backends/arm/scripts/aot_arm_compiler.py)
3030
```
3131

3232
This tutorial serves as an introduction to using ExecuTorch to deploy PyTorch models on VGF targets. The tutorial is based on `vgf_minimal_example.ipyb`, provided in Arm's example folder.
@@ -78,9 +78,9 @@ The example below shows how to quantize a model consisting of a single addition,
7878
$MINIMAL_EXAMPLE
7979

8080
```{tip}
81-
For a quick start, you can use the script `examples/arm/aot_arm_compiler.py` to produce the pte.
81+
For a quick start, you can use the script `backends/arm/scripts/aot_arm_compiler.py` to produce the pte.
8282
To produce a pte file equivalent to the one above, run
83-
`python -m examples.arm.aot_arm_compiler --model_name=add --delegate --quantize --output=simple_example.pte --target=vgf`
83+
`python -m backends.arm.scripts.aot_arm_compiler --model_name=add --delegate --quantize --output=simple_example.pte --target=vgf`
8484
```
8585

8686
### Runtime:

backends/arm/test/test_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def build_pte(
148148
command_list = [
149149
"python3",
150150
"-m",
151-
"examples.arm.aot_arm_compiler",
151+
"backends.arm.scripts.aot_arm_compiler",
152152
"--delegate",
153153
"--bundleio",
154154
f"--model_name={model_name}",

docs/source/backends/arm-ethos-u/tutorials/ethos-u-getting-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ In this tutorial you will learn how to export a simple PyTorch model for the Exe
2020
```{tip}
2121
If you are already familiar with this delegate, you may want to jump directly to the examples:
2222
* [Examples in the ExecuTorch repository](https://github.com/pytorch/executorch/tree/main/examples/arm)
23-
* [A commandline compiler for example models](https://github.com/pytorch/executorch/blob/main/examples/arm/aot_arm_compiler.py)
23+
* [A commandline compiler for example models](https://github.com/pytorch/executorch/blob/main/backends/arm/scripts/aot_arm_compiler.py)
2424
```
2525

2626
This tutorial serves as an introduction to using ExecuTorch to deploy PyTorch models on Arm® Ethos™-U targets. It is based on `ethos_u_minimal_example.ipynb`, provided in Arm’s examples folder.
@@ -142,9 +142,9 @@ save_pte_program(executorch_program_manager, "ethos_u_minimal_example.pte")
142142

143143

144144
```{tip}
145-
For a quick start, you can use the script `examples/arm/aot_arm_compiler.py` to produce the pte.
145+
For a quick start, you can use the script `backends/arm/scripts/aot_arm_compiler.py` to produce the pte.
146146
To produce a pte file equivalent to the one above, run
147-
`python -m examples.arm.aot_arm_compiler --model_name=add --delegate --quantize --output=ethos_u_minimal_example.pte`
147+
`python -m backends.arm.scripts.aot_arm_compiler --model_name=add --delegate --quantize --output=ethos_u_minimal_example.pte`
148148
```
149149

150150
### Runtime:

docs/source/backends/arm-vgf/tutorials/vgf-getting-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ You may encounter some rough edges and features which may be documented or plann
2626
```{tip}
2727
If you are already familiar with this delegate, you may want to jump directly to the examples:
2828
* [Examples in the ExecuTorch repository](https://github.com/pytorch/executorch/tree/main/examples/arm)
29-
* [A commandline compiler for example models](https://github.com/pytorch/executorch/blob/main/examples/arm/aot_arm_compiler.py)
29+
* [A commandline compiler for example models](https://github.com/pytorch/executorch/blob/main/backends/arm/scripts/aot_arm_compiler.py)
3030
```
3131

3232
This tutorial serves as an introduction to using ExecuTorch to deploy PyTorch models on VGF targets. The tutorial is based on `vgf_minimal_example.ipyb`, provided in Arm's example folder.
@@ -163,9 +163,9 @@ assert os.path.exists(pte_path), "Build failed; no .pte-file found"
163163

164164

165165
```{tip}
166-
For a quick start, you can use the script `examples/arm/aot_arm_compiler.py` to produce the pte.
166+
For a quick start, you can use the script `backends/arm/scripts/aot_arm_compiler.py` to produce the pte.
167167
To produce a pte file equivalent to the one above, run
168-
`python -m examples.arm.aot_arm_compiler --model_name=add --delegate --quantize --output=simple_example.pte --target=vgf`
168+
`python -m backends.arm.scripts.aot_arm_compiler --model_name=add --delegate --quantize --output=simple_example.pte --target=vgf`
169169
```
170170

171171
### Runtime:

examples/arm/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ model on a Arm backend via ExecuTorch. This backend supports Ethos-U and VGF as
55
targets (using TOSA) but you can also use the Ethos-U example runner as an example
66
on Cortex-M if you do not delegate the model.
77

8-
The main scripts are `setup.sh`, `run.sh` and `aot_arm_compiler.py`.
8+
The main scripts are `setup.sh`, `run.sh` and
9+
`backends/arm/scripts/aot_arm_compiler.py`.
910

1011
`setup.sh` will install the needed tools and with --root-dir <FOLDER>
1112
you can change the path to a scratch folder where it will download and generate build
@@ -38,13 +39,13 @@ You point out the model to convert with `--model_name=<MODELNAME/FILE>` It suppo
3839
from a python file if you just specify `ModelUnderTest` and `ModelInputs` in it.
3940

4041
```
41-
$ python3 -m examples.arm.aot_arm_compiler --help
42+
$ python3 -m backends.arm.scripts.aot_arm_compiler --help
4243
```
4344

4445
This is how you generate a BundleIO BPTE of a simple add example
4546

4647
```
47-
$ python3 -m examples.arm.aot_arm_compiler --model_name=examples/arm/example_modules/add.py --target=ethos-u55-128 --bundleio
48+
$ python3 -m backends.arm.scripts.aot_arm_compiler --model_name=examples/arm/example_modules/add.py --target=ethos-u55-128 --bundleio
4849
```
4950

5051
The example model used has added two extra variables that is picked up to make this work.
@@ -57,11 +58,11 @@ The example model used has added two extra variables that is picked up to make t
5758
You can also use the models from example/models directly by just using the short name e.g.
5859

5960
```
60-
$ python3 -m examples.arm.aot_arm_compiler --model_name=mv2 --target=ethos-u55-64
61+
$ python3 -m backends.arm.scripts.aot_arm_compiler --model_name=mv2 --target=ethos-u55-64
6162
```
6263

6364

64-
The `aot_arm_compiler.py` is called from the scripts below so you don't need to, but it can be useful to do by hand in some cases.
65+
`aot_arm_compiler.py` is called from the scripts below so you don't need to, but it can be useful to do by hand in some cases.
6566

6667

6768
## ExecuTorch on Arm Ethos-U55/U65 and U85

examples/arm/example_modules/add.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# All rights reserved.
2-
# Copyright 2023-2025 Arm Limited and/or its affiliates.
2+
# Copyright 2023-2026 Arm Limited and/or its affiliates.
33
#
44
# Example of an external model for the Arm AOT Compiler
55
#
66
# Example of an external Python file to be used as a module by the `run.sh`
7-
# (and the `aot_arm_compiler.py`) scripts in `examples/arm` directory.
7+
# (and the `backends/arm/scripts/aot_arm_compiler.py`) script.
88
#
99
# Just pass the path of the `add.py` file as `--model_name`
1010
#

0 commit comments

Comments
 (0)