Skip to main content

eredu_runtime/
lib.rs

1//! Backend-neutral model execution contracts and algorithms.
2//!
3//! This crate orchestrates opaque backend-native values. It deliberately has
4//! no dependency on an architecture implementation or execution backend.
5
6#![warn(missing_docs)]
7
8/// Backend execution, parameter, transfer, and collective capabilities.
9pub mod backend;
10/// Backend-neutral mutable-cache ownership, storage, and admission algorithms.
11pub mod cache;
12/// Typed multimodal component graphs and residency accounting.
13pub mod component;
14/// Backend-neutral sequential prediction decisions and layered handoff.
15pub mod decision;
16/// Backend-neutral dense-stream residency telemetry.
17pub mod dense;
18/// Backend-neutral speculative-state fork, commit, and rollback ownership.
19pub mod draft;
20/// Portable execution-group topology and scheduling state.
21pub mod execution;
22pub mod expert;
23/// Backend-neutral causal-model and token-sampling contracts.
24pub mod generation;
25/// Backend-neutral ownership of prepared multimodal tensors.
26pub mod input;
27pub mod inspection;
28/// Statically dispatched layered architecture lifecycle and resident policy.
29pub mod layered;
30/// Architecture-declared parallel parameter semantics and local layouts.
31pub mod parallel;
32/// Neutral checkpoint materialization and stable parameter binding.
33pub mod parameter;
34/// Backend-neutral rank-local architecture ownership.
35pub mod partition;
36/// Backend-neutral bounded background weight-prefetch execution.
37pub mod prefetch;
38/// Atomic realtime model, schedule, sampler, and random-state transactions.
39pub mod realtime;
40/// Selection contracts for replicated text architectures.
41pub mod replicated_text;
42/// Backend-neutral immutable-weight residency declarations and orchestration.
43pub mod residency;
44/// Backend-neutral speculative request lifecycle and fair scheduling.
45pub mod speculative;
46/// Architecture-declared mutable state and concrete runtime realizations.
47pub mod state;
48mod weight_residency;
49
50pub use backend::{CollectiveBackend, ParameterBackend, SubmissionBackend, TransferBackend};
51pub use cache::{
52    finalize_prompt_cache_shard, hash_prompt_cache_shard_payload, inspect_prompt_cache,
53    resolve_prompt_cache_root, safe_prompt_cache_shard_path, validate_prompt_cache_manifest,
54    CacheBlockLifecycle, CacheBlockStorage, CacheHostDemotionOperation, CacheHostPromotion,
55    CacheIoAdmission, CacheIoCompletionDisposition, CacheIoExecutionState,
56    CacheIoExecutionStateError, CacheIoOperation, CacheIoOperationKey, CacheIoOperationKind,
57    CacheIoPreparation, CacheIoStartDisposition, CacheIoSubmission, CacheIoSubmissionOutcome,
58    CacheIoTicket, CacheIoWorker, CacheIoWorkerError, CacheLayerResidencyReport,
59    CacheLayerResidencyStats, CacheLifecycleError, CachePoolError, CachePoolLimits,
60    CachePoolMembership, CachePoolReport, CachePoolReservation, CachePoolResource, CachePoolUsage,
61    CacheResidencyConfigurationError, CacheResidencyPolicy, CacheResidencyPool,
62    CacheResidencyReport, CacheResidencyTelemetry, CacheStorageError, CacheStoragePhase,
63    LiveCacheBlockPublication, LiveCacheDiskPolicy, LiveCachePublicationError, MutableCacheTail,
64    PagedCacheOptions, PromptCachePersistenceError, PromptCachePublication,
65    CACHE_RESIDENCY_LAYER_REPORT_LIMIT, MAX_PROMPT_CACHE_SHARD_HEADER_BYTES,
66    PROMPT_CACHE_CURRENT_FILE, PROMPT_CACHE_GENERATIONS_DIRECTORY,
67};
68pub use component::{
69    ComponentDomain, ComponentGraph, ComponentGraphError, ComponentKind, ComponentResidencyClass,
70    ComponentSpec,
71};
72pub use decision::{
73    FullyForcedTailDecision, PredictionDirective, SequentialDecision, SequentialDecisionBoundary,
74    SequentialDecisionDiagnostic, SequentialDecisionDriver, SequentialDecisionError,
75    SequentialDecisionMode, SequentialDecisionPlan, SequentialDecisionPlanError,
76    SequentialDecisionSource, SequentialDecisionTraversal, SequentialSamplingState,
77};
78pub use dense::{
79    DenseCacheMetrics, DenseDiskStreamReport, DenseExecutionGroupReport, DensePassCounterSnapshot,
80    DensePassReport, DenseStreamTelemetry, DenseStreamTelemetryError, DenseTierResidencyReport,
81};
82pub use draft::{execute_draft_group, DraftGroupExecutionError, DraftStateTransaction};
83pub use execution::{
84    ExecutionGraph, ExecutionGraphError, ExecutionGroupId, ExecutionGroupSchedule,
85    ExecutionGroupSpec, ExecutionScheduleError, ExecutionUnitAddress, ExecutionUnitLayout,
86    ExecutionUnitLayoutError, ReadyGroupState,
87};
88pub use expert::{
89    combine_routed_expert_tensor_parallel, combine_tensor_parallel_expert_outputs,
90    reduce_routed_expert_tensor_parallel, reduce_tensor_parallel_expert_output,
91    AddressableGatedProductBank, ObservedExpertProvider, ObservedExpertProviderError,
92    ResidentExpertProvider, RoutedExpertProvider, RoutedExpertRequest,
93    RoutedExpertTensorParallelOutput, RoutedObservationPoint, TensorParallelRoutedExpertProvider,
94};
95pub use generation::{
96    CausalModel, ConstrainedSampler, DefaultSampler, GenerationSampler, MirostatV2Sampler,
97    PenaltyConfig, Sampler, SamplingBackend, SamplingConfigurationError, SpeculativeSampler,
98    TokenDomain,
99};
100pub use input::{PreparedInputPart, PreparedInputPayload, PreparedModelInput};
101pub use inspection::{
102    observe_and_intervene, observe_model_logits, ActivationObserver, NoopObserver,
103    RoutingObservation, TargetStateCapture, TargetStateCaptureError, TargetStateTap,
104};
105pub use layered::{
106    ArchitectureGroupKind, ArchitectureGroupPlacement, ArchitectureGroupTransport,
107    ArchitectureMergeDestination, ArchitectureParallelSubgroup, ArchitectureParameters,
108    CompositeLayeredTraversalHook, LayeredArchitecture, LayeredForwardState, LayeredPartitionInput,
109    LayeredPartitionOutput, LayeredPipelineSchedule, LayeredPipelineScheduleError,
110    LayeredTraversalHook, LayeredTraversalPoint, LayeredUnitAction, LayerwiseAcquireError,
111    LayerwisePolicy, LayerwiseRuntime, LayerwiseRuntimeError, ParallelLayeredArchitecture,
112    ParallelRoutedLayeredArchitecture, PartitionedLayeredArchitecture, ResidentRuntime,
113    ResidentUnitWindow, ResidentUnitWindowError, RoutedLayeredArchitecture, StaticParameterVisitor,
114    StaticParameterVisitorMut,
115};
116pub use parallel::{
117    aligned_partition_units, expand_linear_format_parameter_groups, module_parameter_group,
118    partitioned_module_parameter_group, partitioned_projection_group, projection_parameter_group,
119    segmented_projection_group, LocalModelLayout, LocalTensorLayout, MemberSharding,
120    ParallelModelInfo, ParallelPlanError, ParameterGroupSpec, ParameterMemberSpec, ParameterRole,
121    ProjectionSharding, ShardingPolicy, TensorPlacement,
122};
123pub use parameter::{
124    bind_materialized_unit, bindings_from_recipe_set, materialize_bindings, MaterializedUnit,
125    ParameterOrchestrationError, RecipeBindingError,
126};
127pub use partition::{
128    validate_boundary_tensor_count, ArchitectureBoundary, ArchitectureBoundaryError,
129    ArchitectureParameterDescription, ArchitectureParameterError, ArchitecturePartition,
130    ArchitecturePartitionError, BoundaryTensorDimension, BoundaryTensorDtype, BoundaryTensorSpec,
131    BoundaryWireSchema, LayeredPartitionDriver, LayeredPartitionError, NoAuxiliaryBoundary,
132    NoAuxiliaryBoundarySchema, OwnedParameterGroupSpec, ParameterGroupOwner, PartitionGroup,
133    PartitionOwnership, PartitionState, PipelineActivationDtype, PipelineWireContract,
134    ResolvedBoundaryTensorSpec, ResolvedBoundaryWireSchema,
135};
136pub use prefetch::{BackgroundPrefetchWorker, BackgroundPrefetchWorkerError};
137pub use realtime::{
138    RealtimeCompletionAttachmentError, RealtimeFrameExecutionError, RealtimeFrameTransition,
139    RealtimeGenerationBranch, RealtimeGenerationState, RealtimeGenerationTransactionError,
140};
141pub use replicated_text::{
142    select_replicated_text_realization, BackendMechanismCapabilities, GroupedOperationRequirement,
143    ParameterTransformConstraint, ParameterTransformTarget, ReplicatedTextArchitecture,
144    ReplicatedTextContractError, ReplicatedTextParameterOwner, ReplicatedTextParameterPresence,
145    ReplicatedTextParameterRequirement, ReplicatedTextParameterRole, ReplicatedTextPhysicalSource,
146    ReplicatedTextRequirements, ReplicatedTextSelectionError, ReplicatedTextSelectionRequest,
147    SelectedParameterRealization, SelectedReplicatedTextRealization, StateResidencyMechanism,
148    WeightLoweringCapability, WeightLoweringDescriptor, WeightLoweringKind,
149    WeightResidencyMechanism,
150};
151pub use residency::{
152    DeviceLayerWindow, OffloadUnit, ResidencyAcquisition, ResidencyController,
153    ResidencyControllerError, ResidencyDeclarationError, ResidencyLease, ResidencyLeaseOwner,
154    ResidencyLeaseStorage, ResidencyReport, ResidencyTransfer, ResidencyTransferOwner,
155    ResidencyWindowError, ResidencyWindowManager, ResidentLayerGroup, ResidentLayerGroupReport,
156    WeightBinding, WeightBindingPlan, WeightBindingSelectionError, WeightMaterializationReport,
157};
158pub use speculative::{RunSpeculativeGeneration, SpeculativeScheduler};
159pub use state::{
160    realize_architecture_state, ArchitectureStateFactory, ArchitectureStatePartitionError,
161    ArchitectureStatePartitionPlan, ArchitectureStatePartitionRule, ArchitectureStatePlacement,
162    ArchitectureStateRealizationError, DeviceState, LayerRuntimeState, ModelStateIdentity,
163    ResettableRuntimeLayerState, ResettableRuntimeState, RuntimeLayerState, RuntimeState,
164    RuntimeStateComponents, StateError, StateLayout, StateSegmentId, StateSegmentLifetime,
165    StateSegmentSpec, DEFAULT_STATE_SEGMENT_ID,
166};
167pub use weight_residency::{
168    DenseDiskStreamLoadOptions, DenseTransferSchedule, DenseTransferScheduleError,
169    ExecutionResidency, ExpertPass, LayerWeightResidency, LayerwiseLoadOptions,
170    LayerwiseModelMetadata, OrdinaryWeightResidency, ParameterBankKey, ParameterBankLoadOptions,
171    ParameterBankResidency, StaticUnitBindings, WeightResidency, WeightResidencyPolicyError,
172    DENSE_TRANSFER_WINDOW,
173};