Skip to main content

PartitionedGroupExecutor

Trait PartitionedGroupExecutor 

Source
pub trait PartitionedGroupExecutor<A, B, S, G, R, I>{
    type Pass<'a>;

    // Required methods
    fn begin<'a>(
        &mut self,
        input: A::Input<'a>,
        state: &mut S,
        pass: ExpertPass,
        context: &<B::Tensor as Tensor>::Context,
    ) -> Result<Self::Pass<'a>, A::Error>;
    fn request_group_active(
        &self,
        pass: &Self::Pass<'_>,
        group: usize,
    ) -> Result<bool, A::Error>;
    fn execute_group<O: ActivationObserver<B::Tensor, A::Error> + ?Sized>(
        &mut self,
        pass: &mut Self::Pass<'_>,
        driver: &LayeredPartitionDriver,
        state: &mut S,
        communication: &PartitionCommunication<B, G, R, I>,
        communication_executor: &B::Executor,
        context: &<B::Tensor as Tensor>::Context,
        observer: &mut O,
    ) -> Result<(), A::Error>;
    fn boundary_values(
        &mut self,
        pass: &mut Self::Pass<'_>,
        route: &PartitionBoundaryRoute,
        schema: &ResolvedBoundaryWireSchema,
        source: bool,
        context: &<B::Tensor as Tensor>::Context,
    ) -> Result<Vec<ArchitectureBoundaryValue<B::Tensor>>, A::Error>;
    fn boundary_schema(
        &self,
        pass: &Self::Pass<'_>,
        route: &PartitionBoundaryRoute,
    ) -> Result<ResolvedBoundaryWireSchema, A::Error>;
    fn accept_boundary(
        &mut self,
        pass: &mut Self::Pass<'_>,
        route: &PartitionBoundaryRoute,
        values: Vec<B::Tensor>,
    ) -> Result<(), A::Error>;
    fn finish(
        &mut self,
        pass: Self::Pass<'_>,
        state: &mut S,
        context: &<B::Tensor as Tensor>::Context,
    ) -> Result<(B::Tensor, A::ForwardContext), A::Error>;

    // Provided methods
    fn has_cross_stage_collective_waves(&self) -> bool { ... }
    fn execute_pipeline_wave<O: ActivationObserver<B::Tensor, A::Error> + ?Sized>(
        &mut self,
        pass: &mut Self::Pass<'_>,
        group: usize,
        driver: Option<&LayeredPartitionDriver>,
        active: bool,
        _wave: usize,
        state: &mut S,
        communication: &PartitionCommunication<B, G, R, I>,
        communication_executor: &B::Executor,
        context: &<B::Tensor as Tensor>::Context,
        observer: &mut O,
    ) -> Result<(), A::Error> { ... }
    fn prediction_target_capture(
        &mut self,
        forward: &A::ForwardContext,
        _context: &<B::Tensor as Tensor>::Context,
    ) -> Result<Option<B::Tensor>, A::Error> { ... }
    fn apply_prediction_target_operation<O>(
        &mut self,
        _state: &mut S,
        _operation: O,
        _context: &<B::Tensor as Tensor>::Context,
    ) -> Result<Option<O::Output>, A::Error>
       where O: PredictionTargetOperation<A, B, S> { ... }
}
Expand description

Statically dispatched architecture/provider adapter used by the production driver.

Direct, routed-provider, and composite prepared-input implementations share this interface without erasing tensors or per-unit execution. Typed architecture boundary values are encoded and decoded inside the adapter; only their validated native tensor bundle crosses the communication seam.

Required Associated Types§

Source

type Pass<'a>

Per-invocation architecture-owned state, including the prepared model input.

Required Methods§

Source

fn begin<'a>( &mut self, input: A::Input<'a>, state: &mut S, pass: ExpertPass, context: &<B::Tensor as Tensor>::Context, ) -> Result<Self::Pass<'a>, A::Error>

Starts one invocation without traversing unowned groups.

Source

fn request_group_active( &self, pass: &Self::Pass<'_>, group: usize, ) -> Result<bool, A::Error>

Reports request activity only for architecture-declared optional roots.

Source

fn execute_group<O: ActivationObserver<B::Tensor, A::Error> + ?Sized>( &mut self, pass: &mut Self::Pass<'_>, driver: &LayeredPartitionDriver, state: &mut S, communication: &PartitionCommunication<B, G, R, I>, communication_executor: &B::Executor, context: &<B::Tensor as Tensor>::Context, observer: &mut O, ) -> Result<(), A::Error>

Executes exactly one locally owned group through its validated partition driver.

Source

fn boundary_values( &mut self, pass: &mut Self::Pass<'_>, route: &PartitionBoundaryRoute, schema: &ResolvedBoundaryWireSchema, source: bool, context: &<B::Tensor as Tensor>::Context, ) -> Result<Vec<ArchitectureBoundaryValue<B::Tensor>>, A::Error>

Produces source tensors or destination placeholders for one endpoint route.

Source

fn boundary_schema( &self, pass: &Self::Pass<'_>, route: &PartitionBoundaryRoute, ) -> Result<ResolvedBoundaryWireSchema, A::Error>

Resolves the exact invocation-dependent architecture boundary schema.

Source

fn accept_boundary( &mut self, pass: &mut Self::Pass<'_>, route: &PartitionBoundaryRoute, values: Vec<B::Tensor>, ) -> Result<(), A::Error>

Installs a validated received typed-boundary bundle before its consumer runs.

Source

fn finish( &mut self, pass: Self::Pass<'_>, state: &mut S, context: &<B::Tensor as Tensor>::Context, ) -> Result<(B::Tensor, A::ForwardContext), A::Error>

Returns projected output on the owner and matching destination storage elsewhere.

The value is source data only on the publication root. On other ranks it is the architecture-selected destination/placeholder tensor validated before submission.

Provided Methods§

Source

fn has_cross_stage_collective_waves(&self) -> bool

Whether inactive ranks submit collectives during pipeline-stage waves.

A failed wave is communication-indeterminate and therefore permanently fences the selected communication authority on every rank after phase agreement. Ordinary pipeline execution leaves this disabled so a deterministic architecture failure remains retryable after rollback.

Source

fn execute_pipeline_wave<O: ActivationObserver<B::Tensor, A::Error> + ?Sized>( &mut self, pass: &mut Self::Pass<'_>, group: usize, driver: Option<&LayeredPartitionDriver>, active: bool, _wave: usize, state: &mut S, communication: &PartitionCommunication<B, G, R, I>, communication_executor: &B::Executor, context: &<B::Tensor as Tensor>::Context, observer: &mut O, ) -> Result<(), A::Error>

Participates in one globally ordered pipeline-stage execution wave.

Ordinary executors perform work only on the active stage. Executors with architecture-selected cross-stage collectives may use the wave ordinal on inactive stages to submit their exact zero-work protocol. The execution plan has already proved that an active rank owns a local driver, so absence of a driver is meaningful only for inactive ranks.

Source

fn prediction_target_capture( &mut self, forward: &A::ForwardContext, _context: &<B::Tensor as Tensor>::Context, ) -> Result<Option<B::Tensor>, A::Error>

Resolves an output-owner target capture or a matching rank-local placeholder.

The default serves non-pipeline executors, where every participant owns the complete target result. Pipeline executors override this through their retained architecture and allocator.

Source

fn apply_prediction_target_operation<O>( &mut self, _state: &mut S, _operation: O, _context: &<B::Tensor as Tensor>::Context, ) -> Result<Option<O::Output>, A::Error>
where O: PredictionTargetOperation<A, B, S>,

Runs one typed prediction-only operation against this rank’s target partition.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§