Skip to content

Commit 687425d

Browse files
committed
Fix tutorial for Qualcomm AI Engine Direct Backend
We have refactors recently and need to update the tutorial and cmake
1 parent b26eee8 commit 687425d

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

backends/qualcomm/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ target_link_libraries(qnn_executorch_backend
253253
qnn_executorch_header
254254
qnn_schema
255255
qnn_manager
256-
executorch
256+
executorch_no_prim_ops
257257
qcir_utils
258258
)
259259
target_link_libraries(utils

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,12 @@ Python APIs on x64 are required to compile models to Qualcomm AI Engine Direct b
115115

116116
```bash
117117
cd $EXECUTORCH_ROOT
118-
mkdir build_x86_64
119-
cd build_x86_64
118+
# Workaround for fbs files in exir/_serialize
119+
cp schema/program.fbs exir/_serialize/program.fbs
120+
cp schema/scalar_type.fbs exir/_serialize/scalar_type.fbs
121+
122+
mkdir cmake_out
123+
cd cmake_out
120124
cmake .. -DEXECUTORCH_BUILD_QNN=ON -DQNN_SDK_ROOT=${QNN_SDK_ROOT}
121125
cmake --build . -t "PyQnnManagerAdaptor" "PyQnnWrapperAdaptor" -j8
122126

@@ -134,12 +138,12 @@ Commands to build `qnn_executor_runner` for Android:
134138

135139
```bash
136140
cd $EXECUTORCH_ROOT
137-
mkdir build_android
138-
cd build_android
141+
mkdir cmake_android_out
142+
cd cmake_android_out
139143
# build executorch & qnn_executorch_backend
140144
cmake .. \
141-
-DBUCK2=buck2 \
142145
-DCMAKE_INSTALL_PREFIX=$PWD \
146+
-DEXECUTORCH_BUILD_SDK=ON \
143147
-DEXECUTORCH_BUILD_QNN=ON \
144148
-DQNN_SDK_ROOT=$QNN_SDK_ROOT \
145149
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
@@ -162,7 +166,7 @@ cmake --build examples/qualcomm -j16
162166

163167
**Note:** If you want to build for release, add `-DCMAKE_BUILD_TYPE=Release` to the `cmake` command options.
164168

165-
You can find `qnn_executor_runner` under `build_android/examples/qualcomm/`.
169+
You can find `qnn_executor_runner` under `cmake_android_out/examples/qualcomm/`.
166170

167171

168172
## Deploying and running on device
@@ -174,7 +178,7 @@ We use deeplab-v3-resnet101 as an example in this tutorial. Run below commands t
174178

175179
```
176180
cd $EXECUTORCH_ROOT
177-
python -m examples.qualcomm.scripts.deeplab_v3 -b build_android -m SM8550 --compile_only --download
181+
python -m examples.qualcomm.scripts.deeplab_v3 -b cmake_android_out -m SM8550 --compile_only --download
178182
```
179183

180184
You might see something like below:
@@ -219,7 +223,8 @@ So, we can run `qnn_executor_runner` like
219223

220224
```bash
221225
adb push ./deeplab_v3/dlv3_qnn.pte ${DEVICE_DIR}
222-
adb push ${EXECUTORCH_ROOT}/build_android/examples/qualcomm/qnn_executor_runner ${DEVICE_DIR}
226+
adb push ${EXECUTORCH_ROOT}/cmake_android_out/examples/qualcomm/qnn_executor_runner ${DEVICE_DIR}
227+
adb push ${EXECUTORCH_ROOT}/cmake_android_out/lib/libqnn_executorch_backend.so ${DEVICE_DIR}
223228
adb shell "cd ${DEVICE_DIR} \
224229
&& export LD_LIBRARY_PATH=${DEVICE_DIR} \
225230
&& export ADSP_LIBRARY_PATH=${DEVICE_DIR} \

examples/qualcomm/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ endif()
3535
# portable_ops_lib, etdump, bundled_program.
3636
find_package(executorch CONFIG REQUIRED)
3737
target_compile_options(executorch INTERFACE -DET_EVENT_TRACER_ENABLED)
38+
set(gflags_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../third-party/gflags)
3839
find_package(gflags REQUIRED)
3940

4041
set(_common_compile_options -Wno-deprecated-declarations -fPIC)

examples/qualcomm/executor_runner/qnn_executor_runner.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,10 @@ int main(int argc, char** argv) {
202202
// be used by a single thread at at time, but it can be reused.
203203
//
204204
torch::executor::ETDumpGen etdump_gen = torch::executor::ETDumpGen();
205+
// TODO: So far we have issues with etdump_gen during load_method. Enable it
206+
// after the issues are fixed.
205207
Result<Method> method =
206-
program->load_method(method_name, &memory_manager, &etdump_gen);
208+
program->load_method(method_name, &memory_manager, nullptr);
207209
ET_CHECK_MSG(
208210
method.ok(),
209211
"Loading of method %s failed with status 0x%" PRIx32,

0 commit comments

Comments
 (0)