Skip to content

Commit d4344df

Browse files
kmbandyclaude
andcommitted
feat(wp): tag routed-expert tensors with is_expert at load
Phase 1 Task 1 of the MoE resident/paged split. Add is_expert to llama_weight_page_info, set from the existing is_consolidated detection (ffn_*_exps name match) at load. Lets a later filter page only expert tensors and leave dense weights resident. No behavior change yet. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014ZRfPpL8XFzk1hep9MMg9P
1 parent 5a87918 commit d4344df

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/llama-model-loader.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ struct llama_weight_page_info {
4141
// pager may split it into per-expert sub-pages for routing-aware paging
4242
// (MAD-88 Phase 2). Set to 1 for non-MoE or per-expert tensors.
4343
int n_experts = 1;
44+
45+
// True iff this is a routed-expert consolidated tensor; dense tensors
46+
// (attention, shared expert, embeddings, norms) stay false.
47+
bool is_expert = false;
4448
};
4549

4650
struct llama_model_loader {

src/llama-model.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,6 +1795,7 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) {
17951795
info.n_experts = n_exp;
17961796
}
17971797
}
1798+
info.is_expert = is_consolidated;
17981799
}
17991800
ml.weight_page_infos.push_back(info);
18001801
// Collect the actual model tensor pointer for the weight pager

0 commit comments

Comments
 (0)