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
Summary:
Now we use sources from extension/android, and we need to update the instructions for Android demo app.
Note: We have two ad-hoc solutions
1. For Java, so far we are copying sources; we should use package instead.
2. For JNI, we are building from top-level CMakeLists.txt; we should build from extension/android and `find_package()` for deps.
We will address these two issues in follow-up PRs.
Pull Request resolved: #1979
Reviewed By: mcr229
Differential Revision: D53791261
Pulled By: kirklandsign
fbshipit-source-id: 73e48f1cc3c444426b8b3252fc48762aa182cb98
We build the required ExecuTorch runtime library to run the model.
64
64
65
+
#### Java helper classes
66
+
67
+
Note: This is an ad-hoc solution. We will publish a formal Java package when it is ready. However, for now we need to copy sources from extension/android/src/main/java/org/pytorch/executorch.
When we set `EXECUTORCH_BUILD_XNNPACK=ON`, we will build the target [`xnn_executor_runner_lib`](https://github.com/pytorch/executorch/blob/main/backends/xnnpack/CMakeLists.txt) which in turn is linked into libexecutorchdemo via [CMake](https://github.com/pytorch/executorch/blob/main/examples/demo-apps/android/jni/CMakeLists.txt).
96
+
When we set `EXECUTORCH_BUILD_XNNPACK=ON`, we will build the target [`xnn_executor_runner_lib`](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).
84
97
85
-
`libexecutorchdemo.so` wraps up the required XNNPACK Backend runtime library from `xnn_executor_runner_lib`, and adds an additional JNI layer using fbjni. This is later exposed to Java app.
98
+
`libexecutorch_jni.so` wraps up the required XNNPACK Backend runtime library from `xnn_executor_runner_lib`, and adds an additional JNI layer using fbjni. This is later exposed to Java app.
86
99
87
100
2. Build the libraries:
88
101
@@ -110,7 +123,7 @@ cmake .. \
110
123
-DQNN_SDK_ROOT=$QNN_SDK \
111
124
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON
112
125
```
113
-
Similar to the XNNPACK library, with this setup, we compile `libexecutorchdemo.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.
126
+
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.
114
127
115
128
`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)`.
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.
Copy file name to clipboardExpand all lines: examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/executor/DType.java
0 commit comments