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
When we set `EXECUTORCH_BUILD_XNNPACK=ON`, we will build the target [`xnnpack_backend`](https://github.com/pytorch/executorch/blob/main/backends/xnnpack/CMakeLists.txt) which in turn is linked into libexecutorch_jni via [CMake](https://github.com/pytorch/executorch/blob/main/examples/demo-apps/android/jni/CMakeLists.txt).
`libexecutorch_jni.so` wraps up the required XNNPACK Backend runtime library from `xnnpack_backend`, and adds an additional JNI layer using fbjni. This is later exposed to Java app.
107
-
108
92
#### Qualcomm Hexagon NPU
109
93
110
-
1. Build the CMake target for the library with Qualcomm Hexagon NPU (HTP) backend (XNNPACK also included):
111
-
112
94
```bash
95
+
# go to ExecuTorch repo root
113
96
export ANDROID_NDK=<path-to-android-ndk>
114
-
exportANDROID_ABI=arm64-v8a
115
-
export QNN_SDK_ROOT=<path-to-qnn-sdk>
97
+
exportANDROID_ABIS=arm64-v8a
98
+
export QNN_SDK_ROOT=<path-to-qnn-sdk-root>
116
99
100
+
# Run the following lines from the `executorch/` folder
Similar to the XNNPACK library, with this setup, we compile `libexecutorch_jni.so` but it adds an additional static library `qnn_executorch_backend` which wraps up Qualcomm HTP runtime library and registers the Qualcomm HTP backend. This is later exposed to Java app.
134
-
135
-
`qnn_executorch_backend` is built when we turn on CMake option `EXECUTORCH_BUILD_QNN`. It will include the [CMakeLists.txt](https://github.com/pytorch/executorch/blob/main/backends/qualcomm/CMakeLists.txt) from backends/qualcomm where we `add_library(qnn_executorch_backend STATIC)`.
136
102
137
-
2. Build the Android extension:
103
+
# Create a new directory `app/libs` for the AAR to live
This allows the Android app to load ExecuTorch runtime with XNNPACK backend as a JNI library. Later, this shared library will be loaded by `NativePeer.java` in Java code.
160
-
161
-
### Steps for Deploying Model via Qualcomm's AI Engine Direct
Copy file name to clipboardExpand all lines: examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/ClassificationActivity.java
0 commit comments