@@ -832,6 +832,7 @@ static void ggmlhexagon_get_timestring(char * p_currenttime) {
832832 memset (buf, 0 , GGMLHEXAGON_TMPBUF_LEN);
833833 snprintf (buf, sizeof (buf), " %04d-%02d-%02d,%02d:%02d:%02d" ,
834834 tm.tm_year + 1900 , tm.tm_mon + 1 , tm.tm_mday , tm.tm_hour , tm.tm_min , tm.tm_sec );
835+ GGML_UNUSED (ms);
835836 return buf;
836837 };
837838
@@ -2937,8 +2938,6 @@ void * qnn_instance::get_rpcmem_from_memhandle(Qnn_MemHandle_t mem_handle) {
29372938}
29382939
29392940void qnn_instance::unregister_rpcmem () {
2940- Qnn_ErrorHandle_t error = QNN_SUCCESS;
2941-
29422941 if (_qnn_mem_set.empty ()) {
29432942 GGMLHEXAGON_LOG_WARN (" no rpcmem registered\n " );
29442943 }
@@ -6039,6 +6038,7 @@ static void ggml_backend_hexagon_free(ggml_backend_t backend) {
60396038 for (auto & tensor : ptensors) {
60406039 ggmlqnn_free_qnntensor (tensor);
60416040 }
6041+ GGML_UNUSED (graph_handle);
60426042 GGMLHEXAGON_LOG_DEBUG (" graph handle %p" , graph_handle);
60436043 GGMLHEXAGON_LOG_DEBUG (" clean up graph:%s" , graph_name.c_str ());
60446044 }
@@ -6134,13 +6134,18 @@ static void ggml_backend_hexagon_device_get_memory(ggml_backend_dev_t dev, size_
61346134 } else if (HEXAGON_BACKEND_QNNNPU == ctx->device ) {
61356135 size_t rpc_ion_memsize = 0 ;
61366136 size_t rpc_ion_usage = 0 ;
6137- if (HWACCEL_CDSP != g_hexagon_appcfg.hwaccel_approach ) {
6138- rpc_ion_memsize = ctx->instance ->get_rpcmem_capacity ();
6139- rpc_ion_usage = ctx->instance ->get_rpcmem_usage ();
6140- } else {
6141- rpc_ion_memsize = ctx->rpc_mempool_capacity ;
6142- rpc_ion_usage = ctx->rpc_mempool_usage ;
6143- }
6137+ GGML_ASSERT (nullptr != ctx->instance );
6138+ rpc_ion_memsize = ctx->instance ->get_rpcmem_capacity ();
6139+ rpc_ion_usage = ctx->instance ->get_rpcmem_usage ();
6140+ *total = rpc_ion_memsize;
6141+ *free = (rpc_ion_memsize - rpc_ion_usage);
6142+ GGMLHEXAGON_LOG_DEBUG (" rpc memsize %d MiB" , rpc_ion_memsize / SIZE_IN_MB);
6143+ GGMLHEXAGON_LOG_DEBUG (" rpc usage %d MiB\n\n " , rpc_ion_usage / SIZE_IN_MB);
6144+ } else if (HEXAGON_BACKEND_CDSP == ctx->device ) {
6145+ size_t rpc_ion_memsize = 0 ;
6146+ size_t rpc_ion_usage = 0 ;
6147+ rpc_ion_memsize = ctx->rpc_mempool_capacity ;
6148+ rpc_ion_usage = ctx->rpc_mempool_usage ;
61446149 *total = rpc_ion_memsize;
61456150 *free = (rpc_ion_memsize - rpc_ion_usage);
61466151 GGMLHEXAGON_LOG_DEBUG (" rpc memsize %d MiB" , rpc_ion_memsize / SIZE_IN_MB);
0 commit comments