pytorch / executorch

On-device AI across mobile, embedded and edge for PyTorch
https://pytorch.org/executorch/
Other
2.13k stars 353 forks source link

Issues with QNN tutorial #2955

Closed kirklandsign closed 7 months ago

kirklandsign commented 7 months ago

Link to tuorial: https://pytorch.org/executorch/main/build-run-qualcomm-ai-engine-direct-backend.html

Repro: git checkout b26eee87949ac08e0e057e9c051ab72f58e95f6e Apr 9

Need to add -DEXECUTORCH_BUILD_SDK=ON \:

cmake .. \
    -DBUCK2=buck2 \
    -DCMAKE_INSTALL_PREFIX=$PWD \
    -DEXECUTORCH_BUILD_SDK=ON \
    -DEXECUTORCH_BUILD_QNN=ON \
    -DQNN_SDK_ROOT=$QNN_SDK_ROOT \
    -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
    -DANDROID_ABI='arm64-v8a' \
    -DANDROID_NATIVE_API_LEVEL=23 \
    -B$PWD
cd $EXECUTORCH_ROOT
python -m examples.qualcomm.scripts.deeplab_v3 -b build_android -m SM8550 --compile_only --download

FileNotFoundError: [Errno 2] No such file or directory: '/home/hsz/e3/executorch/exir/_serialize/program.fbs'

You can copy from schema/program.fbs + scalar_type.fbs to exir/_serialize/for now.

[WARNING] [Qnn ExecuTorch]: Function not called, PrepareLib isn't loaded!

[INFO] [Qnn ExecuTorch]: Initialize Qnn backend parameters for Qnn executorch backend type 2 [INFO] [Qnn ExecuTorch]: Caching: Caching is in RESTORE MODE. [WARNING] [Qnn ExecuTorch]: sg_stubPtr is not null, skip loadRemoteSymbols

[WARNING] [Qnn ExecuTorch]: sg_stubPtr is not null, skip loadRemoteSymbols

[WARNING] [Qnn ExecuTorch]: Function not called, PrepareLib isn't loaded!

[WARNING] [Qnn ExecuTorch]: sg_stubPtr is not null, skip loadRemoteSymbols

[WARNING] [Qnn ExecuTorch]: Function not called, PrepareLib isn't loaded!

[INFO] [Qnn ExecuTorch]: Running level=3 optimization. I 00:00:00.179013 executorch:qnn_executor_runner.cpp:212] Method loaded. E 00:00:00.232743 executorch:method.cpp:939] Overriding output data pointer allocated by memory plan is not allowed. E 00:00:00.232777 executorch:qnn_executor_runner.cpp:261] ignoring error from set_output_data_ptr(): 0x2 E 00:00:00.267126 executorch:method.cpp:939] Overriding output data pointer allocated by memory plan is not allowed. E 00:00:00.267143 executorch:qnn_executor_runner.cpp:261] ignoring error from set_output_data_ptr(): 0x2 I 00:00:00.267147 executorch:qnn_executor_runner.cpp:264] Inputs prepared. [WARNING] [Qnn ExecuTorch]: sg_stubPtr is not null, skip loadRemoteSymbols

I 00:00:00.277254 executorch:qnn_executor_runner.cpp:413] Model executed successfully. [INFO] [Qnn ExecuTorch]: Destroy Qnn backend parameters [INFO] [Qnn ExecuTorch]: Destroy Qnn context [WARNING] [Qnn ExecuTorch]: sg_stubPtr is not null, skip loadRemoteSymbols

[INFO] [Qnn ExecuTorch]: Destroy Qnn device [WARNING] [Qnn ExecuTorch]: sg_stubPtr is not null, skip loadRemoteSymbols

[INFO] [Qnn ExecuTorch]: Destroy Qnn backend [WARNING] [Qnn ExecuTorch]: qnnOpPackageManager: hexagon unload op package function pointer is nullptr!

[WARNING] [Qnn ExecuTorch]: Function not called, PrepareLib isn't loaded!


Also glitches with etdump:

F 00:00:00.189293 executorch:etdump_flatcc.cpp:170] In function check_ready_to_add_events(), assert failed ((etdump_gen_state == ETDumpGen_Adding_Allocators || etdump_gen_state == ETDumpGen_Block_Created)): ETDumpGen in an invalid state. Cannot add new events now.


Remove etdump part will make it run.

* Other feedback: Use cmake-out for linux, and cmake-android-out for android? It's already in gitignore.
kirklandsign commented 7 months ago

cc @cccclai