Răsfoiți Sursa

ggml-alloc : add 10% margin to the buffer sizes (#5149)

slaren 2 ani în urmă
părinte
comite
15b4538ff2
1 a modificat fișierele cu 3 adăugiri și 1 ștergeri
  1. 3 1
      ggml-alloc.c

+ 3 - 1
ggml-alloc.c

@@ -335,7 +335,9 @@ bool ggml_tallocr_is_measure(ggml_tallocr_t alloc) {
 }
 
 size_t ggml_tallocr_max_size(ggml_tallocr_t alloc) {
-    return alloc->max_size;
+    // FIXME: changes in the tensor sizes compared to the measure graph may cause allocations to fail
+    // to avoid this, we add a 10% margin to the buffer size
+    return alloc->max_size + alloc->max_size/10;
 }
 
 // graph allocator