pub struct ArchitecturePartition<G, A> { /* private fields */ }Expand description
Complete backend-neutral realization of one rank’s architecture ownership.
G is family-owned local construction geometry. A is the family-owned
primary and auxiliary wire schema carried by the partition realization.
Implementations§
Source§impl<G, A> ArchitecturePartition<G, A>
impl<G, A> ArchitecturePartition<G, A>
Sourcepub fn from_architecture<B, S, M, N>(
architecture: &M,
group_ranges: impl IntoIterator<Item = (N, Range<usize>)>,
ownership: PartitionOwnership,
local_geometry: G,
boundary_schema: A,
parameters: &ArchitectureParameterDescription,
) -> Result<Self, ArchitecturePartitionError>where
B: NeuralBackend,
S: RuntimeState<B>,
M: LayeredArchitecture<B, S>,
M::Error: Display,
N: Into<String>,
A: ArchitectureBoundary,
pub fn from_architecture<B, S, M, N>(
architecture: &M,
group_ranges: impl IntoIterator<Item = (N, Range<usize>)>,
ownership: PartitionOwnership,
local_geometry: G,
boundary_schema: A,
parameters: &ArchitectureParameterDescription,
) -> Result<Self, ArchitecturePartitionError>where
B: NeuralBackend,
S: RuntimeState<B>,
M: LayeredArchitecture<B, S>,
M::Error: Display,
N: Into<String>,
A: ArchitectureBoundary,
Creates a partition from the topology declared by one concrete neutral architecture.
This constructor derives the graph and unit layout from architecture,
preventing a backend realization from publishing a parallel topology
that merely resembles, but is not the canonical topology of, the
architecture it will execute. Pre-allocation selection should use
Self::from_description with the architecture-authored declaration.
Sourcepub fn from_description<N>(
parameters: &ArchitectureParameterDescription,
group_ranges: impl IntoIterator<Item = (N, Range<usize>)>,
ownership: PartitionOwnership,
complete_state: &StateLayout,
state_plan: &ArchitectureStatePartitionPlan,
local_geometry: G,
boundary_schema: A,
) -> Result<Self, ArchitecturePartitionError>
pub fn from_description<N>( parameters: &ArchitectureParameterDescription, group_ranges: impl IntoIterator<Item = (N, Range<usize>)>, ownership: PartitionOwnership, complete_state: &StateLayout, state_plan: &ArchitectureStatePartitionPlan, local_geometry: G, boundary_schema: A, ) -> Result<Self, ArchitecturePartitionError>
Creates an authoritative partition from architecture-authored static declarations.
This path exists for pre-materialization selection: it validates and consumes the canonical graph/unit declaration, state plan, boundary schema, local geometry, and parameter topology without constructing a backend module merely to rediscover those facts. Concrete backends must not synthesize any of these inputs.
Sourcepub const fn graph(&self) -> &ExecutionGraph
pub const fn graph(&self) -> &ExecutionGraph
Returns the canonical architecture execution graph.
Sourcepub const fn unit_layout(&self) -> &ExecutionUnitLayout
pub const fn unit_layout(&self) -> &ExecutionUnitLayout
Returns the canonical complete execution-unit layout.
Sourcepub fn groups(&self) -> &[PartitionGroup]
pub fn groups(&self) -> &[PartitionGroup]
Returns groups and group-local global unit ranges owned by this rank.
Sourcepub fn units(&self) -> impl Iterator<Item = ExecutionUnitAddress> + '_
pub fn units(&self) -> impl Iterator<Item = ExecutionUnitAddress> + '_
Traverses rank-owned execution units in canonical architecture order.
Sourcepub fn owns_unit(&self, group: &str, global_unit: usize) -> bool
pub fn owns_unit(&self, group: &str, global_unit: usize) -> bool
Returns whether this rank owns one group-local global unit.
Sourcepub const fn ownership(&self) -> &PartitionOwnership
pub const fn ownership(&self) -> &PartitionOwnership
Returns input, output, and static-module ownership.
Sourcepub const fn state(&self) -> Option<&PartitionState>
pub const fn state(&self) -> Option<&PartitionState>
Returns rank-local state geometry when this partition owns mutable state.
Sourcepub fn prompt_cache_identity<B, M>(
&self,
architecture: &M,
topology: PromptCacheTopology,
) -> Result<PromptCacheModelIdentity, ArchitecturePartitionError>
pub fn prompt_cache_identity<B, M>( &self, architecture: &M, topology: PromptCacheTopology, ) -> Result<PromptCacheModelIdentity, ArchitecturePartitionError>
Derives prompt-cache identity from this partition’s canonical state.
Sourcepub fn resolve_state_partition(
&self,
complete: &StateLayout,
plan: &ArchitectureStatePartitionPlan,
) -> Result<Option<PartitionState>, ArchitectureStatePartitionError>
pub fn resolve_state_partition( &self, complete: &StateLayout, plan: &ArchitectureStatePartitionPlan, ) -> Result<Option<PartitionState>, ArchitectureStatePartitionError>
Resolves the architecture-authored state plan for this realized partition.
The current partition representation stores one contiguous global state interval. A valid plan may describe multiple semantic ranges, but the ranges selected by any one partition must be adjacent.
Sourcepub const fn local_geometry(&self) -> &G
pub const fn local_geometry(&self) -> &G
Returns family-owned rank-local construction geometry.
Sourcepub const fn boundary_schema(&self) -> &A
pub const fn boundary_schema(&self) -> &A
Returns the family-owned primary and auxiliary boundary schema.
Sourcepub fn boundary_schema_mut(&mut self) -> &mut A
pub fn boundary_schema_mut(&mut self) -> &mut A
Mutably returns the family-owned primary and auxiliary boundary schema.
Sourcepub fn parameter_bindings(&self) -> &[OwnedParameterGroupSpec]
pub fn parameter_bindings(&self) -> &[OwnedParameterGroupSpec]
Returns neutral semantic parameter bindings owned by this rank.
Sourcepub fn parameter_bindings_for_owner<'a>(
&'a self,
owner: &'a ParameterGroupOwner,
) -> impl Iterator<Item = &'a ParameterGroupSpec> + 'a
pub fn parameter_bindings_for_owner<'a>( &'a self, owner: &'a ParameterGroupOwner, ) -> impl Iterator<Item = &'a ParameterGroupSpec> + 'a
Returns the exact neutral groups assigned to one architecture owner.
Sourcepub fn validate_architecture<B, S, M>(
&self,
architecture: &M,
) -> Result<(), ArchitecturePartitionError>
pub fn validate_architecture<B, S, M>( &self, architecture: &M, ) -> Result<(), ArchitecturePartitionError>
Proves that this partition still describes the supplied concrete neutral architecture.
Loaders may use this when a partition crosses a backend boundary or is restored from a prepared plan. Both dependency edges and exact unit counts are compared; matching group names alone are insufficient.