-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: QNN Multi Chunk Execution in New Frontend (#191)
* dev: qnn multi input inference developing * feat: qnn multi chunk prefilling in new frontend refactor: qnn module setup skip in following chunks todo: multi input * fix: clearCache in RoPE * fix: genarate with Padding --------- Co-authored-by: Rongjie Yi <[email protected]> Co-authored-by: yirongjie <[email protected]>
- Loading branch information
1 parent
d279e01
commit 11a2fb2
Showing
41 changed files
with
386 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ cmake .. \ | |
-DQNN_VALIDATE_NODE=ON \ | ||
-DMLLM_BUILD_XNNPACK_BACKEND=OFF | ||
|
||
make -j16 | ||
make -j40 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
!/bin/bash | ||
|
||
adb shell mkdir -p /data/local/tmp/mllm/vocab | ||
adb shell mkdir -p /data/local/tmp/mllm/qnn-lib | ||
|
||
adb push ../vocab/phonelm_vocab.mllm /data/local/tmp/mllm/vocab/ | ||
|
||
|
||
if ! adb shell [ -f "/data/local/tmp/mllm/models/PhoneLM-1.5B-Instruct-128.mllm" ]; then | ||
adb push ../models/PhoneLM-1.5B-Instruct-128.mllm "/data/local/tmp/mllm/models/PhoneLM-1.5B-Instruct-128.mllm" | ||
else | ||
echo "PhoneLM-1.5B-Instruct-128 file already exists" | ||
fi | ||
|
||
|
||
if ! adb shell [ -f "/data/local/tmp/mllm/models//phonelm-1.5b-instruct-q4_0_4_4.mllm" ]; then | ||
adb push ../models//phonelm-1.5b-instruct-q4_0_4_4.mllm "/data/local/tmp/mllm/models//phonelm-1.5b-instruct-q4_0_4_4.mllm" | ||
else | ||
echo "/phonelm-1.5b-instruct-q4_0_4_4.mllm file already exists" | ||
fi | ||
|
||
LIBPATH=../src/backends/qnn/qualcomm_ai_engine_direct_220/ | ||
ANDR_LIB=$LIBPATH/lib/aarch64-android | ||
OP_PATH=../src/backends/qnn/LLaMAOpPackageHtp/LLaMAPackage/build | ||
DEST=/data/local/tmp/mllm/qnn-lib | ||
|
||
adb push $ANDR_LIB/libQnnHtp.so $DEST | ||
adb push $ANDR_LIB/libQnnHtpV75Stub.so $DEST | ||
adb push $ANDR_LIB/libQnnHtpPrepare.so $DEST | ||
adb push $ANDR_LIB/libQnnHtpProfilingReader.so $DEST | ||
adb push $ANDR_LIB/libQnnHtpOptraceProfilingReader.so $DEST | ||
adb push $ANDR_LIB/libQnnHtpV75CalculatorStub.so $DEST | ||
adb push $LIBPATH/lib/hexagon-v75/unsigned/libQnnHtpV75Skel.so $DEST | ||
adb push $OP_PATH/aarch64-android/libQnnLLaMAPackage.so $DEST/libQnnLLaMAPackage_CPU.so | ||
adb push $OP_PATH/hexagon-v75/libQnnLLaMAPackage.so $DEST/libQnnLLaMAPackage_HTP.so | ||
|
||
|
||
if [ $? -ne 0 ]; then | ||
echo "adb push failed" | ||
exit 1 | ||
fi | ||
|
||
adb push ../bin-arm/demo_phonelm_npu /data/local/tmp/mllm/bin/ | ||
adb shell "cd /data/local/tmp/mllm/bin && export LD_LIBRARY_PATH=/data/local/tmp/mllm/qnn-lib && export ADSP_LIBRARY_PATH=/data/local/tmp/mllm/qnn-lib && ./demo_phonelm_npu" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.