@@ -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