graph: reset scheduler before remaining shared-sched graph allocs

The talker path already resets the scheduler before allocating its graph
(thanks Andi Marafioti, #4 of qwentts.cpp). The same shared scheduler is
also allocated elsewhere without a reset first.

The scheduler keeps split and tensor->backend assignments from the
previous graph. Allocating a different graph topology on a dirty
scheduler can reuse stale assignments, which is exactly the CPU
divergence Andi fixed for the talker. Resetting before alloc_graph is
the canonical GGML contract and is idempotent when the scheduler is
already clean.

Suggested-by: Andres Marafioti <andimarafioti@gmail.com>
This commit is contained in:
Pascal
2026-06-09 19:53:56 +02:00
parent f79b23a567
commit e8e33629c1
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -240,6 +240,7 @@ static bool code_predictor_run(const CodePredictorWeights * cw,
ggml_set_output(logits);
ggml_build_forward_expand(gf, logits);
ggml_backend_sched_reset(sched);
if (!ggml_backend_sched_alloc_graph(sched, gf)) {
fprintf(stderr, "[CodePredictor] FATAL: graph allocation failed\n");
ggml_backend_sched_reset(sched);
+2
View File
@@ -161,6 +161,7 @@ static bool project_text_ids_backend(PipelineTTS * pt, const int32_t * ids, int
struct ggml_cgraph * graph = ggml_new_graph_custom(gctx, max_nodes, false);
ggml_build_forward_expand(graph, out);
ggml_backend_sched_reset(pt->sched);
if (!ggml_backend_sched_alloc_graph(pt->sched, graph)) {
ggml_backend_sched_reset(pt->sched);
ggml_free(gctx);
@@ -244,6 +245,7 @@ static void project_ref_codes_backend(PipelineTTS * pt, const int32_t * ref_code
struct ggml_cgraph * graph = ggml_new_graph_custom(gctx, max_nodes, false);
ggml_build_forward_expand(graph, sum);
ggml_backend_sched_reset(pt->sched);
if (!ggml_backend_sched_alloc_graph(pt->sched, graph)) {
ggml_backend_sched_reset(pt->sched);
ggml_free(gctx);