Commit 28148b5f0 for llama.cpp
commit 28148b5f06666bf44e0975f2980960672c1f94d9
Author: Aman Gupta <amangupta052@gmail.com>
Date: Thu Nov 26 17:44:26 2026 +0800
llama : refuse SPLIT_MODE_TENSOR for Hadamard-folded models (#33080)
Prism Bonsai models (prism.hadamard) aborted in the meta backend with
GGML_ASSERT(split_state.ne[j] % div == 0) when loaded with -sm tensor:
the ssm_out input permutation from tiled to grouped GDN head order
reshapes the head-split activation to [hd, n_k, n_rep] and the split
lands on n_rep (3 for 2 devices). Past that, the explicit sign vectors
are mirrored while their inputs are split, and the 1024-wide rotation
blocks would straddle the device slices of ffn_down (17408 = 17 blocks).
Fail at load with a clear message instead.
Assisted-by: Claude Opus 5.5
diff --git a/src/llama-model.cpp b/src/llama-model.cpp
index 72ad1b0e3..b83636631 100644
--- a/src/llama-model.cpp
+++ b/src/llama-model.cpp
@@ -2348,6 +2348,12 @@ void llama_model_base::load_hparams_hadamard(llama_model_loader & ml) {
throw std::runtime_error(format("unsupported prism.hadamard.version: %u", hadamard_version));
}
+ // the rotation blocks of the inputs of ffn_down, attn_output and ssm_out would straddle the device slices,
+ // and the sign vectors and the grouped GDN head order of ssm_out have no tensor split state
+ if (split_mode() == LLAMA_SPLIT_MODE_TENSOR) {
+ throw std::runtime_error("LLAMA_SPLIT_MODE_TENSOR is not supported for models with Hadamard-folded weights (prism.hadamard), use -sm layer");
+ }
+
if ((hadamard_version == 2) != hdmd.tied_output) {
throw std::runtime_error("prism.hadamard version 2 requires tied_output=true; version 1 forbids it");
}