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
MediaTek backend allows ExecuTorch to speed up PyTorh models on edge devices that equips with MediaTek Neuron Processing Unit (NPU). This document provides a step-by-step guide to set up the build environment for the MediaTek ExecuTorch libraries.
2
3
3
-
This document provides a step-by-step guide to set up the build environment for the MediaTek ExercuTorch libraries.
4
+
## Supported Chips
4
5
5
-
## Prerequisites
6
+
The examples provided in this repository are tested and supported on the following MediaTek chip:
7
+
8
+
- MediaTek Dimensity 9300 (D9300)
9
+
10
+
## Build Instructions
11
+
12
+
### Prerequisites
6
13
7
14
Before you begin, ensure you have the following prerequisites installed and configured:
8
15
9
-
### 1. Buck2 Build Tool
16
+
####1. Buck2 Build Tool
10
17
11
18
-**Download Buck2**: Obtain Buck2 from the official [releases page](https://github.com/facebook/buck2/releases/tag/2024-02-01).
12
19
-**Add to PATH**: Extract the downloaded file and add the directory to your system's `$PATH` environment variable.
13
20
```bash
14
21
export PATH=<path_to_buck>:$PATH
15
22
```
16
23
17
-
### 2. Android NDK
24
+
####2. Android NDK
18
25
19
26
-**Download Android NDK**: Acquire the Android NDK version 26.3.11579264 from the [Android developer site](https://developer.android.com/ndk/downloads).
20
27
-**Set NDK Path**: Ensure that the `$ANDROID_NDK` environment variable is set to the path where the NDK is located.
21
28
```bash
22
29
export ANDROID_NDK=<path_to_android_ndk>
23
30
```
24
31
25
-
### 3. MediaTek ExercuTorch Libraries
32
+
####3. MediaTek ExecuTorch Libraries
26
33
27
34
Download [NeuroPilot Express SDK](https://neuropilot.mediatek.com/resources/public/npexpress/en/docs/npexpress) from MediaTek's NeuroPilot portal:
-`mtk_converter-8.8.0.dev20240723+public.d1467db9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl`: This library preprocess the model into a MediaTek representation.
32
39
-`mtk_neuron-8.2.2-py3-none-linux_x86_64.whl`: This library converts the model to binaries.
33
40
34
-
## Setup
41
+
###Setup
35
42
36
43
Follow the steps below to setup your build environment:
37
44
38
-
1.**Setup ExercuTorch Environment**: Refer to the [Setting up ExercuTorch](https://pytorch.org/executorch/stable/getting-started-setup) guide for detailed instructions on setting up the ExercuTorch environment.
45
+
1.**Setup ExecuTorch Environment**: Refer to the [Setting up ExecuTorch](https://pytorch.org/executorch/stable/getting-started-setup) guide for detailed instructions on setting up the ExecuTorch environment.
39
46
40
47
2.**Setup MediaTek Backend Environment**
41
48
- Install the dependent libs. Ensure that you are inside backends/mediatek/ directory
@@ -52,18 +59,21 @@ Follow the steps below to setup your build environment:
1.**Build MediaTek Backend**: Once the prerequisites are in place, run the `mtk_build.sh` script to start the build process, MediaTek backend will be built under `cmake-android-out/backends/` as `libneuron_backend.so`
65
+
2.**Build MediaTek Backend**: Once the prerequisites are in place, run the `mtk_build.sh` script to start the build process, MediaTek backend will be built under `cmake-android-out/backends/` as `libneuron_backend.so`
58
66
59
67
```bash
60
68
./mtk_build.sh
61
69
```
62
70
63
-
## Run
71
+
###Run
64
72
65
-
1.**Push MediaTek universal SDK and MediaTek backend to the device**: push `libneuronusdk_adapter.mtk.so` and `libneuron_backend.so` to the phone and export it to the `$LD_LIBRARY_PATH` environment variable before executing ExercuTorch with MediaTek backend.
73
+
1.**Push MediaTek universal SDK and MediaTek backend to the device**: push `libneuronusdk_adapter.mtk.so` and `libneuron_backend.so` to the phone and export it to the `$LD_LIBRARY_PATH` environment variable before executing ExecuTorch with MediaTek backend.
0 commit comments