Skip to main content

RoutedExpertProvider

Trait RoutedExpertProvider 

Source
pub trait RoutedExpertProvider<B>{
    type Error;

    // Required methods
    fn forward_grouped(
        &mut self,
        resident_bank: &mut B::GatedProductGroups,
        request: RoutedExpertRequest<'_, B::Tensor>,
        context: &<B::Tensor as Tensor>::Context,
    ) -> Result<B::Tensor, Self::Error>;
    fn forward_relu2_routed(
        &mut self,
        resident_bank: &mut B::Relu2Groups,
        request: RoutedExpertRequest<'_, B::Tensor>,
        context: &<B::Tensor as Tensor>::Context,
    ) -> Result<B::Tensor, Self::Error>;

    // Provided methods
    fn routing_control(
        &mut self,
        _token_rows: u64,
    ) -> Result<Option<GroupSelectionControl>, Self::Error> { ... }
    fn routing_applied(
        &mut self,
        _original: Option<RoutingDecision<'_, B::Tensor>>,
        _effective: RoutingDecision<'_, B::Tensor>,
    ) -> Result<(), Self::Error> { ... }
    fn routing_failed(&mut self, _message: &str) { ... }
    fn forward_compact_grouped(
        &mut self,
        resident_bank: &mut B::GatedProductGroups,
        request: RoutedExpertRequest<'_, B::Tensor>,
        context: &<B::Tensor as Tensor>::Context,
    ) -> Result<B::Tensor, Self::Error> { ... }
}
Expand description

Runtime boundary for resident or independently cached routed experts.

Implementations own identity ordering, acquisition, leases, chunking, budgets, and residency reports. They keep every lease alive until the backend-native routed result is safe to return. The backend retains tensor storage, transfers, compact-bank construction, and execution kernels.

Required Associated Types§

Source

type Error

Provider-specific acquisition or execution failure.

Required Methods§

Source

fn forward_grouped( &mut self, resident_bank: &mut B::GatedProductGroups, request: RoutedExpertRequest<'_, B::Tensor>, context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, Self::Error>

Executes one typed route batch while retaining its acquired resources.

Source

fn forward_relu2_routed( &mut self, resident_bank: &mut B::Relu2Groups, request: RoutedExpertRequest<'_, B::Tensor>, context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, Self::Error>

Executes one ReLU-squared route batch through the same residency boundary.

Provided Methods§

Source

fn routing_control( &mut self, _token_rows: u64, ) -> Result<Option<GroupSelectionControl>, Self::Error>

Optional pre-dispatch control supplied by an instrumented provider adapter.

Source

fn routing_applied( &mut self, _original: Option<RoutingDecision<'_, B::Tensor>>, _effective: RoutingDecision<'_, B::Tensor>, ) -> Result<(), Self::Error>

Consumes bounded decision evidence before dispatch. Shared experts are not included.

Source

fn routing_failed(&mut self, _message: &str)

Attributes selector failure without claiming cache rollback.

Source

fn forward_compact_grouped( &mut self, resident_bank: &mut B::GatedProductGroups, request: RoutedExpertRequest<'_, B::Tensor>, context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, Self::Error>

Executes destination-local rows that were already expanded to one owner-local expert per row by the neutral expert exchange.

The compact request deliberately has route cardinality one; providers must not compare it with the architecture’s original top-k cardinality.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§