Skip to content

Commit

Permalink
PoC-S26: offload simple f32 2x2 matrix addition operation to QNN CPU …
Browse files Browse the repository at this point in the history
…backend --- troubleshooting-2nd
  • Loading branch information
zhouwg committed Apr 4, 2024
1 parent 5a5f7cc commit f807910
Show file tree
Hide file tree
Showing 6 changed files with 925 additions and 98 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ cdeosplayer/kantv/src/main/assets/deepspeech-0.9.3-models.tflite
#generated by source code,so skip it
cdeosplayer/kantv/src/main/jniLibs/arm64-v8a/libopenblas.so

prebuilts/toolchain/android-ndk-r26c-linux.zip
prebuilts/toolchain/android-ndk-r26c/
prebuilts/toolchain/android-ndk*
prebuilts/toolchain/emsdk/
prebuilts/toolchain/*.zip
prebuilts/toolchain/*.xz
Expand Down
4 changes: 3 additions & 1 deletion build/envsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ export ANDROID_PLATFORM=android-34
#export ANDROID_NDK=${KANTV_TOOLCHAIN_PATH}/android-ndk-r18b
#export ANDROID_NDK=${KANTV_TOOLCHAIN_PATH}/android-ndk-r21e
#export ANDROID_NDK=${KANTV_TOOLCHAIN_PATH}/android-ndk-r24
#export ANDROID_NDK=${KANTV_TOOLCHAIN_PATH}/android-ndk-r25c
export ANDROID_NDK=${KANTV_TOOLCHAIN_PATH}/android-ndk-r26c
export ANDROID_NDK_ROOT=${ANDROID_NDK}
export ANDROID_NDK_ROOT=${ANDROID_NDK} # make some open source project happy
export NDK_ROOT=${ANDROID_NDK} # make some open source project happy
export PATH=${ANDROID_NDK_ROOT}:${PATH}


Expand Down
7 changes: 6 additions & 1 deletion build/prebuild-download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ fi

if [ ${is_android_ndk_exist} -eq 0 ]; then
echo -e "begin downloading android ndk \n"
wget --no-config --quiet --show-progress -O ${ANDROID_NDK}-linux.zip https://dl.google.com/android/repository/android-ndk-r26c-linux.zip
wget --no-config --quiet --show-progress -O ${PROJECT_ROOT_PATH}/prebuilts/toolchain/android-ndk-r25c-linux.zip https://dl.google.com/android/repository/android-ndk-r25c-linux.zip
wget --no-config --quiet --show-progress -O ${PROJECT_ROOT_PATH}/prebuilts/toolchain/android-ndk-r26c-linux.zip https://dl.google.com/android/repository/android-ndk-r26c-linux.zip

cd ${PROJECT_ROOT_PATH}/prebuilts/toolchain

unzip android-ndk-r25c-linux.zip
unzip android-ndk-r26c-linux.zip

cd ${PROJECT_ROOT_PATH}

if [ $? -ne 0 ]; then
Expand Down
8 changes: 2 additions & 6 deletions external/ggml/jni/Inception_v3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20631,7 +20631,7 @@ static ModelError_t addNode_InceptionV3_Predictions_Softmax(qnn_implementation&
}


int qnn_composeGraphs(GraphInfoPtr_t** graphsInfo,uint32_t* numGraphsInfo)
int ggml_qqn_debug_composegraphs(GraphInfoPtr_t ** graphsInfo,uint32_t * numGraphsInfo)
{

LOGGI("enter %s\n", __func__);
Expand All @@ -20640,9 +20640,6 @@ int qnn_composeGraphs(GraphInfoPtr_t** graphsInfo,uint32_t* numGraphsInfo)


/* model/graph for Inception_v3*/



VALIDATE(addTensor_input_0(Inception_v3), err);
//VALIDATE(addTensor_InceptionV3_Conv2d_1a_3x3_weights_read_0(Inception_v3), err);
//VALIDATE(addTensor_InceptionV3_InceptionV3_Conv2d_1a_3x3_convolution_bias(Inception_v3), err);
Expand Down Expand Up @@ -21055,8 +21052,7 @@ int qnn_composeGraphs(GraphInfoPtr_t** graphsInfo,uint32_t* numGraphsInfo)

uint32_t numModels = 1;
// Populate the constructed graphs in provided output variables
qnn_backend.get_graphinfo_from_model(graphsInfo, numGraphsInfo);
//VALIDATE(getGraphInfoFromModels(*models, numModels, graphsInfo), err);
//qnn_backend.get_graphinfo_from_model(graphsInfo, numGraphsInfo);
*numGraphsInfo = numModels;

LOGGI("leave %s\n", __func__);
Expand Down
Loading

0 comments on commit f807910

Please sign in to comment.