Skip to content

Commit 7e94e99

Browse files
author
zhouwg
committed
ggml-hexagon: release v1.06 and ready for code review
1 parent eb29c0a commit 7e94e99

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

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

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ static struct hexagon_appcfg_t g_hexagon_appcfg = {
383383
#elif defined(_WIN32)
384384
.qnn_runtimelib_path = "C:\\",
385385
#endif
386-
.ggml_hexagon_version = {"1.05"},
387-
.ggml_dsp_version = {"0.62"},
386+
.ggml_hexagon_version = {"1.06"},
387+
.ggml_dsp_version = {"0.63"},
388388
};
389389

390390
//file:///opt/qcom/aistack/qairt/2.31.0.250130/docs/QNN/general/overview.html#tbl-supported-snapdragon-devices
@@ -1417,6 +1417,13 @@ class hexagon_appcfg {
14171417
section = cur_section;
14181418
trim(key);
14191419
trim(value);
1420+
1421+
//"1.00" -> 1.00
1422+
if (value.front() == '"' && value.back() == '"') {
1423+
value.erase(0, 1); // erase the first character "
1424+
value.erase(value.size() - 1); // erase the last character "
1425+
}
1426+
14201427
return true;
14211428
}
14221429

@@ -1829,8 +1836,10 @@ static void ggmlhexagon_load_cfg() {
18291836
GGMLHEXAGON_LOG_INFO("%s", tmposs.str().c_str());
18301837
});
18311838
std::string precision_mode;
1832-
std::string ggml_hexagon_version;
1833-
hexagoncfg_instance.get_stringvalue("general", "version", ggml_hexagon_version, "1.00");
1839+
std::string version; //version of ggml-hexagon.cpp
1840+
std::string ggmldsp_version; //version of ggml-dsp.c
1841+
hexagoncfg_instance.get_stringvalue("general", "version", version, "1.00");
1842+
hexagoncfg_instance.get_stringvalue("general", "ggmldsp_version", ggmldsp_version, "0.62");
18341843
hexagoncfg_instance.get_intvalue("general", "enable_perf", g_hexagon_appcfg.enable_perf, 1);
18351844
hexagoncfg_instance.get_intvalue("general", "print_tensors_info", g_hexagon_appcfg.print_tensors_info, 0);
18361845
hexagoncfg_instance.get_intvalue("general", "dump_op_info", g_hexagon_appcfg.dump_op_info, 0);
@@ -1854,7 +1863,9 @@ static void ggmlhexagon_load_cfg() {
18541863

18551864
GGMLHEXAGON_LOG_INFO("internal ggml_hexagon_version=%s", g_hexagon_appcfg.ggml_hexagon_version);
18561865
GGMLHEXAGON_LOG_INFO("internal ggml_dsp_version=%s", g_hexagon_appcfg.ggml_dsp_version);
1857-
GGMLHEXAGON_LOG_INFO("external ggml_hexagon_version=%s", ggml_hexagon_version.c_str());
1866+
GGMLHEXAGON_LOG_INFO("external ggml_hexagon_version=%s", version.c_str());
1867+
GGMLHEXAGON_LOG_INFO("external ggml_dsp_version=%s", ggmldsp_version.c_str());
1868+
memcpy(g_hexagon_appcfg.ggml_dsp_version, ggmldsp_version.c_str(), strlen(ggmldsp_version.c_str()));
18581869
GGMLHEXAGON_LOG_INFO("hwaccel_approach=%d(%s)", g_hexagon_appcfg.hwaccel_approach,
18591870
ggmlhexagon_get_hwaccel_approach_name(g_hexagon_appcfg.hwaccel_approach));
18601871
GGMLHEXAGON_LOG_INFO("hexagon_backend=%d(%s)", g_hexagon_appcfg.hexagon_backend,
@@ -5445,6 +5456,7 @@ static void ggmlhexagon_compute(ggml_backend_hexagon_context * ctx, struct ggml_
54455456
// between ARM-AP and cDSP. the mechanism in qidl/FastRPC is exactly similar to mechanism in TEE.
54465457
// try to find a better/efficient approach to exchange necessary data between ARM-AP side and cDSP side.
54475458
// manually modifying the important data structure ggml_tensor in ggml.h is not make-sense and not acceptable.
5459+
std::chrono::high_resolution_clock::time_point start_time = std::chrono::high_resolution_clock::now();
54485460
dsptensor_0.data = src0->data;
54495461
dsptensor_0.data_len = ggml_nbytes(src0);
54505462
dsptensor_0.type = src0->type;
@@ -5491,6 +5503,9 @@ static void ggmlhexagon_compute(ggml_backend_hexagon_context * ctx, struct ggml_
54915503
dsptensor_2.nb[3] = dst->nb[3];
54925504

54935505
memcpy(dsptensor_2.op_params, dst->op_params, GGML_MAX_OP_PARAMS / sizeof(int32_t));
5506+
std::chrono::high_resolution_clock::time_point end_time = std::chrono::high_resolution_clock::now();
5507+
std::chrono::duration<size_t, std::nano> duration = end_time - start_time;
5508+
GGMLHEXAGON_LOG_VERBOSE("pack duration %llu ns", duration.count());
54945509

54955510
hexagon_error = op_func(ctx->ggmlop_handle, &dsptensor_0, &dsptensor_1, &dsptensor_2);
54965511
if (AEE_SUCCESS != hexagon_error) {

ggml/src/ggml-hexagon/kernels/ggml-dsp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void ggmlhexagon_dump_tensor_elements(const ggml_tensor * tensor) {
3030
char tmpbuf[GGMLHEXAGON_LOGBUF_LEN];
3131
size_t buflen = 0;
3232
if (tensor->type == GGML_TYPE_F32) {
33-
memset(tmpbuf, 0, GGMLHEXAGON_LOG_LEVEL_DEBUG);
33+
memset(tmpbuf, 0, GGMLHEXAGON_LOGBUF_LEN);
3434
for (int h = 0; h < tensor->ne[3]; h++) {
3535
for (int i = 0; i < tensor->ne[2]; i++) {
3636
for (int j = 0; j < tensor->ne[1]; j++) {

scripts/ggml-hexagon.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
#
2424
[general]
2525
#version of ggml-hexagon.cpp on ARM-AP side
26-
version = "1.05"
26+
version = "1.06"
2727
#version of ggml-dsp.c on cDSP side
28-
ggmldsp_version = "0.62"
28+
ggmldsp_version = "0.63"
2929

3030
#0: HEXAGON_BACKEND_QNNCPU
3131
#1: HEXAGON_BACKEND_QNNGPU

0 commit comments

Comments
 (0)