From b5cf8ce02aaf95c15375e2ed97f273fa7e274f5c Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Tue, 29 Sep 2026 20:23:33 +0300 Subject: [PATCH] ggml : require input tensors to be GGML_OP_NONE (#29647) --- ggml/src/ggml.c | 1 + src/llama-context.cpp | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ggml/src/ggml.c b/ggml/src/ggml.c index cdc10a7597..7c931afb99 100644 --- a/ggml/src/ggml.c +++ b/ggml/src/ggml.c @@ -7992,6 +7992,7 @@ void ggml_graph_dump_dot(const struct ggml_cgraph * gb, const struct ggml_cgraph //////////////////////////////////////////////////////////////////////////////// void ggml_set_input(struct ggml_tensor * tensor) { + GGML_ASSERT(tensor->op == GGML_OP_NONE); tensor->flags |= GGML_TENSOR_FLAG_INPUT; } diff --git a/src/llama-context.cpp b/src/llama-context.cpp index 88851c6cba..439beabdfa 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp @@ -599,10 +599,7 @@ static int llama_graph_n_input_tensors(ggml_cgraph * gf) { } for (const auto & [tensor, nodes] : users) { - if (tensor->op != GGML_OP_NONE) { - LLAMA_LOG_WARN("%s: input tensor '%32s' has op %s, expected GGML_OP_NONE\n", - __func__, tensor->name, ggml_op_name(tensor->op)); - } + GGML_ASSERT(tensor->op == GGML_OP_NONE); for (const ggml_tensor * node : nodes) { LLAMA_LOG_DEBUG("%s: input tensor '%32s' [%s, ne = { %5" PRId64 ", %5" PRId64 ", %5" PRId64 ", %5" PRId64 " }] is used by node '%s' (%s)\n", __func__, tensor->name, ggml_type_name(tensor->type),