File tree Expand file tree Collapse file tree 3 files changed +6
-0
lines changed Expand file tree Collapse file tree 3 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -224,6 +224,7 @@ extern "C" {
224224    // = ggml_backend_dev_init(ggml_backend_dev_by_type(GPU) OR ggml_backend_dev_by_type(CPU), NULL) 
225225    GGML_API  ggml_backend_t  ggml_backend_init_best (void );
226226
227+     GGML_API  void   ggml_backend_set_size (ggml_backend_buffer_t  buffer , size_t  cur_size );
227228    // Load a backend from a dynamic library and register it 
228229    GGML_API  ggml_backend_reg_t  ggml_backend_load (const  char  *  path );
229230    // Unload a backend if loaded dynamically and unregister it 
Original file line number Diff line number Diff line change @@ -536,6 +536,10 @@ struct ggml_backend_multi_buffer_context {
536536    size_t  n_buffers;
537537};
538538
539+ void  ggml_backend_set_size (ggml_backend_buffer_t  buffer, size_t  cur_size){
540+     buffer->size  = cur_size;
541+ }
542+ 
539543static  void  ggml_backend_multi_buffer_free_buffer (ggml_backend_buffer_t  buffer) {
540544    ggml_backend_multi_buffer_context * ctx = (ggml_backend_multi_buffer_context *) buffer->context ;
541545    for  (size_t  i = 0 ; i < ctx->n_buffers ; i++) {
Original file line number Diff line number Diff line change @@ -1548,6 +1548,7 @@ int32_t llama_context::output_reserve(int32_t n_outputs) {
15481548    std::fill (output_ids.begin (), output_ids.end (), -1 );
15491549
15501550    ggml_backend_buffer_clear (buf_output.get (), 0 );
1551+     ggml_backend_set_size (buf_output.get (), new_size);
15511552
15521553    this ->n_outputs      = 0 ;
15531554    this ->n_outputs_max  = n_outputs_max;
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments