From 19bbf94dcc595fec50c62fc771dfe930a722d142 Mon Sep 17 00:00:00 2001 From: RaduAdumitroaei Date: Sun, 12 Jul 2026 15:23:47 +0200 Subject: [PATCH] pipeline-codec: reset sched before encode alloc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The codec encode path allocated its graph without first resetting the shared scheduler, unlike every sibling path (decode, prompt-builder, speaker_encoder_extract). After a synthesis call leaves the codec sched allocated, the next RVQ encode — e.g. registering a second cloned voice after a generation — trips GGML_ASSERT(!sched->is_alloc) in ggml_backend_sched_alloc_graph and crashes the server. Reset the sched before alloc to match the other call sites. Repro: register a voice (base model) -> generate speech -> register another voice. Second register crashes without this fix. --- src/pipeline-codec.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pipeline-codec.cpp b/src/pipeline-codec.cpp index 3b5af7d..4aff2c4 100644 --- a/src/pipeline-codec.cpp +++ b/src/pipeline-codec.cpp @@ -691,6 +691,10 @@ std::vector pipeline_codec_encode(PipelineCodec * pc, ggml_build_forward_expand(graph, sn_stage3_dump); } + // Reset before alloc: a prior decode/synthesis may have left the shared + // codec sched allocated, which trips GGML_ASSERT(!sched->is_alloc). Mirrors + // the decode path (top of this file) and speaker_encoder_extract. + ggml_backend_sched_reset(pc->sched); if (!ggml_backend_sched_alloc_graph(pc->sched, graph)) { qt_log(QT_LOG_ERROR, "[Pipeline] encode sched_alloc_graph failed"); ggml_backend_sched_reset(pc->sched);