Module build

Module build 

Source
Expand description

2026-09-25: Bind one GLM-5.3 MLP site for a rank: TP-slice the dense FFN or shared expert, and build the routed experts’ pointer tables over GLOBAL expert ids.

Owner: model-arch (GLM-5.3). Invariants:

  • TP: gate_proj/up_proj ([inter, hidden]) are split by row and down_proj ([hidden, inter]) by column, so the dense output is a partial sum.
  • EP: an expert is owned whole by one rank. In each pointer table, an id another rank owns keeps a null packed pointer.
  • The router weight and bias are loaded unsliced on every rank.

Functions§

build_dense_mlp
2026-09-25: TP-slice and upload one BF16 SwiGLU MLP, a dense layer or a routed layer’s shared expert. full_inter is the unsliced width; the rank keeps full_inter / tp. Errors when full_inter does not divide over TP or a tensor has the wrong element count.
build_moe
2026-09-25: Bind one routed MoE site for this rank: the router and bias unsliced, the shared expert TP-sliced, and the local_experts routed experts this EP rank owns.

Type Aliases§

ExpertFn
2026-09-25: One routed expert’s weights, by GLOBAL id. Experts are not sliced, so the loader’s closure (bind_expert) can return NVFP4 pointers straight from the weight store.
LoadFn
2026-09-25: A BF16 or F32 tensor as host f32, by layer-relative name.