@@ -198,7 +198,8 @@ int ggmlop_dsp_open(const char*uri, remote_handle64* handle) {
198198    GGMLHEXAGON_LOG_DEBUG ("aheap.heap_base=0x%x, aheap.heap_limit=0x%x" , aheap .heap_base , aheap .heap_limit );
199199    qurt_sysenv_max_hthreads_t  mhwt ;
200200    qurt_sysenv_get_max_hw_threads (& mhwt );
201-     GGMLHEXAGON_LOG_DEBUG ("max hardware threads=%d" , mhwt .max_hthreads );
201+     GGMLHEXAGON_LOG_DEBUG ("max hardware threads counts=%d" , mhwt .max_hthreads );
202+     g_thread_counts  =  mhwt .max_hthreads ;
202203
203204    return  0 ;
204205}
@@ -211,13 +212,18 @@ int ggmlop_dsp_close(remote_handle64 handle) {
211212}
212213
213214AEEResult  ggmlop_dsp_setclocks (remote_handle64  handle , int32  power_level , int32  latency , int32  dcvs_enabled , int32  thread_counts ) {
214-     GGMLHEXAGON_LOG_DEBUG ("enter %s" , __func__   );
215+     GGMLHEXAGON_LOG_DEBUG ("enter %s" , __func__ );
215216    HAP_power_request_t  request ;
216217    memset (& request , 0 , sizeof (HAP_power_request_t ));
217218    request .type  =  HAP_power_set_apptype ;
218219    request .apptype  =  HAP_POWER_COMPUTE_CLIENT_CLASS ;
219220
220-     g_thread_counts  =  thread_counts ;
221+     GGMLHEXAGON_LOG_DEBUG ("user specified thread_counts %d" , thread_counts );
222+     if  (thread_counts  >  1 )
223+         g_thread_counts  =  (thread_counts  >  g_thread_counts ) ? g_thread_counts  : thread_counts ;
224+     else 
225+         g_thread_counts  =  1 ;
226+     GGMLHEXAGON_LOG_DEBUG ("real thread_counts %d" , g_thread_counts );
221227
222228    void  *  ggmop_ctx  =  (void * )(handle );
223229    int  retval  =  HAP_power_set (ggmop_ctx , & request );
0 commit comments