From: Johannes Gäßler Date: Sun, 28 Dec 2025 09:52:09 +0000 (+0100) Subject: llama-fit-params: fix step size for last device (#18415) X-Git-Tag: upstream/0.0.7599~39 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=f8d561eb87cf689afb32ae5ee72118ddffaef12b;p=pkg%2Fggml%2Fsources%2Fllama.cpp llama-fit-params: fix step size for last device (#18415) --- diff --git a/src/llama.cpp b/src/llama.cpp index 93a9c408..76b3acba 100644 --- a/src/llama.cpp +++ b/src/llama.cpp @@ -512,6 +512,9 @@ static void llama_params_fit_impl( if (mem_high[id] > targets[id]) { assert(ngl_per_device_high[id].n_layer > ngl_per_device[id].n_layer); uint32_t delta = ngl_per_device_high[id].n_layer - ngl_per_device[id].n_layer; + if (hp_nex > 0 && size_t(id) == nd - 1) { + delta--; + } LLAMA_LOG_DEBUG("%s: start filling device %" PRIu32 ", delta=%" PRIu32 "\n", __func__, id, delta); while (delta > 1) { uint32_t step_size = int64_t(delta) * (targets[id] - mem[id]) / (mem_high[id] - mem[id]);