Skip to content

Commit 0ae6d82

Browse files
committed
Clean up documentation placeholders and links, add top-level docs for C++ APIs, Android, and troubleshooting (#8618)
* Clean up getting-started.md, remove placeholders * Move Android pre-built AAR info into top-level Android page * Add placeholder backend overview * Add placeholder troubleshooting docs * Populate top-level C++ API doc * Clean up additional doc placeholders and fix broken links * Add env setup instructions for source build
1 parent a67e250 commit 0ae6d82

21 files changed

+297
-104
lines changed

docs/source/android-prebuilt-library.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

docs/source/backends-arm-ethos-u.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
:::{grid-item-card} Tutorials we recommend you complete before this:
88
:class-card: card-prerequisites
99
* [Introduction to ExecuTorch](./intro-how-it-works.md)
10-
* [Setting up ExecuTorch](./getting-started-setup.md)
11-
* [Building ExecuTorch with CMake](./runtime-build-and-cross-compilation.md)
10+
* [Getting Started](./getting-started.md)
11+
* [Building ExecuTorch with CMake](./using-executorch-building-from-source.md)
1212
:::
1313

1414
:::{grid-item-card} What you will learn in this tutorial:
@@ -286,7 +286,7 @@ The `generate_pte_file` function in `run.sh` script produces the `.pte` files ba
286286

287287
ExecuTorch's CMake build system produces a set of build pieces which are critical for us to include and run the ExecuTorch runtime with-in the bare-metal environment we have for Corstone FVPs from Ethos-U SDK.
288288

289-
[This](./runtime-build-and-cross-compilation.md) document provides a detailed overview of each individual build piece. For running either variant of the `.pte` file, we will need a core set of libraries. Here is a list,
289+
[This](./using-executorch-building-from-source.md) document provides a detailed overview of each individual build piece. For running either variant of the `.pte` file, we will need a core set of libraries. Here is a list,
290290

291291
- `libexecutorch.a`
292292
- `libportable_kernels.a`

docs/source/backends-cadence.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ On top of being able to run on the Xtensa HiFi4 DSP, another goal of this tutori
1717
:::
1818
:::{grid-item-card} Tutorials we recommend you complete before this:
1919
:class-card: card-prerequisites
20-
* [Introduction to ExecuTorch](intro-how-it-works.md)
21-
* [Setting up ExecuTorch](getting-started-setup.md)
22-
* [Building ExecuTorch with CMake](runtime-build-and-cross-compilation.md)
20+
* [Introduction to ExecuTorch](./intro-how-it-works.md)
21+
* [Getting Started](./getting-started.md)
22+
* [Building ExecuTorch with CMake](./using-executorch-building-from-source.md)
2323
:::
2424
::::
2525

docs/source/backends-coreml.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Core ML delegate uses Core ML APIs to enable running neural networks via Apple's
1111
:::
1212
:::{grid-item-card} Tutorials we recommend you complete before this:
1313
:class-card: card-prerequisites
14-
* [Introduction to ExecuTorch](intro-how-it-works.md)
15-
* [Setting up ExecuTorch](getting-started-setup.md)
16-
* [Building ExecuTorch with CMake](runtime-build-and-cross-compilation.md)
14+
* [Introduction to ExecuTorch](./intro-how-it-works.md)
15+
* [Getting Started](./getting-started.md)
16+
* [Building ExecuTorch with CMake](./using-executorch-building-from-source.md)
1717
* [ExecuTorch iOS Demo App](demo-apps-ios.md)
1818
:::
1919
::::

docs/source/backends-mediatek.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ MediaTek backend empowers ExecuTorch to speed up PyTorch models on edge devices
1111
:::
1212
:::{grid-item-card} Tutorials we recommend you complete before this:
1313
:class-card: card-prerequisites
14-
* [Introduction to ExecuTorch](intro-how-it-works.md)
15-
* [Setting up ExecuTorch](getting-started-setup.md)
16-
* [Building ExecuTorch with CMake](runtime-build-and-cross-compilation.md)
14+
* [Introduction to ExecuTorch](./intro-how-it-works.md)
15+
* [Getting Started](./getting-started.md)
16+
* [Building ExecuTorch with CMake](./using-executorch-building-from-source.md)
1717
:::
1818
::::
1919

@@ -91,4 +91,4 @@ cd executorch
9191

9292
```bash
9393
export LD_LIBRARY_PATH=<path_to_usdk>:<path_to_neuron_backend>:$LD_LIBRARY_PATH
94-
```
94+
```

docs/source/backends-mps.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ The MPS backend device maps machine learning computational graphs and primitives
1212
:::
1313
:::{grid-item-card} Tutorials we recommend you complete before this:
1414
:class-card: card-prerequisites
15-
* [Introduction to ExecuTorch](intro-how-it-works.md)
16-
* [Setting up ExecuTorch](getting-started-setup.md)
17-
* [Building ExecuTorch with CMake](runtime-build-and-cross-compilation.md)
15+
* [Introduction to ExecuTorch](./intro-how-it-works.md)
16+
* [Getting Started](./getting-started.md)
17+
* [Building ExecuTorch with CMake](./using-executorch-building-from-source.md)
1818
* [ExecuTorch iOS Demo App](demo-apps-ios.md)
1919
* [ExecuTorch iOS LLaMA Demo App](llm/llama-demo-ios.md)
2020
:::

docs/source/backends-overview.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Backend Overview
2+
3+
ExecuTorch backends provide hardware acceleration for a specific hardware target. In order to achieve maximum performance on target hardware, ExecuTorch optimizes the model for a specific backend during the export and lowering process. This means that the resulting .pte file is specialized for the specific hardware. In order to deploy to multiple backends, such as Core ML on iOS and Arm CPU on Android, it is common to generate a dedicated .pte file for each.
4+
5+
The choice of hardware backend is informed by the hardware that the model is intended to be deployed on. Each backend has specific hardware requires and level of model support. See the documentation for each hardware backend for more details.
6+
7+
As part of the .pte file creation process, ExecuTorch identifies portions of the model (partitions) that are supported for the given backend. These sections are processed by the backend ahead of time to support efficient execution. Portions of the model that are not supported on the delegate, if any, are executed using the portable fallback implementation on CPU. This allows for partial model acceleration when not all model operators are supported on the backend, but may have negative performance implications. In addition, multiple partitioners can be specified in order of priority. This allows for operators not supported on GPU to run on CPU via XNNPACK, for example.
8+
9+
### Available Backends
10+
11+
Commonly used hardware backends are listed below. For mobile, consider using XNNPACK for Android and XNNPACK or Core ML for iOS. To create a .pte file for a specific backend, pass the appropriate partitioner class to `to_edge_transform_and_lower`. See the appropriate backend documentation for more information.
12+
13+
- [XNNPACK (Mobile CPU)](backends-xnnpack.md)
14+
- [Core ML (iOS)](backends-coreml.md)
15+
- [Metal Performance Shaders (iOS GPU)](backends-mps.md)
16+
- [Vulkan (Android GPU)](backends-vulkan.md)
17+
- [Qualcomm NPU](backends-qualcomm.md)
18+
- [MediaTek NPU](backends-mediatek.md)
19+
- [Arm Ethos-U NPU](backends-arm-ethos-u.md)
20+
- [Cadence DSP](backends-cadence.md)

docs/source/backends-qualcomm.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Qualcomm AI Engine Direct is also referred to as QNN in the source and documenta
1414
:::
1515
:::{grid-item-card} Tutorials we recommend you complete before this:
1616
:class-card: card-prerequisites
17-
* [Introduction to ExecuTorch](intro-how-it-works.md)
18-
* [Setting up ExecuTorch](getting-started-setup.md)
19-
* [Building ExecuTorch with CMake](runtime-build-and-cross-compilation.md)
17+
* [Introduction to ExecuTorch](./intro-how-it-works.md)
18+
* [Getting Started](./getting-started.md)
19+
* [Building ExecuTorch with CMake](./using-executorch-building-from-source.md)
2020
:::
2121
::::
2222

docs/source/getting-started.md

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Pip is the recommended way to install the ExecuTorch python package. This packag
1414
pip install executorch
1515
```
1616

17-
To build the framework from source, see [Building From Source](TODO).
17+
To build the framework from source, see [Building From Source](using-executorch-building-from-source.md).
1818

1919
Backend delegates may require additional dependencies. See the appropriate backend documentation for more information.
2020

@@ -29,7 +29,9 @@ The following are required to install the ExecuTorch host libraries, needed to e
2929
<hr/>
3030

3131
## Preparing the Model
32-
Exporting is the process of taking a PyTorch model and converting it to the .pte file format used by the ExecuTorch runtime. This is done using Python APIs. PTE files for common models can be found on HuggingFace (TODO add link).
32+
Exporting is the process of taking a PyTorch model and converting it to the .pte file format used by the ExecuTorch runtime. This is done using Python APIs. PTE files for common models, such as Llama 3.2, can be found on HuggingFace under [ExecuTorch Community](https://huggingface.co/executorch-community). These models have been exported and lowered for ExecuTorch, and can be directly deployed without needing to go through the lowering process.
33+
34+
A complete example of exporting, lowering, and verifying MobileNet V2 is available as a [Colab notebook](https://colab.research.google.com/drive/1qpxrXC3YdJQzly3mRg-4ayYiOjC6rue3?usp=sharing).
3335

3436
### Requirements
3537
- A PyTorch model.
@@ -39,7 +41,7 @@ Exporting is the process of taking a PyTorch model and converting it to the .pte
3941
### Selecting a Backend
4042
ExecuTorch provides hardware acceleration for a wide variety of hardware. The most commonly used backends are XNNPACK, for Arm and x86 CPU, Core ML (for iOS), Vulkan (for Android GPUs), and Qualcomm (for Qualcomm-powered Android phones).
4143

42-
For mobile use cases, consider using XNNPACK for Android and Core ML or XNNPACK for iOS as a first step. See [Delegates](/TODO.md) for a description of available backends.
44+
For mobile use cases, consider using XNNPACK for Android and Core ML or XNNPACK for iOS as a first step. See [Hardware Backends](backends-overview.md) for more information.
4345

4446
### Exporting
4547
Exporting is done using Python APIs. ExecuTorch provides a high degree of customization during the export process, but the typical flow is as follows:
@@ -50,13 +52,13 @@ model = MyModel() # The PyTorch model to export
5052
example_inputs = (torch.randn(1,3,64,64),) # A tuple of inputs
5153

5254
et_program =
53-
executorch.exir.to_edge_transform_and_lower(
54-
torch.export.export(model, example_inputs)
55+
executorch.exir.to_edge_transform_and_lower(
56+
torch.export.export(model, example_inputs)
5557
partitioner=[XnnpackPartitioner()]
5658
).to_executorch()
5759

5860
with open(“model.pte”, “wb”) as f:
59-
f.write(et_program.buffer)
61+
f.write(et_program.buffer)
6062
```
6163

6264
If the model requires varying input sizes, you will need to specify the varying dimensions and bounds as part of the `export` call. See [Model Export and Lowering](using-executorch-export.md) for more information.
@@ -96,7 +98,7 @@ Quick Links:
9698

9799
#### Installation
98100
ExecuTorch provides Java bindings for Android usage, which can be consumed from both Java and Kotlin.
99-
To add the library to your app, download the AAR, and add it to the gradle build rule. TODO Replace with Maven/Gradle package management when available.
101+
To add the library to your app, download the AAR, and add it to the gradle build rule.
100102

101103
```
102104
mkdir -p app/libs
@@ -113,39 +115,39 @@ dependencies {
113115
#### Runtime APIs
114116
Models can be loaded and run using the `Module` class:
115117
```java
116-
import org.pytorch.executorch.EValue
117-
import org.pytorch.executorch.Module
118-
import org.pytorch.executorch.Tensor
118+
import org.pytorch.executorch.EValue;
119+
import org.pytorch.executorch.Module;
120+
import org.pytorch.executorch.Tensor;
119121

120122
//
121123

122-
Module model = Module.load(“/path/to/model.pte”)
123-
// TODO Add input setup
124-
EValue output = model.forward(input_evalue);
124+
Module model = Module.load(“/path/to/model.pte”);
125+
126+
Tensor input_tensor = Tensor.fromBlob(float_data, new long[] { 1, 3, height, width });
127+
EValue input_evalue = EValue.from(input_tensor);
128+
EValue[] output = model.forward(input_evalue);
129+
float[] scores = output[0].toTensor().getDataAsFloatArray();
125130
```
126131

127-
For more information on Android development, including building from source, a full description of the Java APIs, and information on using ExecuTorch from Android native code, see [Using ExecuTorch on Android](/TODO.md).
132+
For a full example of running a model on Android, see the [ExecuTorch Android Demo App](https://github.com/pytorch/executorch/blob/main/examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/ClassificationActivity.java). For more information on Android development, including building from source, a full description of the Java APIs, and information on using ExecuTorch from Android native code, see [Using ExecuTorch on Android](using-executorch-android.md).
128133

129134
### iOS
130135

131136
#### Installation
132-
ExecuTorch supports both iOS and MacOS via C++ and Objective-C bindings, as well as hardware backends for CoreML, MPS, and CPU. The iOS runtime library is provided as a collection of .xcframework targets and are made available as a Swift PM package.
137+
ExecuTorch supports both iOS and MacOS via C++, as well as hardware backends for CoreML, MPS, and CPU. The iOS runtime library is provided as a collection of .xcframework targets and are made available as a Swift PM package.
133138

134-
To get started with Xcode, go to File > Add Package Dependencies. Paste the URL of the ExecuTorch repo into the search bar and select it. Make sure to change the branch name to the desired ExecuTorch version in format “swiftpm-”, (e.g. “swiftpm-0.5.0”). The ExecuTorch dependency can also be added to the package file manually. See [Using ExecuTorch on iOS](/TODO.md) for more information.
139+
To get started with Xcode, go to File > Add Package Dependencies. Paste the URL of the ExecuTorch repo into the search bar and select it. Make sure to change the branch name to the desired ExecuTorch version in format “swiftpm-”, (e.g. “swiftpm-0.5.0”). The ExecuTorch dependency can also be added to the package file manually. See [Using ExecuTorch on iOS](using-executorch-ios.md) for more information.
135140

136141
#### Runtime APIs
137-
Models can be loaded and run from Swift as follows:
138-
```swift
139-
// TODO Code sample
140-
```
142+
Models can be loaded and run from Objective-C using the C++ APIs.
141143

142-
For more information on iOS integration, including an API reference, logging setup, and building from source, see [Using ExecuTorch on iOS](/TODO.md).
144+
For more information on iOS integration, including an API reference, logging setup, and building from source, see [Using ExecuTorch on iOS](using-executorch-ios.md).
143145

144146
### C++
145147
ExecuTorch provides C++ APIs, which can be used to target embedded or mobile devices. The C++ APIs provide a greater level of control compared to other language bindings, allowing for advanced memory management, data loading, and platform integration.
146148

147149
#### Installation
148-
CMake is the preferred build system for the ExecuTorch C++ runtime. To use with CMake, clone the ExecuTorch repository as a subdirectory of your project, and use CMake's `add_subdirectory("executorch")` to include the dependency. The `executorch` target, as well as kernel and backend targets will be made available to link against. The runtime can also be built standalone to support diverse toolchains. See [Using ExecuTorch with C++](/TODO.md) for a detailed description of build integration, targets, and cross compilation.
150+
CMake is the preferred build system for the ExecuTorch C++ runtime. To use with CMake, clone the ExecuTorch repository as a subdirectory of your project, and use CMake's `add_subdirectory("executorch")` to include the dependency. The `executorch` target, as well as kernel and backend targets will be made available to link against. The runtime can also be built standalone to support diverse toolchains. See [Using ExecuTorch with C++](using-executorch-cpp.md) for a detailed description of build integration, targets, and cross compilation.
149151

150152
```
151153
git clone -b release/0.5 https://github.com/pytorch/executorch.git
@@ -199,9 +201,9 @@ For more information on the C++ APIs, see [Running an ExecuTorch Model Using the
199201
ExecuTorch provides a high-degree of customizability to support diverse hardware targets. Depending on your use cases, consider exploring one or more of the following pages:
200202
201203
- [Export and Lowering](using-executorch-export.md) for advanced model conversion options.
202-
- [Delegates](/TODO.md) for available backends and configuration options.
203-
- [Using ExecuTorch on Android](/TODO.md) and [Using ExecuTorch on iOS](TODO.md) for mobile runtime integration.
204-
- [Using ExecuTorch with C++](/TODO.md) for embedded and mobile native development.
205-
- [Troubleshooting, Profiling, and Optimization](/TODO.md) for developer tooling and debugging.
206-
- [API Reference](/TODO.md) for a full description of available APIs.
207-
- [Examples](https://github.com/pytorch/executorch/tree/main/examples) for demo apps and example code.
204+
- [Backend Overview](backends-overview.md) for available backends and configuration options.
205+
- [Using ExecuTorch on Android](using-executorch-android.md) and [Using ExecuTorch on iOS](using-executorch-ios.md) for mobile runtime integration.
206+
- [Using ExecuTorch with C++](using-executorch-cpp.md) for embedded and mobile native development.
207+
- [Profiling and Debugging](using-executorch-troubleshooting.md) for developer tooling and debugging.
208+
- [API Reference](export-to-executorch-api-reference.md) for a full description of available APIs.
209+
- [Examples](https://github.com/pytorch/executorch/tree/main/examples) for demo apps and example code.

docs/source/index.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,16 @@ Topics in this section will help you get started with ExecuTorch.
9494
using-executorch-cpp
9595
using-executorch-runtime-integration
9696
using-executorch-troubleshooting
97-
using-executorch-faqs
9897
using-executorch-building-from-source
98+
using-executorch-faqs
9999

100100
.. toctree::
101101
:glob:
102102
:maxdepth: 1
103103
:caption: Backends
104104
:hidden:
105105

106+
backends-overview
106107
backends-xnnpack
107108
backends-coreml
108109
backends-mps
@@ -142,6 +143,9 @@ Topics in this section will help you get started with ExecuTorch.
142143
:hidden:
143144

144145
runtime-overview
146+
extension-module
147+
extension-tensor
148+
running-a-model-cpp-tutorial
145149
runtime-backend-delegate-implementation-and-linking
146150
runtime-platform-abstraction-layer
147151
portable-cpp-programming

docs/source/llm/build-run-llama3-qualcomm-ai-engine-direct-backend.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This tutorial demonstrates how to export Llama 3 8B Instruct for Qualcomm AI Eng
55
## Prerequisites
66

77
- Set up your ExecuTorch repo and environment if you haven’t done so by following [the Setting up ExecuTorch](../getting-started-setup.md) to set up the repo and dev environment.
8-
- Read [the Building and Running ExecuTorch with Qualcomm AI Engine Direct Backend page](../build-run-qualcomm-ai-engine-direct-backend.md) to understand how to export and run a model with Qualcomm AI Engine Direct Backend on Qualcomm device.
8+
- Read [the Building and Running ExecuTorch with Qualcomm AI Engine Direct Backend page](../backends-qualcomm.md) to understand how to export and run a model with Qualcomm AI Engine Direct Backend on Qualcomm device.
99
- Follow [the README for executorch llama](https://github.com/pytorch/executorch/tree/main/examples/models/llama) to know how to run a llama model on mobile via ExecuTorch.
1010
- A Qualcomm device with 16GB RAM
1111
- We are continuing to optimize our memory usage to ensure compatibility with lower memory devices.

0 commit comments

Comments
 (0)