pub struct ObservedExpertProvider<'a, P, O: ?Sized, E> { /* private fields */ }Expand description
Decorates a routed provider with normalized routing observation.
The decorator sees the exact request and output of canonical provider execution. It therefore adds observation without reimplementing a model family’s block, routing, shape, or residency lifecycle. Tensor-parallel requests are delegated without an event because their provider result may still require an architecture-owned reduction before it is observable.
Implementations§
Source§impl<'a, P, O: ?Sized, E> ObservedExpertProvider<'a, P, O, E>
impl<'a, P, O: ?Sized, E> ObservedExpertProvider<'a, P, O, E>
Sourcepub fn new(
provider: &'a mut P,
observer: &'a mut O,
point: RoutedObservationPoint,
) -> Self
pub fn new( provider: &'a mut P, observer: &'a mut O, point: RoutedObservationPoint, ) -> Self
Wraps provider for one canonical routed module invocation.
Trait Implementations§
Source§impl<B, P, O, E> RoutedExpertProvider<B> for ObservedExpertProvider<'_, P, O, E>where
B: GroupedNeuralBackend,
P: RoutedExpertProvider<B>,
O: ActivationObserver<B::Tensor, E> + ?Sized,
impl<B, P, O, E> RoutedExpertProvider<B> for ObservedExpertProvider<'_, P, O, E>where
B: GroupedNeuralBackend,
P: RoutedExpertProvider<B>,
O: ActivationObserver<B::Tensor, E> + ?Sized,
Source§type Error = ObservedExpertProviderError<<P as RoutedExpertProvider<B>>::Error, E>
type Error = ObservedExpertProviderError<<P as RoutedExpertProvider<B>>::Error, E>
Provider-specific acquisition or execution failure.
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>
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>
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.
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>
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. Read more
Source§impl<B, P, O, E> TensorParallelRoutedExpertProvider<B> for ObservedExpertProvider<'_, P, O, E>where
B: GroupedNeuralBackend,
P: TensorParallelRoutedExpertProvider<B>,
O: ActivationObserver<B::Tensor, E> + ?Sized,
impl<B, P, O, E> TensorParallelRoutedExpertProvider<B> for ObservedExpertProvider<'_, P, O, E>where
B: GroupedNeuralBackend,
P: TensorParallelRoutedExpertProvider<B>,
O: ActivationObserver<B::Tensor, E> + ?Sized,
Source§fn forward_grouped_tensor_parallel(
&mut self,
resident_bank: &mut B::GatedProductGroups,
request: RoutedExpertRequest<'_, B::Tensor>,
partitions: usize,
context: &<B::Tensor as Tensor>::Context,
) -> Result<RoutedExpertTensorParallelOutput<B::Tensor>, Self::Error>
fn forward_grouped_tensor_parallel( &mut self, resident_bank: &mut B::GatedProductGroups, request: RoutedExpertRequest<'_, B::Tensor>, partitions: usize, context: &<B::Tensor as Tensor>::Context, ) -> Result<RoutedExpertTensorParallelOutput<B::Tensor>, Self::Error>
Executes a rank-local gated-product contribution.
Source§fn forward_relu2_routed_tensor_parallel(
&mut self,
resident_bank: &mut B::Relu2Groups,
request: RoutedExpertRequest<'_, B::Tensor>,
partitions: usize,
context: &<B::Tensor as Tensor>::Context,
) -> Result<RoutedExpertTensorParallelOutput<B::Tensor>, Self::Error>
fn forward_relu2_routed_tensor_parallel( &mut self, resident_bank: &mut B::Relu2Groups, request: RoutedExpertRequest<'_, B::Tensor>, partitions: usize, context: &<B::Tensor as Tensor>::Context, ) -> Result<RoutedExpertTensorParallelOutput<B::Tensor>, Self::Error>
Executes a rank-local ReLU-squared contribution.
Source§fn forward_compact_grouped_tensor_parallel(
&mut self,
resident_bank: &mut B::GatedProductGroups,
request: RoutedExpertRequest<'_, B::Tensor>,
partitions: usize,
context: &<B::Tensor as Tensor>::Context,
) -> Result<RoutedExpertTensorParallelOutput<B::Tensor>, Self::Error>
fn forward_compact_grouped_tensor_parallel( &mut self, resident_bank: &mut B::GatedProductGroups, request: RoutedExpertRequest<'_, B::Tensor>, partitions: usize, context: &<B::Tensor as Tensor>::Context, ) -> Result<RoutedExpertTensorParallelOutput<B::Tensor>, Self::Error>
Executes destination-local, one-expert-per-row contributions while
preserving the backend’s TP reduction and post-bias structure.
Auto Trait Implementations§
impl<'a, P, O, E> !UnwindSafe for ObservedExpertProvider<'a, P, O, E>
impl<'a, P, O, E> Freeze for ObservedExpertProvider<'a, P, O, E>
impl<'a, P, O, E> RefUnwindSafe for ObservedExpertProvider<'a, P, O, E>where
&'a mut P: RefUnwindSafe,
&'a mut O: RefUnwindSafe,
PhantomData<fn() -> E>: RefUnwindSafe,
O: ?Sized,
impl<'a, P, O, E> Send for ObservedExpertProvider<'a, P, O, E>
impl<'a, P, O, E> Sync for ObservedExpertProvider<'a, P, O, E>
impl<'a, P, O, E> Unpin for ObservedExpertProvider<'a, P, O, E>
impl<'a, P, O, E> UnsafeUnpin for ObservedExpertProvider<'a, P, O, E>where
&'a mut P: UnsafeUnpin,
&'a mut O: UnsafeUnpin,
PhantomData<fn() -> E>: UnsafeUnpin,
O: ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more