Skip to content

Commit c016f29

Browse files
authored
Update mps docs and fix coreml/mps doc references (pytorch#15179)
1 parent 6f7d15e commit c016f29

File tree

11 files changed

+41
-74
lines changed

11 files changed

+41
-74
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ For Apple, please refer to the [iOS documentation](docs/source/using-executorch-
2424
executorch
2525
├── <a href="backends">backends</a> - Backend delegate implementations for various hardware targets. Each backend uses partitioner to split the graph into subgraphs that can be executed on specific hardware, quantizer to optimize model precision, and runtime components to execute the graph on target hardware. For details refer to the <a href="docs/source/backend-delegates-integration.md">backend documentation</a> and the <a href="docs/source/using-executorch-export.md">Export and Lowering tutorial</a> for more information.
2626
│ ├── <a href="backends/apple">apple</a> - Apple-specific backends.
27-
│ │ ├── <a href="backends/apple/coreml">coreml</a> - CoreML backend for Apple devices. See <a href="docs/source/backends-coreml.md">doc</a>.
28-
│ │ └── <a href="backends/apple/mps">mps</a> - Metal Performance Shaders backend for Apple devices. See <a href="docs/source/backends-mps.md">doc</a>.
27+
│ │ ├── <a href="backends/apple/coreml">coreml</a> - CoreML backend for Apple devices. See <a href="docs/source/backends/coreml/coreml-overview.md">doc</a>.
28+
│ │ └── <a href="backends/apple/mps">mps</a> - Metal Performance Shaders backend for Apple devices. See <a href="docs/source/backends/mps/mps-overview.md">doc</a>.
2929
│ ├── <a href="backends/arm">arm</a> - ARM architecture backends. See <a href="docs/source/backends-arm-ethos-u.md">doc</a>.
3030
│ ├── <a href="backends/cadence">cadence</a> - Cadence-specific backends. See <a href="docs/source/backends-cadence.md">doc</a>.
3131
│ ├── <a href="backends/example">example</a> - Example backend implementations.

README-wheel.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The prebuilt `executorch.runtime` module included in this package provides a way
1212
to run ExecuTorch `.pte` files, with some restrictions:
1313
* Only [core ATen operators](docs/source/ir-ops-set-definition.md) are linked into the prebuilt module
1414
* Only the [XNNPACK backend delegate](docs/source/backends-xnnpack.md) is linked into the prebuilt module.
15-
* \[macOS only] [Core ML](docs/source/backends-coreml.md) and [MPS](docs/source/backends-mps.md) backend
15+
* \[macOS only] [Core ML](docs/source/backends/coreml/coreml-overview.md) and [MPS](docs/source/backends/mps/mps-overview.md) backend
1616
are also linked into the prebuilt module.
1717

1818
Please visit the [ExecuTorch website](https://pytorch.org/executorch) for

backends/apple/coreml/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ExecuTorch Core ML Delegate
22

33
This subtree contains the Core ML Delegate implementation for ExecuTorch.
4-
Core ML is an optimized framework for running machine learning models on Apple devices. The delegate is the mechanism for leveraging the Core ML framework to accelerate operators when running on Apple devices. To learn how to use the CoreML delegate, see the [documentation](https://github.com/pytorch/executorch/blob/main/docs/source/backends-coreml.md).
4+
Core ML is an optimized framework for running machine learning models on Apple devices. The delegate is the mechanism for leveraging the Core ML framework to accelerate operators when running on Apple devices. To learn how to use the CoreML delegate, see the [documentation](https://github.com/pytorch/executorch/blob/main/docs/source/backends/coreml/coreml-overview.md).
55

66
## Layout
77
- `compiler/` : Lowers a module to Core ML backend.

docs/source/backends-overview.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ Backends are the bridge between your exported model and the hardware it runs on.
1818

1919
## Choosing a Backend
2020

21-
| Backend | Platform(s) | Hardware Type | Typical Use Case |
22-
|------------------------------------------------|---------------------|---------------|---------------------------------|
23-
| [XNNPACK](backends-xnnpack) | All | CPU | General-purpose, fallback |
24-
| [Core ML](/backends/coreml/coreml-overview.md) | iOS, macOS | NPU/GPU/CPU | Apple devices, high performance |
25-
| [Metal Performance Shaders](backends-mps) | iOS, macOS | GPU | Apple GPU acceleration |
26-
| [Vulkan ](backends-vulkan) | Android | GPU | Android GPU acceleration |
27-
| [Qualcomm](backends-qualcomm) | Android | NPU | Qualcomm SoCs |
28-
| [MediaTek](backends-mediatek) | Android | NPU | MediaTek SoCs |
29-
| [ARM EthosU](backends-arm-ethos-u) | Embedded | NPU | ARM MCUs |
30-
| [ARM VGF](backends-arm-vgf) | Android | NPU | ARM platforms |
31-
| [OpenVINO](build-run-openvino) | Embedded | CPU/GPU/NPU | Intel SoCs |
32-
| [NXP](backends-nxp) | Embedded | NPU | NXP SoCs |
33-
| [Cadence](backends-cadence) | Embedded | DSP | DSP-optimized workloads |
34-
| [Samsung Exynos](backends-samsung-exynos) | Android | NPU | Samsung SoCs |
21+
| Backend | Platform(s) | Hardware Type | Typical Use Case |
22+
|-----------------------------------------------------------------|---------------------|---------------|---------------------------------|
23+
| [XNNPACK](backends-xnnpack) | All | CPU | General-purpose, fallback |
24+
| [Core ML](/backends/coreml/coreml-overview.md) | iOS, macOS | NPU/GPU/CPU | Apple devices, high performance |
25+
| [Metal Performance Shaders](/backends/mps/mps-overview.md) | iOS, macOS | GPU | Apple GPU acceleration |
26+
| [Vulkan ](backends-vulkan) | Android | GPU | Android GPU acceleration |
27+
| [Qualcomm](backends-qualcomm) | Android | NPU | Qualcomm SoCs |
28+
| [MediaTek](backends-mediatek) | Android | NPU | MediaTek SoCs |
29+
| [ARM EthosU](backends-arm-ethos-u) | Embedded | NPU | ARM MCUs |
30+
| [ARM VGF](backends-arm-vgf) | Android | NPU | ARM platforms |
31+
| [OpenVINO](build-run-openvino) | Embedded | CPU/GPU/NPU | Intel SoCs |
32+
| [NXP](backends-nxp) | Embedded | NPU | NXP SoCs |
33+
| [Cadence](backends-cadence) | Embedded | DSP | DSP-optimized workloads |
34+
| [Samsung Exynos](backends-samsung-exynos) | Android | NPU | Samsung SoCs |
3535

3636
**Tip:** For best performance, export a `.pte` file for each backend you plan to support.
3737

@@ -52,7 +52,7 @@ Backends are the bridge between your exported model and the hardware it runs on.
5252
5353
backends-xnnpack
5454
backends/coreml/coreml-overview
55-
backends-mps
55+
backends/mps/mps-overview
5656
backends-vulkan
5757
backends-qualcomm
5858
backends-mediatek

docs/source/backends-mps.md renamed to docs/source/backends/mps/mps-overview.md

Lines changed: 15 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,27 @@
11
# MPS Backend
22

3-
In this tutorial we will walk you through the process of getting setup to build the MPS backend for ExecuTorch and running a simple model on it.
3+
MPS delegate is the ExecuTorch solution to take advantage of Apple's GPU for on-device ML using the [MPS Graph](https://developer.apple.com/documentation/metalperformanceshadersgraph/mpsgraph?language=objc) framework and tuned kernels provided by [MPS](https://developer.apple.com/documentation/metalperformanceshaders?language=objc).
44

5-
The MPS backend device maps machine learning computational graphs and primitives on the [MPS Graph](https://developer.apple.com/documentation/metalperformanceshadersgraph/mpsgraph?language=objc) framework and tuned kernels provided by [MPS](https://developer.apple.com/documentation/metalperformanceshaders?language=objc).
5+
## Target Requirements
66

7-
::::{grid} 2
8-
:::{grid-item-card} What you will learn in this tutorial:
9-
:class-card: card-prerequisites
10-
* In this tutorial you will learn how to export [MobileNet V3](https://pytorch.org/vision/main/models/mobilenetv3.html) model to the MPS delegate.
11-
* You will also learn how to compile and deploy the ExecuTorch runtime with the MPS delegate on macOS and iOS.
12-
:::
13-
:::{grid-item-card} Tutorials we recommend you complete before this:
14-
:class-card: card-prerequisites
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)
18-
* [ExecuTorch iOS Demo App](https://github.com/meta-pytorch/executorch-examples/tree/main/mv3/apple/ExecuTorchDemo)
19-
* [ExecuTorch LLM iOS Demo App](https://github.com/meta-pytorch/executorch-examples/tree/main/llm/apple)
20-
:::
21-
::::
7+
Below are the minimum OS requirements on various hardware for running a MPS-delegated ExecuTorch model:
8+
- [macOS](https://developer.apple.com/macos) >= 12.4
9+
- [iOS](https://www.apple.com/ios) >= 15.4
2210

11+
## Development Requirements
12+
To develop you need:
2313

24-
## Prerequisites (Hardware and Software)
14+
- [Xcode](https://developer.apple.com/xcode/) >= 14.1
2515

26-
In order to be able to successfully build and run a model using the MPS backend for ExecuTorch, you'll need the following hardware and software components:
16+
Before starting, make sure you install the Xcode Command Line Tools:
2717

28-
### Hardware:
29-
- A [mac](https://www.apple.com/mac/) for tracing the model
30-
31-
### Software:
32-
33-
- **Ahead of time** tracing:
34-
- [macOS](https://www.apple.com/macos/) 12
35-
36-
- **Runtime**:
37-
- [macOS](https://www.apple.com/macos/) >= 12.4
38-
- [iOS](https://www.apple.com/ios) >= 15.4
39-
- [Xcode](https://developer.apple.com/xcode/) >= 14.1
40-
41-
## Setting up Developer Environment
42-
43-
***Step 1.*** Complete the steps in [Getting Started](getting-started.md) to set up the ExecuTorch development environment.
44-
45-
You will also need a local clone of the ExecuTorch repository. See [Building ExecuTorch from Source](using-executorch-building-from-source.html) for instructions. All commands in this document should be run from the executorch repository.
46-
47-
## Build
18+
```bash
19+
xcode-select --install
20+
```
4821

49-
### AOT (Ahead-of-time) Components
22+
## Using the MPS Backend
5023

51-
**Compiling model for MPS delegate**:
52-
- In this step, you will generate a simple ExecuTorch program that lowers MobileNetV3 model to the MPS delegate. You'll then pass this Program (the `.pte` file) during the runtime to run it using the MPS backend.
24+
In this step, you will generate a simple ExecuTorch program that lowers MobileNetV3 model to the MPS delegate. You'll then pass this Program (the `.pte` file) during the runtime to run it using the MPS backend.
5325

5426
```bash
5527
cd executorch
@@ -121,7 +93,7 @@ python3 -m examples.apple.mps.scripts.mps_example --model_name="mv3" --generate_
12193
python3 -m devtools.inspector.inspector_cli --etdump_path etdump.etdp --etrecord_path etrecord.bin
12294
```
12395

124-
## Deploying and Running on Device
96+
## Runtime integration
12597

12698
***Step 1***. Create the ExecuTorch core and MPS delegate frameworks to link on iOS
12799
```bash
@@ -146,8 +118,3 @@ From the same page, include the needed libraries for the MPS delegate:
146118
- `Metal.framework`
147119

148120
In this tutorial, you have learned how to lower a model to the MPS delegate, build the mps_executor_runner and run a lowered model through the MPS delegate, or directly on device using the MPS delegate static library.
149-
150-
151-
## Frequently encountered errors and resolution.
152-
153-
If you encountered any bugs or issues following this tutorial please file a bug/issue on the [ExecuTorch repository](https://github.com/pytorch/executorch/issues), with hashtag **#mps**.

docs/source/ios-coreml.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
```{include} backends-coreml.md
1+
```{include} backends/coreml/coreml-overview.md

docs/source/ios-mps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
```{include} backends-mps.md
1+
```{include} backends/mps/mps-overview.md

docs/source/quantization-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ These quantizers usually support configs that allow users to specify quantizatio
2929
Not all quantization options are supported by all backends. Consult backend-specific guides for supported quantization modes and configuration, and how to initialize the backend-specific PT2E quantizer:
3030

3131
* [XNNPACK quantization](backends-xnnpack.md#quantization)
32-
* [CoreML quantization](backends-coreml.md#quantization)
32+
* [CoreML quantization](backends/coreml/coreml-quantization.md)
3333
* [QNN quantization](backends-qualcomm.md#step-2-optional-quantize-your-model)
3434

3535

docs/source/using-executorch-building-from-source.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ xcode-select --install
385385
```
386386
387387
Run the above command with `--help` flag to learn more on how to build additional backends
388-
(like [Core ML](backends-coreml.md), [MPS](backends-mps.md) or XNNPACK), etc.
388+
(like [Core ML](backends/coreml/coreml-overview.md), [MPS](backends/mps/mps-overview.md) or XNNPACK), etc.
389389
Note that some backends may require additional dependencies and certain versions of Xcode and iOS.
390390
See backend-specific documentation for more details.
391391

docs/source/using-executorch-export.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ As part of the .pte file creation process, ExecuTorch identifies portions of the
3333
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 and the [Export and Lowering](#export-and-lowering) section below for more information.
3434

3535
- [XNNPACK (CPU)](backends-xnnpack.md)
36-
- [Core ML (iOS)](backends-coreml.md)
37-
- [Metal Performance Shaders (iOS GPU)](backends-mps.md)
36+
- [Core ML (iOS)](backends/coreml/coreml-overview.md)
37+
- [Metal Performance Shaders (iOS GPU)](backends/mps/mps-overview.md)
3838
- [Vulkan (Android GPU)](backends-vulkan.md)
3939
- [Qualcomm NPU](backends-qualcomm.md)
4040
- [MediaTek NPU](backends-mediatek.md)

0 commit comments

Comments
 (0)