From 866b67ca932459cd5892a95dfcd896431540f9b6 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Mon, 12 Feb 2024 09:27:57 +0200 Subject: [PATCH] ggml-backend : sync remnant --- ggml-backend.c | 5 ++++- ggml-metal.h | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ggml-backend.c b/ggml-backend.c index c0d89d31..9ee81b76 100644 --- a/ggml-backend.c +++ b/ggml-backend.c @@ -475,7 +475,7 @@ ggml_backend_buffer_t ggml_backend_reg_alloc_buffer(size_t i, size_t size) { // backend CPU -static const size_t TENSOR_ALIGNMENT = 64; // should be enough for AVX 512 +static const size_t TENSOR_ALIGNMENT = 32; // required for mmap as gguf only guarantees 32-byte alignment GGML_CALL static const char * ggml_backend_cpu_buffer_name(ggml_backend_buffer_t buffer) { return "CPU"; @@ -818,6 +818,7 @@ void ggml_backend_cpu_set_abort_callback(ggml_backend_t backend_cpu, ggml_abort_ } GGML_CALL ggml_backend_buffer_t ggml_backend_cpu_buffer_from_ptr(void * ptr, size_t size) { + GGML_ASSERT((uintptr_t)ptr % TENSOR_ALIGNMENT == 0 && "buffer pointer must be aligned"); return ggml_backend_buffer_init(ggml_backend_cpu_buffer_type(), cpu_backend_buffer_i_from_ptr, ptr, size); } @@ -1411,6 +1412,8 @@ static bool ggml_backend_sched_alloc_splits(ggml_backend_sched_t sched) { return false; } } + + return true; } static bool ggml_backend_sched_compute_splits(ggml_backend_sched_t sched) { diff --git a/ggml-metal.h b/ggml-metal.h index e8ceb1bd..a5c54218 100644 --- a/ggml-metal.h +++ b/ggml-metal.h @@ -27,7 +27,6 @@ // max memory buffers that can be mapped to the device #define GGML_METAL_MAX_BUFFERS 64 -#define GGML_METAL_MAX_COMMAND_BUFFERS 32 struct ggml_tensor; struct ggml_cgraph;