pub struct KdaTpPlan {
pub tp_rank: usize,
pub tp_size: usize,
pub hidden: usize,
pub head_dim: usize,
pub full_heads: usize,
pub local_heads: usize,
pub conv_kernel: usize,
pub gate_rank: usize,
pub tensors: Vec<KdaTensorPlan>,
}Expand description
The complete per-rank shard plan for one KDA block.
Fields§
§tp_rank: usize§tp_size: usize§head_dim: usize§full_heads: usizePre-shard head count (all ranks combined).
local_heads: usizeHeads this rank owns.
conv_kernel: usize§gate_rank: usizeLow-rank width of the f/g gate bottleneck.
tensors: Vec<KdaTensorPlan>Implementations§
Source§impl KdaTpPlan
impl KdaTpPlan
Sourcepub fn from_config(config: &ModelConfig, gate_rank: usize) -> Result<Self>
pub fn from_config(config: &ModelConfig, gate_rank: usize) -> Result<Self>
Build from a ModelConfig whose linear-head counts are already per-rank
local — serve_phases::topology divides them before any loader runs, and
TpGdnDims::from_config reconstructs full = local * tp_size the same way.
gate_rank is not a config key; it is the f_a_proj row count read from the
checkpoint (128 for GLM-5.3).
pub fn new( tp_rank: usize, tp_size: usize, hidden: usize, head_dim: usize, full_heads: usize, conv_kernel: usize, gate_rank: usize, ) -> Result<Self>
pub fn get(&self, name: &str) -> Option<&KdaTensorPlan>
Sourcepub fn local_bytes(&self) -> usize
pub fn local_bytes(&self) -> usize
Total bytes this rank stores for one KDA block.
Sourcepub fn full_bytes(&self) -> usize
pub fn full_bytes(&self) -> usize
Total bytes one KDA block occupies on disk.
Sourcepub fn needs_output_all_reduce(&self) -> bool
pub fn needs_output_all_reduce(&self) -> bool
Whether the layer must all-reduce after o_proj. False at tp_size == 1,
where the row-parallel slice is the whole tensor and the reduce is a no-op.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KdaTpPlan
impl RefUnwindSafe for KdaTpPlan
impl Send for KdaTpPlan
impl Sync for KdaTpPlan
impl Unpin for KdaTpPlan
impl UnwindSafe for KdaTpPlan
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more