K3LayerCtx

Struct K3LayerCtx 

Source
pub struct K3LayerCtx<'a> {
    pub kda: &'a KdaConfig,
    pub mla: &'a MlaConfig,
    pub moe: &'a LatentMoeConfig,
    pub situ_beta: f32,
    pub situ_linear_beta: f32,
    pub hidden: usize,
    pub dense_intermediate: usize,
    pub eps: f32,
    pub rope_theta: f32,
    pub reduce_hidden: Option<HiddenReduce<'a>>,
    pub dense_mlp: Option<DenseMlpCore<'a>>,
}
Expand description

Per-layer geometry the GPU wrapper and forward_token share.

K3BoundLayer::decode copies hidden D2H, runs this math, copies H2D. LinearAttention injects CUDA conv+recurrent unless K3_CUDA_KDA=0. FullAttention injects CUDA gated-NoPE MLA unless K3_CUDA_MLA=0.

Fields§

§kda: &'a KdaConfig§mla: &'a MlaConfig§moe: &'a LatentMoeConfig§situ_beta: f32§situ_linear_beta: f32§hidden: usize§dense_intermediate: usize§eps: f32§rope_theta: f32§reduce_hidden: Option<HiddenReduce<'a>>

After row-parallel o_proj (and dense MLP down). None at TP=1.

§dense_mlp: Option<DenseMlpCore<'a>>

Implementations§

Source§

impl<'a> K3LayerCtx<'a>

Source

pub fn from_model(model: &'a K3CpuModel) -> Self

Auto Trait Implementations§

§

impl<'a> Freeze for K3LayerCtx<'a>

§

impl<'a> !RefUnwindSafe for K3LayerCtx<'a>

§

impl<'a> !Send for K3LayerCtx<'a>

§

impl<'a> !Sync for K3LayerCtx<'a>

§

impl<'a> Unpin for K3LayerCtx<'a>

§

impl<'a> !UnwindSafe for K3LayerCtx<'a>

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.

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.