FfnComponent

Enum FfnComponent 

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

FFN component: MoE (expert routing), dense SwiGLU, or None (standalone attention).

Variants§

§

Moe(MoeLayer)

§

Dense(DenseFfnLayer)

§

None

No FFN — used by Nemotron-H standalone attention layers.

Implementations§

Source§

impl FfnComponent

Source

pub fn is_none(&self) -> bool

Source

pub fn is_dense(&self) -> bool

True for a plain dense (SwiGLU) FFN. Wide-batch verify paths gate their forward_prefill fast path on this: batching reads dense weights once (big win at N=17), but on a 256-expert MoE the grouped-GEMM is a net loss at small batch (per-expert M~1 + sort/permute overhead), so MoE keeps its per-token loop.

Source

pub fn moe_grouped_decode_ok(&self) -> bool

True when this MoE FFN can serve DECODE through the grouped read-once GEMM (forward_prefill) instead of the pairwise per-slot loop. The is_dense() comment above asserts grouped is “a net loss at small batch” on a 256-expert MoE, but that was never measured for decode CONCURRENCY (n=4) where the pairwise path re-reads ~14-20 distinct experts as 40 per-slot CTAs. Native-NVFP4-routed only (forward_prefill’s unconditional grouped path); dense/none are false.

Source

pub fn fp32_routing_active(&self) -> bool

ATLAS_FP32_ROUTING active for this FFN (MoE only; 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 can_forward_km(&self, m: u32) -> bool

Whether the K=m (m<=8) batched-GEMV verify FFN is available (dense only — MoE / missing batch4/batch8 kernel / non-NVFP4 weights → false). Lets callers gate branch entry BEFORE computing the pre-FFN norm, so there is no half-done fallthrough to forward_prefill.

Source

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

K=m (m=4..8) verify FFN via batched GEMV (dense only). Returns false when the path is unavailable (MoE / missing batchm kernel / non-NVFP4 weights) so the caller can fall back to forward_prefill.

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<()>

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, 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