From: Daniel Bevenius Date: Tue, 2 Dec 2025 11:52:45 +0000 (+0100) Subject: ggml : remove redundant n_copies check when setting input/output (#17612) X-Git-Tag: upstream/0.0.7446~211 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=7f3a72a8ed796a135c81903546ef57c4aeda9f06;p=pkg%2Fggml%2Fsources%2Fllama.cpp ggml : remove redundant n_copies check when setting input/output (#17612) This commit removes a redundant check for sched->n_copies > 1 when setting input and output flags on tensor copies in ggml_backend_sched_split_graph. The motivation for this change is to clarify the code as the outer if statement already performs this check. --- diff --git a/ggml/src/ggml-backend.cpp b/ggml/src/ggml-backend.cpp index 1d88c826..08681f35 100644 --- a/ggml/src/ggml-backend.cpp +++ b/ggml/src/ggml-backend.cpp @@ -1240,10 +1240,8 @@ void ggml_backend_sched_split_graph(ggml_backend_sched_t sched, struct ggml_cgra tensor_copy = ggml_dup_tensor_layout(sched->ctx, src); ggml_format_name(tensor_copy, "%s#%s#%d", ggml_backend_name(backend), src->name, c); } - if (sched->n_copies > 1) { - ggml_set_input(tensor_copy); - ggml_set_output(tensor_copy); // prevent ggml-alloc from overwriting the tensor - } + ggml_set_input(tensor_copy); + ggml_set_output(tensor_copy); // prevent ggml-alloc from overwriting the tensor tensor_id_copy(src_id, src_backend_id, c) = tensor_copy; SET_CAUSE(tensor_copy, "4.cpy"); }