pub trait ExecutionPlanBackendFactory: AutomaticPlanningBackend {
type Backend: ModelLoadingBackend;
type DrafterPreparation;
type Drafter;
// Required methods
fn realize_target(
&self,
plan: &ExecutionPlan,
) -> Result<ExecutionPlanTarget<Self::Backend>, AutomaticPlanningError>;
fn realize_drafting(
&self,
plan: &ExecutionPlan,
target: &ModelRuntime<Self::Backend>,
external_artifact: Option<ExternalDraftArtifact<Self::DrafterPreparation>>,
) -> Result<RealizedDrafting<Self::Drafter>, AutomaticPlanningError>;
}Expand description
Creates an executable whole-model backend from a portable execution plan.
This deliberately operates above tensor primitives. An implementation maps
one complete DevicePlan and ExecutionPlan to an owned backend and
its opaque load policy. Core then verifies backend identity, selected-device
identity, structural plan invariants, and fail-closed capabilities.
Required Associated Types§
Sourcetype Backend: ModelLoadingBackend
type Backend: ModelLoadingBackend
Backend implementation created for the selected model/session.
Sourcetype DrafterPreparation
type DrafterPreparation
Architecture-owned preparation consumed by assistant materialization.
Required Methods§
Sourcefn realize_target(
&self,
plan: &ExecutionPlan,
) -> Result<ExecutionPlanTarget<Self::Backend>, AutomaticPlanningError>
fn realize_target( &self, plan: &ExecutionPlan, ) -> Result<ExecutionPlanTarget<Self::Backend>, AutomaticPlanningError>
Backend hook which owns device/queue construction and plan translation.
Applications should call realize_execution_plan_target so portable
validation cannot be bypassed accidentally.
Sourcefn realize_drafting(
&self,
plan: &ExecutionPlan,
target: &ModelRuntime<Self::Backend>,
external_artifact: Option<ExternalDraftArtifact<Self::DrafterPreparation>>,
) -> Result<RealizedDrafting<Self::Drafter>, AutomaticPlanningError>
fn realize_drafting( &self, plan: &ExecutionPlan, target: &ModelRuntime<Self::Backend>, external_artifact: Option<ExternalDraftArtifact<Self::DrafterPreparation>>, ) -> Result<RealizedDrafting<Self::Drafter>, AutomaticPlanningError>
Realizes the plan’s complete drafting mode against a prepared target session.
external_artifact is present exactly for DraftingPlan::External.
It is assembled by the portable facade, which owns architecture
inspection and tokenizer loading, while the backend owns only assistant
materialization, placement, and architecture compatibility validation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".