From 89b1915de346822d0ff33db705d28a03f3c5dfe4 Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Tue, 13 Feb 2024 13:41:33 -0500 Subject: [PATCH] Early return for zero size calls to get_tensor. Signed-off-by: Adam Treat --- ggml-kompute.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ggml-kompute.cpp b/ggml-kompute.cpp index 51c5af8ec..8981ea384 100644 --- a/ggml-kompute.cpp +++ b/ggml-kompute.cpp @@ -1805,6 +1805,9 @@ static void * ggml_backend_kompute_buffer_get_base(ggml_backend_buffer_t buffer) static void ggml_backend_kompute_buffer_set_tensor(ggml_backend_buffer_t buffer, ggml_tensor * tensor, const void * data, size_t offset, size_t size) { GGML_UNUSED(buffer); + if (!size) + return; + const auto res = ggml_vk_get_tensor(tensor); GGML_ASSERT(res); @@ -1816,6 +1819,9 @@ static void ggml_backend_kompute_buffer_set_tensor(ggml_backend_buffer_t buffer, static void ggml_backend_kompute_buffer_get_tensor(ggml_backend_buffer_t buffer, const ggml_tensor * tensor, void * data, size_t offset, size_t size) { GGML_UNUSED(buffer); + if (!size) + return; + const auto res = ggml_vk_get_tensor(tensor); GGML_ASSERT(res);