@@ -330,7 +330,7 @@ struct hexagon_appcfg_t {
330330 int hwaccel_approach; // 0: HWACCEL_QNN 1: HWACCEL_QNN_SINGLEGRAPH 2: HWACCEL_CDSP
331331 int hexagon_backend; // 0: HEXAGON_BACKEND_QNNCPU 1: HEXAGON_BACKEND_QNNGPU 2: HEXAGON_BACKEND_QNNNPU / HEXAGON_BACKEND_CDSP
332332 int enable_mulmat_cdsp; // enable/disable offload mulmat to cDSP
333- int enable_q_mulmat; // enable/disable offload fp32 & all quantized type mulmat to cDSP
333+ int enable_q_mulmat; // enable/disable offload fp32 & quantized mulmat to cDSP
334334 const char * cfgfilename;
335335 const char * runtimelib_path;
336336};
@@ -1395,6 +1395,7 @@ static void * ggmlhexagon_type_trait(ggml_backend_hexagon_context * ctx, ggml_te
13951395}
13961396
13971397static void ggmlhexagon_set_runtime_path (size_t device, const std::string & path) {
1398+ #if defined(__ANDROID__)
13981399 if ((HEXAGON_BACKEND_QNNNPU == device) || (HWACCEL_CDSP == g_hexagon_appcfg.hwaccel_approach )) {
13991400 if (0 == setenv (" LD_LIBRARY_PATH" ,
14001401 (path +
@@ -1424,6 +1425,7 @@ static void ggmlhexagon_set_runtime_path(size_t device, const std::string & path
14241425 ggml_backend_hexagon_get_devname (device));
14251426 }
14261427 }
1428+ #endif
14271429}
14281430
14291431static void ggmlhexagon_load_cfg () {
@@ -4874,7 +4876,8 @@ static int ggmlhexagon_init_dsp(ggml_backend_hexagon_context * ctx) {
48744876 }
48754877
48764878 return 0 ;
4877- bail:
4879+
4880+ bail:
48784881 if (ggmlop_domain_uri) {
48794882 free (ggmlop_domain_uri);
48804883 }
@@ -5344,7 +5347,7 @@ static ggml_backend_buffer_i ggml_backend_hexagon_buffer_interface = {
53445347
53455348static const char * ggml_backend_hexagon_buffer_type_name (ggml_backend_buffer_type_t buft) {
53465349 GGML_UNUSED (buft);
5347- return " qnn -buffer" ;
5350+ return " hexagon -buffer" ;
53485351}
53495352
53505353static ggml_backend_buffer_t ggml_backend_hexagon_buffer_type_alloc_buffer (
@@ -5399,7 +5402,7 @@ static void ggml_backend_hexagon_free(ggml_backend_t backend) {
53995402 ggml_backend_hexagon_context * ctx = (ggml_backend_hexagon_context *)backend->context ;
54005403
54015404 qnn_instance * instance = (qnn_instance*)g_hexagon_mgr[ctx->device ].instance ;
5402- if (instance != nullptr ) {
5405+ if (nullptr != instance ) {
54035406 std::map<std::string, qnn_singlenode_res_t >::iterator singlenode_graph_it;
54045407 for (singlenode_graph_it = ctx->qnn_singlenode_graph_map .begin ();
54055408 singlenode_graph_it != ctx->qnn_singlenode_graph_map .end (); singlenode_graph_it++) {
@@ -5856,11 +5859,9 @@ ggml_backend_t ggml_backend_hexagon_init(size_t device, const char * qnn_lib_pat
58565859 return nullptr ;
58575860 }
58585861
5859- #if defined(__ANDROID__)
58605862 std::string path = qnn_lib_path;
58615863 GGMLHEXAGON_LOG_DEBUG (" lib_path %s" , path.c_str ());
58625864 ggmlhexagon_set_runtime_path (device, path);
5863- #endif
58645865
58655866 if (nullptr != g_hexagon_mgr[device].backend ) {
58665867 GGMLHEXAGON_LOG_DEBUG (" backend %d(%s) already loaded" , device,
@@ -5893,7 +5894,7 @@ ggml_backend_t ggml_backend_hexagon_init(size_t device, const char * qnn_lib_pat
58935894 ggml_backend_hexagon_free (hexagon_backend);
58945895 return nullptr ;
58955896 }
5896- // ensure test-backend-ops get the correct backend name when inference approach is 1 (HWACCEL_CDSP)
5897+ // ensure test-backend-ops get the correct backend name when hwaccel approach is 2 (HWACCEL_CDSP)
58975898 memcpy (g_hexagon_mgr[device].name , " Hexagon-cDSP" , strlen (" Hexagon-cDSP" ));
58985899 } else {
58995900 // got fully description of SoC when hwaccel approach is HWACCEL_QNN and backend is HEXAGON_BACKEND_QNNNPU
0 commit comments