From b728bb21d449523524d171ac5ea9133533a19197 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 20 Aug 2026 11:19:57 +0800 Subject: [PATCH] llm_graph_result::reset(): also reset t_h_pre_norm Every other result tensor pointer is cleared in reset(), but t_h_pre_norm was left holding its previous graph's pointer. When a subsequent graph does not produce a pre-norm output (not all model graph paths set it), the stale pointer aliases an unrelated tensor in the rebuilt compute arena. The pre-norm extraction in llama_context::decode() then either asserts (ggml_backend_sched_get_tensor_backend returns null) or silently reads the wrong tensor. Observed as a hard assert when combining embeddings_pre_norm with draft model graphs that only set t_h_pre_norm on some batch types; may also be implicated in dflash draft issues like #44. --- src/llama-graph.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/llama-graph.cpp b/src/llama-graph.cpp index 4fd8ef776..2a5f654ff 100644 --- a/src/llama-graph.cpp +++ b/src/llama-graph.cpp @@ -1002,6 +1002,7 @@ void llm_graph_result::reset() { t_logits = nullptr; t_embd = nullptr; t_embd_pooled = nullptr; + t_h_pre_norm = nullptr; t_layer_inp.resize(LLAMA_MAX_LAYERS + 1); std::fill(t_layer_inp.begin(), t_layer_inp.end(), nullptr);