Skip to content

Commit 15b4538

Browse files
authored
ggml-alloc : add 10% margin to the buffer sizes (#5149)
1 parent 7032f4f commit 15b4538

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ggml-alloc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,9 @@ bool ggml_tallocr_is_measure(ggml_tallocr_t alloc) {
335335
}
336336

337337
size_t ggml_tallocr_max_size(ggml_tallocr_t alloc) {
338-
return alloc->max_size;
338+
// FIXME: changes in the tensor sizes compared to the measure graph may cause allocations to fail
339+
// to avoid this, we add a 10% margin to the buffer size
340+
return alloc->max_size + alloc->max_size/10;
339341
}
340342

341343
// graph allocator

0 commit comments

Comments
 (0)