129129class qnn_instance ;
130130struct ggml_backend_hexagon_context ;
131131
132+ static void ggmlhexagon_probe_dspinfo (ggml_backend_hexagon_context * ctx);
133+
132134#if 0 //def NDEBUG
133135#define GGMLHEXAGON_DEBUG 0
134136#else
@@ -241,7 +243,7 @@ enum qcom_chipset_soc_model {
241243 SM8475 = 42 , // v69, SD 8+ Gen 1
242244 SM8550 = 43 , // v73, SD 8 Gen 2
243245 SM8650 = 57 , // v75, SD 8 Gen 3
244- SM8750 = 69 , // v79, SD 8 Gen 4
246+ SM8750 = 69 , // v79, SD 8 Elite(aka 8 Gen 4)
245247#if !defined(__ANDROID__) && !defined(__linux__)
246248 SC7280X = 44 ,
247249 SC8280X = 37 ,
@@ -316,6 +318,7 @@ struct hexagon_appcfg_t {
316318 int enable_mulmat_cdsp; // enable/disable offload mulmat to cDSP
317319 int enable_q_mulmat; // enable/disable offload fp32 & quantized mulmat to cDSP
318320 int enable_rpc_ion_mempool; // enable/disable rpc ion memory pool
321+ int enable_rpc_dma_mempool; // enable/disable rpc dma memory pool
319322 const char * cfgfilename;
320323 const char * runtimelib_path;
321324};
@@ -334,6 +337,7 @@ static struct hexagon_appcfg_t g_hexagon_appcfg = {
334337 .enable_mulmat_cdsp = 0 ,
335338 .enable_q_mulmat = 0 ,
336339 .enable_rpc_ion_mempool = 0 ,
340+ .enable_rpc_dma_mempool = 0 ,
337341 .cfgfilename = " ggml-hexagon.cfg" ,
338342#if defined(__ANDROID__)
339343// Android command line program
@@ -394,7 +398,7 @@ static struct qcom_socinfo g_qnn_soc_info_table[] = {
394398 .soc_model = SM8750,
395399 .htp_arch = V79,
396400 .vtcm_size_in_mb = 8 ,
397- .soc_desc = " Qualcomm SnapDragon 8 Gen 4" },
401+ .soc_desc = " Qualcomm SnapDragon 8 Elite(aka 8 Gen 4) " },
398402
399403#if !defined(__ANDROID__) && !defined(__linux__)
400404 /* Qualcomm SnapDragon 7c Gen 2 */
@@ -862,6 +866,8 @@ static void ggmlhexagon_print_running_timestamp(ggml_backend_hexagon_context * c
862866 GGMLHEXAGON_LOG_INFO (" offload GGML_OP_MULMAT: %s" , g_hexagon_appcfg.enable_mulmat_cdsp ? " YES" : " NO" );
863867 GGMLHEXAGON_LOG_INFO (" offload quantize GGML_OP_MUL_MAT: %s" , g_hexagon_appcfg.enable_q_mulmat ? " YES" : " NO" );
864868 GGMLHEXAGON_LOG_INFO (" using rpc ion memory pool: %s" , g_hexagon_appcfg.enable_rpc_ion_mempool ? " YES" : " NO" );
869+ GGMLHEXAGON_LOG_INFO (" using rpc dma memory pool: %s" , g_hexagon_appcfg.enable_rpc_dma_mempool ? " YES" : " NO" );
870+ ggmlhexagon_probe_dspinfo (ctx);
865871 } else {
866872 GGMLHEXAGON_LOG_INFO (" only offload GGML_OP_ADD: NO" );
867873 }
@@ -1450,6 +1456,7 @@ static void ggmlhexagon_load_cfg() {
14501456 qnncfg_instance.get_intvalue (" cdsp" , " enable_mulmat_cdsp" , g_hexagon_appcfg.enable_mulmat_cdsp , 1 );
14511457 qnncfg_instance.get_intvalue (" cdsp" , " enable_q_mulmat" , g_hexagon_appcfg.enable_q_mulmat , 0 );
14521458 qnncfg_instance.get_intvalue (" cdsp" , " enable_rpc_ion_mempool" , g_hexagon_appcfg.enable_rpc_ion_mempool , 1 );
1459+ qnncfg_instance.get_intvalue (" cdsp" , " enable_rpc_dma_mempool" , g_hexagon_appcfg.enable_rpc_dma_mempool , 0 );
14531460 GGMLHEXAGON_LOG_INFO (" hwaccel_approach=%d(%s)" , g_hexagon_appcfg.hwaccel_approach ,
14541461 ggmlhexagon_get_hwaccel_approach_name (g_hexagon_appcfg.hwaccel_approach ));
14551462 GGMLHEXAGON_LOG_INFO (" hexagon_backend=%d(%s)" , g_hexagon_appcfg.hexagon_backend ,
@@ -4814,7 +4821,7 @@ static int ggmlhexagon_init_dsp(ggml_backend_hexagon_context * ctx) {
48144821 return 1 ;
48154822 GGMLHEXAGON_LOG_INFO (" init Hexagon DSP with backend %d(%s)" , ctx->device , ggml_backend_hexagon_get_devname (ctx->device ));
48164823 if (nullptr != ctx->rpc_mempool ) {
4817- GGMLHEXAGON_LOG_INFO (" already init Hexagon DSP with backend %d(%s)" , ctx->device , ggml_backend_hexagon_get_devname (ctx->device ));
4824+ GGMLHEXAGON_LOG_DEBUG (" already init Hexagon DSP with backend %d(%s)" , ctx->device , ggml_backend_hexagon_get_devname (ctx->device ));
48184825 return 0 ;
48194826 }
48204827 ctx->ggmlop_handle = -1 ;
@@ -5480,13 +5487,14 @@ static void ggml_backend_hexagon_free(ggml_backend_t backend) {
54805487 }
54815488
54825489 if (g_hexagon_mgr[ctx->device ].backend != nullptr ) {
5490+ // print timestamp and dsp information before deinit cdsp, useful for troubleshooting
5491+ ggmlhexagon_print_running_timestamp (ctx);
54835492 if (HWACCEL_CDSP == g_hexagon_appcfg.hwaccel_approach ) {
54845493 ggmlhexagon_deinit_cdsp (ctx);
54855494 }
54865495
54875496 delete backend;
54885497 g_hexagon_mgr[ctx->device ].backend = nullptr ;
5489- ggmlhexagon_print_running_timestamp (ctx);
54905498 }
54915499 GGMLHEXAGON_LOG_DEBUG (" leave %s" , __func__ );
54925500}
0 commit comments