pub struct LayeredPartitionDriver { /* private fields */ }Expand description
Validated execution metadata for one rank-local layered partition.
This driver is the single owner of partition input/output checks, canonical storage and state ranges, execution-group setup/completion, and final output projection. Concrete backends retain only state storage and unit residency.
Implementations§
Source§impl LayeredPartitionDriver
impl LayeredPartitionDriver
Sourcepub fn new<G, A>(
partition: &ArchitecturePartition<G, A>,
group_index: usize,
storage_range: Range<usize>,
) -> Result<Self, LayeredPartitionError>
pub fn new<G, A>( partition: &ArchitecturePartition<G, A>, group_index: usize, storage_range: Range<usize>, ) -> Result<Self, LayeredPartitionError>
Validates a canonical partition against its concrete unit storage.
Sourcepub fn new_with_state_ownership<G, A>(
partition: &ArchitecturePartition<G, A>,
group_index: usize,
storage_range: Range<usize>,
group_owns_state: bool,
) -> Result<Self, LayeredPartitionError>
pub fn new_with_state_ownership<G, A>( partition: &ArchitecturePartition<G, A>, group_index: usize, storage_range: Range<usize>, group_owns_state: bool, ) -> Result<Self, LayeredPartitionError>
Validates a partition while explicitly declaring whether this group owns state slots.
Architecture selection must pass false for parameter-only composite roots. A rank can
still own decoder state for another local group without falsely comparing that state range
with this group’s unrelated unit indices.
Sourcepub const fn group_index(&self) -> usize
pub const fn group_index(&self) -> usize
Returns the canonical architecture execution-group slot.
Sourcepub fn state_layout(&self) -> &StateLayout
pub fn state_layout(&self) -> &StateLayout
Returns state geometry for a driver created through the strict stateful constructor.
Sourcepub const fn optional_state_layout(&self) -> Option<&StateLayout>
pub const fn optional_state_layout(&self) -> Option<&StateLayout>
Returns rank-local state geometry, or None for stateless roots and ranks.
Sourcepub const fn owns_input(&self) -> bool
pub const fn owns_input(&self) -> bool
Returns whether this partition receives request ingress directly.
Sourcepub const fn owns_output(&self) -> bool
pub const fn owns_output(&self) -> bool
Returns whether this partition owns architecture output projection.
Sourcepub fn input<'a, T, A>(
&self,
input: LayeredPartitionInput<'a, T, A>,
) -> Result<LayeredPartitionInput<'a, T, A>, LayeredPartitionError>
pub fn input<'a, T, A>( &self, input: LayeredPartitionInput<'a, T, A>, ) -> Result<LayeredPartitionInput<'a, T, A>, LayeredPartitionError>
Validates input form against architecture boundary ownership.
Sourcepub fn exchange_boundary<B>(
&self,
value: B::Tensor,
group: &B::Group,
executor: &B::Executor,
) -> Result<B::Tensor, B::CollectiveError>where
B: CollectiveBackend,
pub fn exchange_boundary<B>(
&self,
value: B::Tensor,
group: &B::Group,
executor: &B::Executor,
) -> Result<B::Tensor, B::CollectiveError>where
B: CollectiveBackend,
Transports this partition’s realized boundary through the selected opaque collective group.
Keeping the operation on the validated driver makes boundary movement part of partition execution rather than an unrelated backend call.
Sourcepub fn begin<'a, B, S, M>(
&self,
architecture: &mut M,
input: LayeredPartitionInput<'a, B::Tensor, <M::Boundary as ArchitectureBoundary>::Boundary<B::Tensor>>,
mask: Option<&B::Tensor>,
state: &mut S,
parallel: Option<&B::ParallelContext>,
context: &<B::Tensor as Tensor>::Context,
) -> Result<LayeredForwardState<B::Tensor, M::ForwardContext>, LayeredPartitionBeginError<M::Error>>where
B: NeuralBackend,
S: RuntimeState<B>,
M: PartitionedLayeredArchitecture<B, S>,
M::Error: Display,
pub fn begin<'a, B, S, M>(
&self,
architecture: &mut M,
input: LayeredPartitionInput<'a, B::Tensor, <M::Boundary as ArchitectureBoundary>::Boundary<B::Tensor>>,
mask: Option<&B::Tensor>,
state: &mut S,
parallel: Option<&B::ParallelContext>,
context: &<B::Tensor as Tensor>::Context,
) -> Result<LayeredForwardState<B::Tensor, M::ForwardContext>, LayeredPartitionBeginError<M::Error>>where
B: NeuralBackend,
S: RuntimeState<B>,
M: PartitionedLayeredArchitecture<B, S>,
M::Error: Display,
Prepares the partition and starts its canonical execution group.
Sourcepub fn finish<B, S, M>(
&self,
architecture: &mut M,
hidden: &B::Tensor,
state: &mut S,
forward: &mut M::ForwardContext,
parallel: Option<&B::ParallelContext>,
context: &<B::Tensor as Tensor>::Context,
) -> Result<LayeredPartitionOutput<B::Tensor, <M::Boundary as ArchitectureBoundary>::Boundary<B::Tensor>>, M::Error>
pub fn finish<B, S, M>( &self, architecture: &mut M, hidden: &B::Tensor, state: &mut S, forward: &mut M::ForwardContext, parallel: Option<&B::ParallelContext>, context: &<B::Tensor as Tensor>::Context, ) -> Result<LayeredPartitionOutput<B::Tensor, <M::Boundary as ArchitectureBoundary>::Boundary<B::Tensor>>, M::Error>
Completes the canonical group and applies output projection only on its owner.
Trait Implementations§
Source§impl Clone for LayeredPartitionDriver
impl Clone for LayeredPartitionDriver
Source§fn clone(&self) -> LayeredPartitionDriver
fn clone(&self) -> LayeredPartitionDriver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more