LLM inference in C/C++
C++ ggml
ggml: allow backend inputs to not create another split (#28387)
Aman Gupta992cb503cdac
diff --git a/ggml/src/ggml-backend.cpp b/ggml/src/ggml-backend.cppindex 6862128e63..40e50c5c9d 100644--- a/ggml/src/ggml-backend.cpp+++ b/ggml/src/ggml-backend.cpp@@ -849,7 +849,7 @@ static void ggml_backend_sched_split_inputs_grow(struct ggml_backend_sched_splitint new_cap = GGML_SCHED_MAX_SPLIT_INPUTS;if (split->inputs_capacity > 0) {new_cap = 2*split->inputs_capacity;- GGML_LOG_WARN("%s: increasing split inputs capacity from %d to %d\n", __func__, split->inputs_capacity, new_cap);+ GGML_LOG_DEBUG("%s: increasing split inputs capacity from %d to %d\n", __func__, split->inputs_capacity, new_cap);}auto * pnew = (struct ggml_tensor **) realloc((void *) split->inputs, new_cap * sizeof(struct ggml_tensor *));if (pnew == NULL) {@@ -864,7 +864,7 @@ static void ggml_backend_sched_graph_inputs_grow(ggml_backend_sched_t sched) {int new_cap = GGML_SCHED_MAX_SPLIT_INPUTS;if (sched->graph_inputs_capacity > 0) {new_cap = 2*sched->graph_inputs_capacity;- GGML_LOG_WARN("%s: increasing graph inputs capacity from %d to %d\n", __func__, sched->graph_inputs_capacity, new_cap);+ GGML_LOG_DEBUG("%s: increasing graph inputs capacity from %d to %d\n", __func__, sched->graph_inputs_capacity, new_cap);}auto * pnew = (struct ggml_tensor **) realloc((void *) sched->graph_inputs, new_cap * sizeof(struct ggml_tensor *));if (pnew == NULL) {@@ -1338,17 +1338,6 @@ void ggml_backend_sched_split_graph(ggml_backend_sched_t sched, struct ggml_cgrabreak;}}- // check if the split has too many inputs- // FIXME: count the number of inputs instead of only checking when full- if (split->n_inputs >= split->inputs_capacity) {- const size_t id = hash_id(src);- int src_backend_id = sched->hv_tensor_backend_ids[id];- bool supported = ggml_backend_sched_buffer_supported(sched, src, cur_backend_id);- if (src_backend_id != cur_backend_id && tensor_id_copy(id, cur_backend_id, 0) == NULL && !supported) {- need_new_split = true;- break;- }- }}}