From 43147788f36cbdc0299d4de5141c49b4747e0dd1 Mon Sep 17 00:00:00 2001 From: sladro Date: Thu, 8 Jan 2026 15:19:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=BA=E8=84=B8=E8=AF=86?= =?UTF-8?q?=E5=88=AB=E9=97=AE=E9=A2=98,=E6=9B=B4=E6=8D=A2facerknn=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ai_scheduler.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ai_scheduler.cpp b/src/ai_scheduler.cpp index bdf0646..300e01f 100644 --- a/src/ai_scheduler.cpp +++ b/src/ai_scheduler.cpp @@ -401,6 +401,17 @@ AiScheduler::BorrowedInferResult AiScheduler::InferBorrowed(ModelHandle handle, return result; } + // DEBUG: 检查输出大小是否超出预分配 buffer + for (uint32_t i = 0; i < ctx->n_output; ++i) { + size_t prealloc_sz = ctx->output_buffers[i].size(); + size_t actual_sz = outputs[i].size; + std::cerr << "[AiScheduler] output[" << i << "] prealloc=" << prealloc_sz + << " actual=" << actual_sz << " type=" << ctx->output_attrs[i].type << "\n"; + if (actual_sz > prealloc_sz && prealloc_sz > 0) { + std::cerr << "[AiScheduler] ERROR: output size exceeds preallocated buffer!\n"; + } + } + result.outputs.resize(ctx->n_output); for (uint32_t i = 0; i < ctx->n_output; ++i) { auto& out = result.outputs[i];