Commit 690b87d88 for llama.cpp

commit 690b87d88151dbd775bb6eff5581663688785928
Author: Daniel Han <danielhanchen@gmail.com>
Date:   Sat Nov 21 03:10:38 2026 -0800

    model : inkling2_loop share the loop slots after the scale pass (#32704)

    The loop slots copied the physical layers at the end of load_arch_tensors,
    before the generic pass attaches the optional .scale tensors, so the later
    passes through the core ran NVFP4 experts without their per-expert scales.
    Add an optional post_arch_tensors hook that runs after the scale pass and
    share the slots there.

diff --git a/src/llama-model.cpp b/src/llama-model.cpp
index 4c77f6f68..81e28b1c5 100644
--- a/src/llama-model.cpp
+++ b/src/llama-model.cpp
@@ -2019,6 +2019,7 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) {
                 output_in_s = create_tensor(tn(LLM_TENSOR_OUTPUT, "input_scale"), {1}, TENSOR_NOT_REQUIRED);
             }
         }
+        post_arch_tensors(ml);
     }

     ml.done_getting_tensors();
diff --git a/src/llama-model.h b/src/llama-model.h
index e86e5e54f..6473980a8 100644
--- a/src/llama-model.h
+++ b/src/llama-model.h
@@ -1070,6 +1070,9 @@ struct llama_model {
     virtual void load_arch_tensors(llama_model_loader & ml) = 0;
     virtual std::unique_ptr<llm_graph_context> build_arch_graph(const llm_graph_params & params) const = 0;

+    // optional, runs after the scale pass
+    virtual void post_arch_tensors(llama_model_loader &) {}
+
 protected:
     llama_model_params params;

diff --git a/src/models/inkling2-loop.cpp b/src/models/inkling2-loop.cpp
index 0de66baee..8366a1191 100644
--- a/src/models/inkling2-loop.cpp
+++ b/src/models/inkling2-loop.cpp
@@ -60,7 +60,9 @@ void llama_model_inkling2_loop::load_arch_tensors(llama_model_loader & ml) {
             l.ctrl_forget[c] = create_tensor(tn(forget[c], "weight", il), {rank, n_embd}, 0);
         }
     }
+}

+void llama_model_inkling2_loop::post_arch_tensors(llama_model_loader &) {
     // share the physical weights, each cache slot keeps its own KV and conv state
     for (int il = n_phys; il < (int) hparams.n_layer(); ++il) {
         layers[il] = layers[layer_phys(il)];
diff --git a/src/models/models.h b/src/models/models.h
index 636afeae9..8d2a58827 100644
--- a/src/models/models.h
+++ b/src/models/models.h
@@ -2547,6 +2547,7 @@ struct llama_model_inkling2_loop : public llama_model_inkling2 {
     llama_model_inkling2_loop(const struct llama_model_params & params) : llama_model_inkling2(params) {}
     void load_arch_hparams(llama_model_loader & ml) override;
     void load_arch_tensors(llama_model_loader & ml) override;
+    void post_arch_tensors(llama_model_loader & ml) override;

     int n_layer_phys() const override { return n_phys; }
     int layer_phys(int il) const;