Skip to main content

ParallelLayeredArchitecture

Trait ParallelLayeredArchitecture 

Source
pub trait ParallelLayeredArchitecture<B, S>: LayeredArchitecture<B, S>
where B: NeuralBackend, S: RuntimeState<B>,
{ // Required methods fn begin_forward_parallel<'a>( &mut self, input: Self::Input<'a>, state: &mut S, parallel: &B::ParallelContext, context: &<B::Tensor as Tensor>::Context, ) -> Result<LayeredForwardState<B::Tensor, Self::ForwardContext>, Self::Error>; fn forward_unit_parallel( &mut self, group_index: usize, index: usize, unit: &mut Self::Unit, hidden: &B::Tensor, state: &mut S, forward: &mut Self::ForwardContext, parallel: &B::ParallelContext, context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, Self::Error>; fn finish_forward_parallel( &mut self, hidden: &B::Tensor, state: &mut S, forward: &Self::ForwardContext, parallel: &B::ParallelContext, context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, Self::Error>; // Provided methods fn begin_execution_group_parallel( &mut self, group_index: usize, initial: &B::Tensor, dependencies: &[&B::Tensor], state: &mut S, forward: &mut Self::ForwardContext, _parallel: &B::ParallelContext, context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, Self::Error> { ... } fn complete_execution_group_parallel( &mut self, group_index: usize, hidden: &B::Tensor, state: &mut S, forward: &mut Self::ForwardContext, _parallel: &B::ParallelContext, context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, Self::Error> { ... } }
Expand description

Optional statically dispatched parallel lifecycle for a layered architecture.

The runtime owns traversal and exact unit completion while the architecture owns parallel embedding, block, and output semantics. Backend-native collective contexts cross this boundary unchanged.

Required Methods§

Source

fn begin_forward_parallel<'a>( &mut self, input: Self::Input<'a>, state: &mut S, parallel: &B::ParallelContext, context: &<B::Tensor as Tensor>::Context, ) -> Result<LayeredForwardState<B::Tensor, Self::ForwardContext>, Self::Error>

Embeds input and prepares forward values for rank-local execution.

Source

fn forward_unit_parallel( &mut self, group_index: usize, index: usize, unit: &mut Self::Unit, hidden: &B::Tensor, state: &mut S, forward: &mut Self::ForwardContext, parallel: &B::ParallelContext, context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, Self::Error>

Executes one rank-local unit and its required collectives.

Source

fn finish_forward_parallel( &mut self, hidden: &B::Tensor, state: &mut S, forward: &Self::ForwardContext, parallel: &B::ParallelContext, context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, Self::Error>

Applies the rank-local output projection and returns complete logits.

Provided Methods§

Source

fn begin_execution_group_parallel( &mut self, group_index: usize, initial: &B::Tensor, dependencies: &[&B::Tensor], state: &mut S, forward: &mut Self::ForwardContext, _parallel: &B::ParallelContext, context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, Self::Error>

Selects or merges a ready group’s activation under a parallel context.

Source

fn complete_execution_group_parallel( &mut self, group_index: usize, hidden: &B::Tensor, state: &mut S, forward: &mut Self::ForwardContext, _parallel: &B::ParallelContext, context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, Self::Error>

Converts a completed group’s output under a parallel context.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§