]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
Fix stale tensor-split params for draft models (#24814)
authorAl G <redacted>
Sun, 5 Jul 2026 18:39:36 +0000 (19:39 +0100)
committerGitHub <redacted>
Sun, 5 Jul 2026 18:39:36 +0000 (20:39 +0200)
* meta: fix tensor split metadata for GQA attention

* Tidied the code a bit to match existing style

* Revert "Tidied the code a bit to match existing style"

This reverts commit b90c6c6300091fe09e2350a3d4edcfcf15db8d2e.

* Reverted the ggml-backend-meta asset hack.

src/llama-model.cpp

index e07f6e9863630a3a36da5c40b294f87900a648b2..8d68cff45b789ebab817800e89406454baf53cc3 100644 (file)
@@ -1012,9 +1012,17 @@ struct llama_model::impl {
     std::vector<layer_dev> dev_layer;
 
     bool has_tensor_overrides;
+
+    std::vector<float> tensor_split_owned;
 };
 
 llama_model::llama_model(const llama_model_params & params) : params(params), pimpl(std::make_unique<impl>()) {
+    if (params.tensor_split != nullptr) {
+        // llama_model_params stores tensor_split as a borrowed pointer, but the model
+        // may need it later for tensor-parallel KV-cache split metadata.
+        pimpl->tensor_split_owned.assign(params.tensor_split, params.tensor_split + llama_max_devices());
+        this->params.tensor_split = pimpl->tensor_split_owned.data();
+    }
     pimpl->has_tensor_overrides = params.tensor_buft_overrides && params.tensor_buft_overrides[0].pattern;
 }