FfnComponent

Enum FfnComponent 

Source
pub enum FfnComponent {
    Moe(MoeLayer),
    Dense(DenseFfnLayer),
    None,
}
Expand description

2026-09-25: A layer’s FFN: MoE, dense, or none.

Variants§

§

Moe(MoeLayer)

§

Dense(DenseFfnLayer)

§

None

2026-09-25: No FFN: forward returns its input and the other passes launch nothing.

Implementations§

Source§

impl FfnComponent

Source

pub fn nvfp4_grouped_ok(&self, m: usize, ctx: &ForwardContext<'_>) -> bool

2026-09-27: Whether this is a MoE whose grouped NVFP4 decode serves m rows (MoeLayer::nvfp4_grouped_decode_ok).

Source

pub fn forward_nvfp4_grouped( &self, input: DevicePtr, m: usize, ctx: &ForwardContext<'_>, stream: u64, ) -> Result<()>

2026-09-27: The grouped NVFP4 MoE decode over [m, H] rows into moe_output(). Errors for dense and none; callers gate on Self::nvfp4_grouped_ok first.

Source§

impl FfnComponent

Source

pub fn is_none(&self) -> bool

Source

pub fn is_dense(&self) -> bool

Source

pub fn moe_grouped_decode_ok(&self) -> bool

2026-09-25: Whether this is a MoE whose MoeLayer::grouped_decode_ok holds, so multi-sequence decode may route it through forward_prefill (qwen3_attention/trait_impl/multi_seq/ffn.rs). False for dense and none.

Source

pub fn fp32_routing_active(&self, levers: &ModelLevers) -> bool

2026-09-25: MoeLayer::fp32_routing_active for a MoE; false otherwise.

Source

pub fn forward( &self, input: DevicePtr, ctx: &ForwardContext<'_>, stream: u64, ) -> Result<DevicePtr>

Source

pub fn forward_k2( &self, input: DevicePtr, ctx: &ForwardContext<'_>, stream: u64, ) -> Result<()>

Source

pub fn forward_k3( &self, input: DevicePtr, ctx: &ForwardContext<'_>, stream: u64, ) -> Result<()>

Source

pub fn dense_fixed_ok(&self, m: usize, ctx: &ForwardContext<'_>) -> bool

2026-09-30: Whether this is a dense FFN that runs m rows under a fixed --activation-quantization (DenseFfnLayer::fixed_ok). False for MoE and none.

Source

pub fn forward_dense_fixed( &self, input: DevicePtr, m: usize, ctx: &ForwardContext<'_>, stream: u64, ) -> Result<()>

2026-09-30: DenseFfnLayer::forward_fixed over m rows into moe_output; call only when dense_fixed_ok(m) holds.

Source

pub fn can_forward_km(&self, m: u32) -> bool

2026-09-25: Whether this is a dense FFN whose DenseFfnLayer::can_forward_km(m) holds: a batched-GEMV tier serves m rows and NVFP4 or FP8 weights are loaded. False for MoE and none. Multi-sequence attention decode (qwen3_attention/trait_impl/multi_seq/ffn.rs) asks before computing the pre-FFN norm.

Source

pub fn narrow_rows(&self) -> u32

2026-09-28: Row edge of a dense FFN’s narrow decode arms (DenseFfnLayer::narrow_rows: its W4A4 edge under the weight-quantization tier, capped at 32, else the W4A16 edge). MoE and none answer the W4A16 edge; can_forward_km is false for them anyway.

Source

pub fn try_forward_km( &self, input: DevicePtr, m: u32, ctx: &ForwardContext<'_>, stream: u64, ) -> Result<bool>

2026-09-25: DenseFfnLayer::forward_km over m rows. Returns Ok(false) without launching when can_forward_km(m) is false.

Source

pub fn forward_prefill( &self, input: DevicePtr, num_tokens: usize, ctx: &ForwardContext<'_>, stream: u64, ) -> Result<()>

Source

pub fn forward_batched( &self, input: DevicePtr, num_tokens: usize, ctx: &ForwardContext<'_>, stream: u64, ) -> Result<()>

Source

pub fn forward_token_major_decode( &self, input: DevicePtr, num_tokens: usize, ctx: &ForwardContext<'_>, stream: u64, ) -> Result<()>

Source

pub fn forward_atomic_c4_decode( &self, input: DevicePtr, num_tokens: usize, ctx: &ForwardContext<'_>, stream: u64, ) -> Result<()>

Source

pub fn fp8_grouped_decode_ok(&self, m: usize, ctx: &ForwardContext<'_>) -> bool

2026-09-25: Whether the target model’s cross-row grouped FP8 MoE decode serves m rows: ModelLevers::moe_fp8_grouped_decode_target (METRALE_FP8_MOE_GROUPED_DECODE) is on and this is a MoE whose MoeLayer::fp8_grouped_decode_ok(m) holds. The MTP drafter calls MoeLayer::fp8_grouped_decode_ok directly, without the lever.

Source

pub fn fp8_grouped_routing_ok( &self, m: usize, routing: GroupedRouting, ctx: &ForwardContext<'_>, ) -> bool

2026-09-26: Whether this is a MoE whose grouped FP8 decode serves m rows with routing (MoeLayer::fp8_grouped_routing_ok). Unlike Self::fp8_grouped_decode_ok it does not read the moe_fp8_grouped_decode_target lever: the exact routings reproduce the path they replace byte for byte, so they need no opt-in.

Source

pub fn forward_fp8_grouped_decode_routed( &self, input: DevicePtr, m: usize, routing: GroupedRouting, ctx: &ForwardContext<'_>, stream: u64, ) -> Result<()>

2026-09-26: Self::forward_fp8_grouped_decode with routing. Errors for dense and none; callers gate on fp8_grouped_routing_ok first.

Source

pub fn forward_fp8_grouped_decode( &self, input: DevicePtr, m: usize, ctx: &ForwardContext<'_>, stream: u64, ) -> Result<()>

2026-09-25: Cross-row grouped FP8 MoE decode over [m, H] rows into moe_output(). Errors for dense and none; callers gate on fp8_grouped_decode_ok first.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,