Commit 961c376a2 for llama.cpp
commit 961c376a2daa42220ec09663b9bde32c5fba1f70
Author: begcdn <150344566+begcdn@users.noreply.github.com>
Date: Tue Oct 27 06:04:19 2026 +0800
llama : enable moe amax rescaling for laguna (#31147)
* llama : enable moe amax rescaling for laguna
Assisted-by: Devin
* llama : declare laguna sm tensor support
diff --git a/src/llama-arch.cpp b/src/llama-arch.cpp
index 06fc56bb2..fe3ad3eb7 100644
--- a/src/llama-arch.cpp
+++ b/src/llama-arch.cpp
@@ -1347,6 +1347,7 @@ bool llm_arch_supports_sm_tensor(const llm_arch & arch) {
case LLM_ARCH_MISTRAL4:
case LLM_ARCH_MELLUM: // [TAG_MOE_AMAX_SCALE]
case LLM_ARCH_FLINT: // [TAG_MOE_AMAX_SCALE]
+ case LLM_ARCH_LAGUNA: // [TAG_MOE_AMAX_SCALE]
case LLM_ARCH_KIMI_LINEAR:
case LLM_ARCH_BAILINGMOE3:
case LLM_ARCH_KIMI_K3:
diff --git a/src/llama-graph.cpp b/src/llama-graph.cpp
index a22dfba96..7309705dc 100644
--- a/src/llama-graph.cpp
+++ b/src/llama-graph.cpp
@@ -2519,7 +2519,7 @@ ggml_tensor * llm_graph_context::build_moe_ffn(
// ref: https://github.com/ggml-org/llama.cpp/pull/30656#issuecomment-6269597922
llm_graph_amax_src1 amax_src1 = { nullptr, nullptr };
- if (arch == LLM_ARCH_MISTRAL4 || arch == LLM_ARCH_MELLUM || arch == LLM_ARCH_FLINT) {
+ if (arch == LLM_ARCH_MISTRAL4 || arch == LLM_ARCH_MELLUM || arch == LLM_ARCH_FLINT || arch == LLM_ARCH_LAGUNA) {
amax_src1 = build_amax_src1_f16(cur);
cur = amax_src1.res;
}