Skip to main content

MoeKind

Enum MoeKind 

Source
#[non_exhaustive]
#[repr(u16)]
pub enum MoeKind { ScalarGguf = 0, Wmma = 1, WmmaGguf = 2, }
Expand description

Mixture-of-Experts (MoE) variant selector — used as the op discriminant for kernel SKUs whose crate::OpCategory is crate::OpCategory::Moe. Phase 8 Milestone 8.5 wires the three fused per-token-dispatch + expert-matmul + accumulate kernels.

MoE forward pass shape:

  • Input activations [T, D_model].
  • Per-token top-k expert indices [T, top_k] (i32).
  • Per-token top-k expert weights [T, top_k] (FP).
  • Per-expert weight matrices [num_experts, D_model, D_expert] (dtype depends on the variant: FP for Wmma, GGUF-packed bytes for ScalarGguf / WmmaGguf).
  • Output [T, D_model] (after expert mixing).

All three variants are inference-only by convention; backward passes are not shipped (MoE training uses higher-level autograd surfaces that compose the per-expert FFN ops manually).

Lineage: vendored from attention.rs via fuel-cuda-kernels. See crates/baracuda-kernels-sys/LICENSE-thirdparty.md for the full attribution chain.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

ScalarGguf = 0

Scalar dispatch path operating on GGUF-quantized expert weights staged through a q8_1 intermediate (FP32 activations in, FP32 output out). No tensor cores. Used as a portability fallback and as the slower-but-simpler reference for the WMMA + GGUF hot path. Block formats: Q8_0, Q2_K, Q3_K, Q4_K, Q5_K, Q6_K (matches Fuel’s moe_gemm_gguf switch).

§

Wmma = 1

WMMA tensor-core path operating on dense FP expert weights (f16 / bf16). The FP MoE hot path used when full-precision expert weights are available — typically training-time or FP-deployment inference. sm_70+ required.

§

WmmaGguf = 2

Combined WMMA tensor-core + GGUF-quantized weight path. The dispatcher dequantizes one GGUF block per N-row into shared memory, then issues a 16×16×16 WMMA mma.sync against the dense activation tile. The production hot path for quantized LLM inference. Activation dtype: f16 / bf16. Weight block formats: same set as Self::ScalarGguf. sm_70+ required.

Trait Implementations§

Source§

impl Clone for MoeKind

Source§

fn clone(&self) -> MoeKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for MoeKind

Source§

impl Debug for MoeKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for MoeKind

Source§

impl Hash for MoeKind

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for MoeKind

Source§

fn eq(&self, other: &MoeKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for MoeKind

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.