Skip to main content

qualia_core_db/inference/moe/
mod.rs

1//! Mixture-of-Experts (MoE) execution and offload engine (Work Packages F9, F10).
2//!
3//! Provides zero-heap top-k routing, NVFP4 unpacking and GEMV, and heterogeneous
4//! GPU/CPU expert offload for the Qwen3.6-35B-A3B architecture on RTX A2000 12GB.
5
6pub mod dispatch;
7pub mod expert_cache;
8/// FTW multi-shard loader is file/`memmap2`-backed — native hosts only.
9#[cfg(not(target_arch = "wasm32"))]
10pub mod ftw_loader;
11pub mod nvfp4;
12pub mod placement;
13pub mod routing;
14
15pub use dispatch::{
16    dispatch_moe_step, evaluate_swiglu_expert_nvfp4, silu, ExpertWeightView, MAX_INTERMEDIATE_DIM,
17    MAX_ROUTED_EXPERTS,
18};
19pub use expert_cache::{
20    compute_principled_slot_capacity, query_dynamic_accelerator_budget,
21    query_dynamic_hardware_tier, DynamicVramStatus, ExpertCacheTelemetry, ExpertResidencyProfile,
22    MoeOffloadManager, PersonalHardwareTier, SlotAccessOutcome, DEFAULT_GPU_EXPERT_SLOTS,
23};
24#[cfg(not(target_arch = "wasm32"))]
25pub use ftw_loader::{
26    FtwExpertBankSlice, FtwExpertData, FtwManifest, FtwModelPackage, FtwShardEntry, FtwTensorEntry,
27};
28pub use nvfp4::{
29    dequantize_nvfp4_block, dequantize_nvfp4_row, fp8_e4m3_to_f32, nvfp4_gemv_zero_heap,
30    Nvfp4Error, E2M1_TABLE, NVFP4_BLOCK_SIZE, NVFP4_BYTES_PER_BLOCK,
31};
32pub use placement::{ExpertPlacementCalibration, ExpertPlacementPolicy};
33pub use routing::{combine_expert_outputs, route_topk, MoeError, MoeRoutingConfig, MAX_MOE_TOPK};