Skip to content

Commit

Permalink
Summary: Initial TOSA support in executorch (pytorch#161)
Browse files Browse the repository at this point in the history
Summary:
An implementation of a TOSA Partitioner and TOSA backend supporting a small list of operators in fp32 and int8/32. This includes a set of integer networks which will then compile to target Ethos-U NPU using the Vela compiler.

* A small set of test networks in fp32
* A subset of these supporting integer and compiling with Vela
* A test wrapper to register and test networks through the compile stack
  * A flow pt2 -> executorch -> tosa_flatbuffer.tosa file -> tosa_reference_model
  * A flow pt2 -> executorch -> tosa_flatbuffer.tosa file -> vela -> command_stream
* This work depends on a few different python modules
  * https://review.mlplatform.org/plugins/gitiles/tosa/serialization_lib/
  * https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ethos-u-vela/
* This work uses other projects for validation
  * https://review.mlplatform.org/plugins/gitiles/tosa/reference_model/

Pull Request resolved: pytorch#161

Reviewed By: mergennachin

Differential Revision: D49542254

Pulled By: digantdesai

fbshipit-source-id: bb4074d5b66233c85452c2373a08ddc1cdd0826f
  • Loading branch information
robell authored and facebook-github-bot committed Sep 22, 2023
1 parent c3f3ef4 commit 167b72d
Show file tree
Hide file tree
Showing 13 changed files with 1,122 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@
[submodule "backends/xnnpack/third-party/XNNPACK"]
path = backends/xnnpack/third-party/XNNPACK
url = https://github.com/google/XNNPACK.git
[submodule "backends/arm/third-party/serialization_lib"]
path = backends/arm/third-party/serialization_lib
url = https://git.mlplatform.org/tosa/serialization_lib.git
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ BSD License
For "ExecuTorch" software

Copyright (c) Meta Platforms, Inc. and affiliates.
Copyright 2023 Arm Limited and/or its affiliates.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Expand Down
24 changes: 24 additions & 0 deletions backends/arm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Executorch Arm/TOSA Delegate

This subtree contains the Arm Delegate implementation for Executorch.

This delegate is structured to, over time, support a number of different Arm devices
through an AoT flow which targets multiple Arm IP using the TOSA standard.

The expected flow is:
* torch.nn.module -> TOSA -> command_stream for fully AoT flows e.g. embedded.
* torch.nn.module -> TOSA for flows supporting a JiT compilation step.

Current backend support is being developed for TOSA to Ethos-U55/65 via the
ethos-u-vela compilation stack. which follows the fully AoT flow.

## Layout
- `arm_backend.py` - AoT Partitioner which maps to a subset of Base Inference and Main Inference TOSA profiles, where the subset may be further constrained for early support devices like Ethos-U55. AoT Backend which implements the preprocess step which converts to TOSA and can emit files for ethos-u-vela as shown in `executorch/examples/arm/`
- `test/` - unit test and test support functions
- `third-party/` - source dependencies - currently just on TOSA serialization_lib
- `tosa_mapping.py` - helper functions for mapping edge dialect to TOSA

## Help & Improvements
If you have problems or questions, or have suggestions for ways to make
implementation and testing better, please reach out to the Arm team developing this delegate, or
create an issue on [github](https://www.github.com/pytorch/executorch/issues).
Loading

0 comments on commit 167b72d

Please sign in to comment.