From 3864be3e5d67fe979b6cbbfd64f18c75250da488 Mon Sep 17 00:00:00 2001 From: Kevin Pouget Date: Thu, 29 Jan 2026 09:25:09 +0100 Subject: [PATCH] ggml-virtgpu: backend: don't continue if couldn't allocate the tensor memory --- ggml/src/ggml-virtgpu/backend/shared/apir_cs_ggml.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ggml/src/ggml-virtgpu/backend/shared/apir_cs_ggml.h b/ggml/src/ggml-virtgpu/backend/shared/apir_cs_ggml.h index 28f7f270ef..207b930d24 100644 --- a/ggml/src/ggml-virtgpu/backend/shared/apir_cs_ggml.h +++ b/ggml/src/ggml-virtgpu/backend/shared/apir_cs_ggml.h @@ -39,11 +39,17 @@ static inline void apir_encode_ggml_tensor(apir_encoder * enc, const ggml_tensor static inline const ggml_tensor * apir_decode_ggml_tensor(apir_decoder * dec) { const apir_rpc_tensor * apir_rpc_tensor = apir_decode_apir_rpc_tensor_inplace(dec); + + if (!apir_rpc_tensor) { + return NULL; + } + ggml_init_params params{ /*.mem_size =*/ ggml_tensor_overhead(), /*.mem_buffer =*/ NULL, /*.no_alloc =*/ true, }; + ggml_context * ctx = ggml_init(params); const ggml_tensor * tensor = apir_deserialize_tensor(ctx, apir_rpc_tensor);