File tree Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -1402,25 +1402,26 @@ static inline bool ggml_can_repeat_rows(const struct ggml_tensor * t0, const str
14021402//////////////////////////////////////////////////////////////////////////////// 
14031403
14041404struct  ggml_context  *  ggml_init (struct  ggml_init_params  params ) {
1405-     static  volatile  bool  is_first_call  =  false;
1405+     static  bool  is_first_call  =  false;
1406+ 
1407+     ggml_critical_section_start ();
1408+ 
14061409    if  (!is_first_call ) {
1407-         ggml_critical_section_start ();
1408-         if  (!is_first_call ) {
1409-             // initialize time system (required on Windows) 
1410-             ggml_time_init ();
1411- 
1412-             for  (int  i  =  0 ; i  <  (1  << 16 ); ++ i ) {
1413-                 union  {
1414-                     uint16_t  u16 ;
1415-                     ggml_fp16_t  fp16 ;
1416-                 } u  =  {i };
1417-                 ggml_table_f32_f16 [i ] =  GGML_COMPUTE_FP16_TO_FP32 (u .fp16 );
1418-             }
1419-             is_first_call  =  true;
1410+         // initialize time system (required on Windows) 
1411+         ggml_time_init ();
1412+ 
1413+         for  (int  i  =  0 ; i  <  (1  << 16 ); ++ i ) {
1414+             union  {
1415+                 uint16_t  u16 ;
1416+                 ggml_fp16_t  fp16 ;
1417+             } u  =  {i };
1418+             ggml_table_f32_f16 [i ] =  GGML_COMPUTE_FP16_TO_FP32 (u .fp16 );
14201419        }
1421-         ggml_critical_section_end () ;
1420+         is_first_call   =  true ;
14221421    }
14231422
1423+     ggml_critical_section_end ();
1424+ 
14241425    struct  ggml_context  *  ctx  =  GGML_MALLOC (sizeof (struct  ggml_context ));
14251426
14261427    // allow to call ggml_init with 0 size 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments