pub trait ExecutionPlanBackendFactory: AutomaticPlanningBackend {
type Backend: ModelLoadingBackend;
type DrafterPreparation;
type SelectedDrafterPreparation;
type Drafter;
// Required methods
fn select_target(
&self,
inspection: &ArtifactInspection<<<Self::Backend as ModelLoadingBackend>::ConfigurationResolver as ModelConfigurationResolver>::ArtifactPlan>,
plan: &ExecutionPlan,
) -> Result<ExecutionPlanTargetSelection<Self::Backend>, AutomaticPlanningError>;
fn select_drafting(
&self,
plan: &ExecutionPlan,
target: &SelectedExecutionPlanTarget<Self::Backend>,
external_artifact: Option<ExternalDraftArtifact<Self::DrafterPreparation>>,
) -> Result<Option<ExternalDraftArtifact<Self::SelectedDrafterPreparation>>, AutomaticPlanningError>;
fn realize_target(
&self,
selected: SelectedExecutionPlanTarget<Self::Backend>,
) -> Result<ExecutionPlanTarget<Self::Backend>, AutomaticPlanningError>;
fn realize_drafting(
&self,
plan: &ExecutionPlan,
target: &ModelRuntime<Self::Backend>,
selected: SelectedExecutionPlanDrafting<Self::SelectedDrafterPreparation>,
) -> Result<RealizedDrafting<Self::Drafter>, AutomaticPlanningError>;
}Expand description
Selects and 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 authoritative
preparation selection before native resources exist, then to an owned
backend. Core verifies the neutral preparation and target identities.
Required Associated Types§
Sourcetype Backend: ModelLoadingBackend
type Backend: ModelLoadingBackend
Backend implementation created for the selected model/session.
Sourcetype DrafterPreparation
type DrafterPreparation
Architecture-owned inspected preparation supplied to cold assistant selection.
Sourcetype SelectedDrafterPreparation
type SelectedDrafterPreparation
Authoritative assistant materialization selection retained before native realization.
Required Methods§
Sourcefn select_target(
&self,
inspection: &ArtifactInspection<<<Self::Backend as ModelLoadingBackend>::ConfigurationResolver as ModelConfigurationResolver>::ArtifactPlan>,
plan: &ExecutionPlan,
) -> Result<ExecutionPlanTargetSelection<Self::Backend>, AutomaticPlanningError>
fn select_target( &self, inspection: &ArtifactInspection<<<Self::Backend as ModelLoadingBackend>::ConfigurationResolver as ModelConfigurationResolver>::ArtifactPlan>, plan: &ExecutionPlan, ) -> Result<ExecutionPlanTargetSelection<Self::Backend>, AutomaticPlanningError>
Selects the backend preparation without creating a native device or queue.
Sourcefn select_drafting(
&self,
plan: &ExecutionPlan,
target: &SelectedExecutionPlanTarget<Self::Backend>,
external_artifact: Option<ExternalDraftArtifact<Self::DrafterPreparation>>,
) -> Result<Option<ExternalDraftArtifact<Self::SelectedDrafterPreparation>>, AutomaticPlanningError>
fn select_drafting( &self, plan: &ExecutionPlan, target: &SelectedExecutionPlanTarget<Self::Backend>, external_artifact: Option<ExternalDraftArtifact<Self::DrafterPreparation>>, ) -> Result<Option<ExternalDraftArtifact<Self::SelectedDrafterPreparation>>, AutomaticPlanningError>
Selects external-assistant materialization without creating native resources.
This hook runs before Self::realize_target. It must retain the exact
physical inputs and lowering choices which the backend will later consume.
Sourcefn realize_target(
&self,
selected: SelectedExecutionPlanTarget<Self::Backend>,
) -> Result<ExecutionPlanTarget<Self::Backend>, AutomaticPlanningError>
fn realize_target( &self, selected: SelectedExecutionPlanTarget<Self::Backend>, ) -> Result<ExecutionPlanTarget<Self::Backend>, AutomaticPlanningError>
Backend hook which owns device/queue construction for an established selection.
Applications should call realize_execution_plan_target so portable
validation cannot be bypassed accidentally.
Sourcefn realize_drafting(
&self,
plan: &ExecutionPlan,
target: &ModelRuntime<Self::Backend>,
selected: SelectedExecutionPlanDrafting<Self::SelectedDrafterPreparation>,
) -> Result<RealizedDrafting<Self::Drafter>, AutomaticPlanningError>
fn realize_drafting( &self, plan: &ExecutionPlan, target: &ModelRuntime<Self::Backend>, selected: SelectedExecutionPlanDrafting<Self::SelectedDrafterPreparation>, ) -> 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, tokenizer loading, and architecture compatibility proof.
The backend binds only the already selected materialization, placement,
and mechanism resources.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".