]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
ggml-alloc : fix assert in debug builds (#3555)
authorslaren <redacted>
Mon, 9 Oct 2023 12:44:58 +0000 (14:44 +0200)
committerGitHub <redacted>
Mon, 9 Oct 2023 12:44:58 +0000 (15:44 +0300)
ggml-alloc.c

index 3321f05e2ef943bb8b45cb334d287c752eccfff8..34eba3f830e8496a7d9bc77edb3b0ddc2bd93017 100644 (file)
@@ -386,7 +386,7 @@ static void init_view(struct ggml_allocr * alloc, struct ggml_tensor * view) {
 
     // FIXME: the view should be initialized by the owning buffer, but currently this breaks the CUDA backend
     // due to the ggml_tensor_extra_gpu ring buffer overwriting the KV cache extras
-    assert(ggml_allocr_is_measure(alloc) || view->buffer->backend == alloc->buffer->backend);
+    assert(ggml_allocr_is_measure(alloc) || !view->buffer || view->buffer->backend == alloc->buffer->backend);
     ggml_backend_buffer_init_tensor(alloc->buffer, view);
 }