Skip to content

Commit 5b7c5b4

Browse files
author
zhouwg
committed
ggml-hexagon: fix a minior issue in dev ops
1 parent 46b985b commit 5b7c5b4

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

ggml/src/ggml-hexagon/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,16 @@ function(ggml_hexagon_build_kernel KNAME)
115115
)
116116
endfunction()
117117

118+
function(ggml_hexagon_setup_cfg KNAME)
119+
message(STATUS "ggml_hexagon: setup runtime configuration file ${KNAME}")
120+
add_custom_command(
121+
TARGET ${PROJECT_NAME}
122+
POST_BUILD
123+
COMMAND echo "current working path:`pwd`\n"
124+
COMMAND /bin/cp -fv ../../../../../scripts/${KNAME} ../../../bin/
125+
COMMENT "setup runtime configuration file"
126+
)
127+
endfunction()
128+
118129
ggml_hexagon_build_kernel("cdsp")
130+
ggml_hexagon_setup_cfg("ggml-hexagon.cfg")

ggml/src/ggml-hexagon/ggml-hexagon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1830,7 +1830,7 @@ static void ggmlhexagon_load_cfg() {
18301830
});
18311831
std::string precision_mode;
18321832
std::string ggml_hexagon_version;
1833-
hexagoncfg_instance.get_stringvalue("general", "ggml_hexagon_version", ggml_hexagon_version, "1.03");
1833+
hexagoncfg_instance.get_stringvalue("general", "version", ggml_hexagon_version, "1.00");
18341834
hexagoncfg_instance.get_intvalue("general", "enable_perf", g_hexagon_appcfg.enable_perf, 1);
18351835
hexagoncfg_instance.get_intvalue("general", "print_tensors_info", g_hexagon_appcfg.print_tensors_info, 0);
18361836
hexagoncfg_instance.get_intvalue("general", "dump_op_info", g_hexagon_appcfg.dump_op_info, 0);

scripts/build-run-android.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ PWD=`pwd`
1212
REMOTE_PATH=/data/local/tmp/
1313
#LLM model file on Android phone
1414
GGUF_MODEL_NAME=/sdcard/gemma-3-4b-it-Q8_0.gguf
15+
#https://huggingface.co/Qwen/Qwen1.5-1.8B-Chat-GGUF/blob/main/qwen1_5-1_8b-chat-q4_0.gguf
1516
GGUF_MODEL_NAME=/sdcard/qwen1_5-1_8b-chat-q4_0.gguf
1617

1718
#Android NDK can be found at:
@@ -241,6 +242,10 @@ function prepare_run_on_phone()
241242
adb push ./out/android/bin/*.so ${REMOTE_PATH}/
242243
fi
243244
adb push ./out/android/bin/${program} ${REMOTE_PATH}/
245+
#for non developers: deploy dev ops once time with build outputs in ./out/android/bin/
246+
#adb push ./out/android/bin/ggml-hexagon.cfg ${REMOTE_PATH}/
247+
#for developers: modify ./scritps/ggml-hexagon.cfg before run
248+
adb push ./scripts/ggml-hexagon.cfg ${REMOTE_PATH}/
244249
adb shell chmod +x ${REMOTE_PATH}/${program}
245250
}
246251

scripts/ggml-hexagon.cfg

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@ hwaccel_approach = 2
4040
#attention:
4141
# a. HWACCEL_QNN_SINGLEGRAPH not supported at the moment;
4242
# b. following combinations are valid:
43-
# 1: hwaccel_approach = 2 AND hexagon_backend = 2(this is the default setting)
44-
# 2: hwaccel_approach = 0 AND hexagon_backend = 2(QNNNPU)
43+
# 1: hwaccel_approach = 2 AND hexagon_backend = 2(HWACCEL_CDSP, this is the default setting)
44+
# 2: hwaccel_approach = 0 AND hexagon_backend = 2(HWACCEL_QNN, QNNNPU)
4545
# 3: hwaccel_approach = 0 AND hexagon_backend = 1(QNNGPU)
4646
# 4: hwaccel_approach = 0 AND hexagon_backend = 0(QNNCPU)
47-
# 5: hwaccel_approach = 2 AND hexagon_backend = 3
48-
# 6: hwaccel_approach = 0 AND hexagon_backend = 3
47+
# 5: hwaccel_approach = 2 AND hexagon_backend = 3(fall back to the default ggml backend)
48+
# 6: hwaccel_approach = 0 AND hexagon_backend = 3(fall back to the default ggml backend)
4949
#
50-
#generally speaking, we only need to focus on b-1 and b-2 in this PR.
50+
#generally speaking,
51+
# a. we only need to focus on b-1 and b-2 in this PR.
52+
# b. we can compare Hexagon NPU performance between HWACCEL_CDSP/HWACCEL_QNN(QNNNPU)/the default ggml backend accordingly
5153

5254

5355
#enable/disable offload quantized type mulmat

0 commit comments

Comments
 (0)