File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -718,21 +718,26 @@ static void ggml_tsavorite_free(struct ggml_backend_tsavorite_context *ctx) {
718718  //  delay to allow any file operations to complete for runtime
719719
720720  GGML_TSAVORITE_LOG_INFO (" Delaying tsi_finalize for 2 sec" 
721-   sleep (2 );
722-   tsi_finalize ();
723-   GGML_TSAVORITE_LOG_INFO (" End %s\n " 
724-   tsirt::utils::TSIProfiler::finalize ();
721+   if  (runtime_initialized == true ) {
722+       sleep (2 );
723+       runtime_initialized = false ;
724+       tsi_finalize ();
725+       tsirt::utils::TSIProfiler::finalize ();
726+       sleep (2 );
727+   }
725728  std::cout << " \n OPU Profiling Results:" 
726729  std::cout << tsirt::utils::TSIProfiler::getFormattedResults (
727730                   /* truncateFuncNames*/ true )
728731            << std::endl;
729-   sleep (2 );
732+   GGML_TSAVORITE_LOG_INFO (" End %s\n " 
733+   return ;
730734}
731735
732736void 
733737tsi_cleanup () {
734738    if  (runtime_initialized != true )
735739        return ;
740+     runtime_initialized = false ;
736741    tsi_finalize ();
737742    GGML_TSAVORITE_LOG_INFO (" Start %s\n " 
738743    tsirt::utils::TSIProfiler::finalize ();
Original file line number Diff line number Diff line change @@ -1013,6 +1013,7 @@ int main(int argc, char ** argv) {
10131013    common_perf_print (ctx, smpl);
10141014
10151015    common_sampler_free (smpl);
1016+     ggml_backend_cleanup ();
10161017
10171018    llama_backend_free ();
10181019
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments