pub struct ExpertPool { /* private fields */ }Expand description
Tracks which logical experts are GPU-resident and applies TIDE placement updates.
Implementations§
Source§impl ExpertPool
impl ExpertPool
pub fn new(config: ExpertPoolConfig) -> Self
pub fn num_experts(&self) -> usize
pub fn gpu_budget(&self) -> usize
pub fn refresh_policy(&self) -> ExpertRefreshPolicy
pub fn stats(&self) -> &ExpertPoolStats
Sourcepub fn reset_step_stats(&mut self)
pub fn reset_step_stats(&mut self)
TIDE LLaDA2MoeSparseMoeBlock.reset_stats() — clear per-step counters before next forward.
pub fn resident_gpu_experts(&self) -> impl Iterator<Item = usize> + '_
Sourcepub fn resident_mask(&self) -> Vec<bool>
pub fn resident_mask(&self) -> Vec<bool>
Bitmask for crate::CompiledGraph::set_moe_resident_experts.
pub fn is_gpu_resident(&self, expert: usize) -> bool
Sourcepub fn offload_enabled(&self) -> bool
pub fn offload_enabled(&self) -> bool
Whether offload is active (budget < total experts).
Sourcepub fn should_refresh(
&self,
mode: MoEExecMode,
denoise_step: usize,
is_prefill_block: bool,
) -> bool
pub fn should_refresh( &self, mode: MoEExecMode, denoise_step: usize, is_prefill_block: bool, ) -> bool
TIDE generate: refresh_experts = prefill_block || (offload && step % τ == 0).
Sourcepub fn on_forward_step(
&mut self,
mode: MoEExecMode,
denoise_step: usize,
is_prefill_block: bool,
) -> bool
pub fn on_forward_step( &mut self, mode: MoEExecMode, denoise_step: usize, is_prefill_block: bool, ) -> bool
Advance the step counter; returns whether this forward should refresh.
Sourcepub fn count_hits(expert_idx: &[u32], num_experts: usize) -> Vec<u64>
pub fn count_hits(expert_idx: &[u32], num_experts: usize) -> Vec<u64>
Count token hits per expert from flat or per-token indices (TIDE bincount).
Sourcepub fn target_gpu_from_counts(counts: &[u64], gpu_budget: usize) -> Vec<usize>
pub fn target_gpu_from_counts(counts: &[u64], gpu_budget: usize) -> Vec<usize>
Top-gpu_budget experts by hit count (TIDE torch.topk on bincount).
Sourcepub fn refresh_from_indices(
&mut self,
expert_idx: &[u32],
) -> ExpertRefreshResult
pub fn refresh_from_indices( &mut self, expert_idx: &[u32], ) -> ExpertRefreshResult
TIDE update_expert_placement + hit-based target selection.
Sourcepub fn apply_target_placement(
&mut self,
target_order: &[usize],
) -> ExpertRefreshResult
pub fn apply_target_placement( &mut self, target_order: &[usize], ) -> ExpertRefreshResult
Apply a precomputed target GPU set (paired promote/demote).
Trait Implementations§
Source§impl Clone for ExpertPool
impl Clone for ExpertPool
Source§fn clone(&self) -> ExpertPool
fn clone(&self) -> ExpertPool
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ExpertPool
impl RefUnwindSafe for ExpertPool
impl Send for ExpertPool
impl Sync for ExpertPool
impl Unpin for ExpertPool
impl UnsafeUnpin for ExpertPool
impl UnwindSafe for ExpertPool
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more