flashinfer.fused_moe.MoEWeightPack¶
- class flashinfer.fused_moe.MoEWeightPack(native_views: ~typing.Dict[str, ~typing.Dict[str, ~torch.Tensor]] = <factory>)¶
Long-lived weight container with per-backend native materializations.
Each backend’s native weight layout (quantized, swizzled, MMA-ordered, etc.) is stored under its
backend_key. Populated once at model-load / layer-init viaprepare_for(key, view); read on every call viaget_view(key).Holding multiple materializations is intentional — that’s the memory cost the user pays for cross-backend autotune. Each view is the exact kwargs dict that runner’s
forwardexpects for weight-side arguments.Every
XxxConfig.prepare_weightstakes the same canonical source layout:w1is[E, 2I, H]for gated activations with rows in[up, gate]order (act(x @ w1[I:].T) * (x @ w1[:I].T)), or[E, I, H]for non-gated ones;w2is[E, H, I]. Backends that want[gate, up]swap halves inside their prepare helper.- __init__(native_views: ~typing.Dict[str, ~typing.Dict[str, ~torch.Tensor]] = <factory>) None¶
Methods
__init__([native_views])get_view(backend_key)prepare_for(backend_key, view)Register a backend-native weight view.
Attributes
native_views