You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor ArmBackend/Partition/Quantizer
Split up ArmBackend into separate TOSA and Ethos-U classes.
Move partitioner and backend to separate files and remove Arm prefix.
Add compile_spec argument to EthosUQuantizer
Signed-off-by: Per Åstrand <[email protected]>
Copy file name to clipboardExpand all lines: backends/arm/README.md
+12-11Lines changed: 12 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ ethos-u-vela compilation stack. which follows the fully AoT flow.
15
15
## Layout
16
16
17
17
Export:
18
-
-`arm_backend.py` - Main entrypoint for the ArmPartitioner and ArmBackend. For more information see the section on
18
+
-`ethosu_backend.py` - Main entrypoint for the EthosUBackend. For more information see the section on
19
19
[Arm Backend Architecture](#arm-backend-architecture). For examples of use see `executorch/examples/arm`.
20
20
-`tosa_mapping.py` - utilities for mapping edge dialect to TOSA
21
21
-`tosa_quant_utils.py` - utilities for mapping quantization information to TOSA encoding
@@ -29,11 +29,11 @@ Passes:
29
29
-`*_pass.py` - Compiler passes derived from ExportPass
30
30
31
31
Quantization:
32
-
-`arm_quantizer.py` - Quantizer for Arm backend
32
+
-`arm_quantizer.py` - Quantizers for Arm backend. Contains the EthosUQuantizer which inherits from the TOSAQuantizer
33
33
-`arm_quantizer_utils.py` - Utilities for quantization
34
34
35
35
Runtime:
36
-
-`runtime/ArmBackendEthosU.cpp` - The Arm backend implementation of the ExecuTorch runtime backend (BackendInterface) for Ethos-U
36
+
-`runtime/ArmEthosUBackend.cpp` - The Arm backend implementation of the ExecuTorch runtime backend (BackendInterface) for Ethos-U
37
37
38
38
Other:
39
39
-`third-party/` - Dependencies on other code - in particular the TOSA serialization_lib for compiling to TOSA and the ethos-u-core-driver for the bare-metal backend supporting Ethos-U
@@ -177,6 +177,7 @@ create an issue on [github](https://www.github.com/pytorch/executorch/issues).
177
177
# Arm Backend Architecture
178
178
179
179
The broad principle with the Arm backend implemention for ExecuTorch is to support multiple Arm devices and device configurations through a largely Homogeneous flow with maximal sharing of class logic.
180
+
The EthosUBackend is currently the one user facing API that target the Ethos-U55 and Ethos-U85 hardware IP. It is using the TOSABackend under the hood to share code and functionality, but also to separate testing possibilities to the TOSA flow itself.
180
181
181
182
In practice for compilation, this means that the flow goes via [Arm TOSA](https://www.mlplatform.org/tosa/tosa_spec.html) to produce a common IR and quantization behaviour compatible with our various IP, and typically, device-specific backends to further lower to a device specific binary which can happen ahead of time (within the Python development flow) or at runtime (during a JIT compilation stage).
182
183
@@ -185,22 +186,22 @@ In practice for the runtime, this means we will share common runtime backend fun
185
186
186
187
## Arm Backend Status and Maturity
187
188
188
-
The Arm Backend should be considered a prototype quality at this point, likely subject to significant change and improvement, and with a limited coverage of functionality. We are actively developing this codebase.
189
+
The Arm EthosU Backend should be considered a prototype quality at this point, likely subject to significant change and improvement, and with a limited coverage of functionality. We are actively developing this codebase.
189
190
190
191
## Current flows
191
192
192
-
The ArmBackend has a two stage process,
193
-
- Compile to TOSA to rationalise the graph into known hardware support profiles. Currently this is to v0.80 TOSA BI with specific concern to a subset which gives support on Ethos-U55, the target of the initial prototype efforts.
193
+
The EthosUBackend has a two stage process,
194
+
- Compile to TOSA to rationalise the graph into known hardware support profiles. Currently this is to v0.80 TOSA BI with specific concern to a subset which gives support on Ethos-U55 and Ethos-U85, the target of the initial prototype efforts. This calls into the TOSABackend.
194
195
- Lower via the ethos-u-vela compilation flow which takes TOSA v0.80 as an input and produces a low level commandstream for the hardware which is then passed via the delegate to the ethos-u-core-driver for direct execution.
195
196
196
-
The ArmPartitioner is currenly used to ensure the operations converted are Ethos-U compatible, but will be extended to offer spec-correct TOSA Base inference and TOSA Main Inference generation in future.
197
+
The EthosUPartitioner is currenly used to ensure the operations converted are Ethos-U compatible, but will be extended to offer spec-correct TOSA Base inference and TOSA Main Inference generation in future.
198
+
199
+
There is also a generic TOSABackend with accompanying TOSAPartitioner and TOSAQuantizer, which are used by the EthosUBackend and friends. The Arm TOSA Backend can be used by it's own to verify the lowering to the TOSA representation of the model (refer to the unit tests in backends/arm/test which uses the TOSA backend in the test suites).
197
200
198
201
### Controlling compilation
199
202
200
203
It is possible to control the compilation flow to aid in development and debug of both networks and the code itself.
201
204
202
-
Configuration of the ArmBackend export flow is controlled by CompileSpec information (essentially used as compilation flags) to determine which of these outputs is produced. In particular this allows for use of the tosa_reference_model to run intermediate output to check for correctness and quantization accuracy without a full loop via hardware implemntation.
203
-
204
-
As this is in active development see the ArmBackend for accurate information on [compilation flags](https://github.com/pytorch/executorch/blob/29f6dc9353e90951ed3fae3c57ae416de0520067/backends/arm/arm_backend.py#L319-L324)
205
+
Configuration of the EthosUBackend export flow is controlled by CompileSpec information (essentially used as compilation flags) to determine which of these outputs is produced. In particular this allows for use of the tosa_reference_model to run intermediate output to check for correctness and quantization accuracy without a full loop via hardware implemntation.
205
206
206
-
You can also refer to the [example TOSA end-to-end code](/examples/arm/arm_tosa_e2e.py)
207
+
As this is in active development see the EthosUBackend for accurate information on [compilation flags](https://github.com/pytorch/executorch/blob/29f6dc9353e90951ed3fae3c57ae416de0520067/backends/arm/arm_backend.py#L319-L324)
0 commit comments