bug fix, probably solves the 'ggml_allocr_alloc: not enough space in the buffer' issue

This commit is contained in:
xaedes 2023-09-02 20:53:14 +02:00
parent ded6382961
commit 8d982c8fd9
No known key found for this signature in database
GPG key ID: 30030EDD817EA2B1

View file

@ -181,7 +181,7 @@ void ggml_allocr_alloc(struct ggml_allocr * alloc, struct ggml_tensor * tensor)
static void ggml_allocator_free_tensor(struct ggml_allocr * alloc, struct ggml_tensor * tensor) { static void ggml_allocator_free_tensor(struct ggml_allocr * alloc, struct ggml_tensor * tensor) {
void * ptr = tensor->data; void * ptr = tensor->data;
if (ptr < alloc->data || (char*)ptr >= (char*)alloc->data + alloc->max_size) { if (ptr < alloc->data || (char*)ptr >= (char*)alloc->data + alloc->size) {
// the tensor was not allocated in this buffer // the tensor was not allocated in this buffer
// this can happen because the graph allocator will try to free weights and other tensors from different buffers // this can happen because the graph allocator will try to free weights and other tensors from different buffers
// the easiest way to deal with this is just to ignore it // the easiest way to deal with this is just to ignore it