fuel_dispatch/ranker/mod.rs
1// SPDX-License-Identifier: MIT OR Apache-2.0
2//! Optimizer ranker (Picker 1) substrate — Phase 1.1 of the
3//! picker-work arc.
4//!
5//! Builds the types + filter-chain pipeline the in-flight optimizer
6//! ranker will operate against. No SystemTopology integration, no
7//! candidate enumeration, no cost composition, no filter
8//! implementations — all of that lands in subsequent sub-phases:
9//!
10//! | Sub-phase | Scope |
11//! |-----------|------------------------------------------------------------------------|
12//! | **1.1** | This module — `AlternativeSet`, `Candidate`, `AlternativeFilter`, chain |
13//! | 1.2 | Candidate enumeration via SystemTopology (cross co-located backends) |
14//! | 1.3 | Precision + tolerance hard filters (`PrecisionGuarantee` consumers) |
15//! | 1.4 | Cost ranking — Layer-1 static composition |
16//! | 1.5 | `ExecutionPlan` carries `AlternativeSet`s; `compile_plan` integration |
17//!
18//! See `docs/session-prompts/phase-1-1-alternative-set-filter-chain.md`
19//! for the TDP resolutions and the full Phase 1 plan.
20//!
21//! # The two pickers
22//!
23//! Per the 2026-05-30 picker-alternatives audit, the architectural
24//! endpoint is *two* pickers with very different scopes:
25//!
26//! - **Picker 1 — the optimizer ranker (this module's eventual
27//! consumer).** Plan-time machinery that enumerates candidates via
28//! SystemTopology, filters by hard correctness constraints, ranks
29//! survivors by composite cost (Layer-1 static + Layer-2 Judge
30//! data), and preserves the top-N per architecture v1.0 §04.
31//! - **Picker 2 — the runtime selector.** Dispatch-time component
32//! that reads pre-blessed `AlternativeSet`s and selects among the
33//! top-N based on layer-3 telemetry, checking SystemTopology
34//! generation before each dispatch chunk.
35//!
36//! Picker 1 lands across Phases 1–3; Picker 2 is Phase 5.
37
38pub mod alternative_set;
39pub mod candidate;
40pub mod chain;
41pub mod chained_selector;
42pub mod cost;
43pub mod cost_vector;
44pub mod device_load;
45pub mod enumerate;
46pub mod filter;
47pub mod filters;
48pub mod judge;
49pub mod judge_aware_selector;
50pub mod placement_dp;
51pub mod profile_oracle;
52pub mod route_picker;
53pub mod runtime_selector;
54pub mod vram_pressure_selector;
55
56pub use alternative_set::{AlternativeSet, DecisionContext, KEEP_PER_DEVICE};
57pub use candidate::{Candidate, CouplingAdjustment};
58pub use chain::apply_filter_chain;
59pub use chained_selector::ChainedSelector;
60pub use cost::{
61 CapabilitiesLookup, TransferEstimator, apply_inbound_transfer_costs, composite_ns,
62 compute_static_costs, default_backend_rates,
63};
64pub use cost_vector::{AccuracyClass, CostVector, MemoryTiers, PrecisionDigits};
65pub use device_load::{
66 DeviceLoadSelector, LOAD_TIER_IDLE, LOAD_TIER_MODERATE, LOAD_TIER_SATURATED, LoadLookup,
67 MockBackendStreams, MockCombinedRuntime, load_tier, load_tier_for, mock_combined_lookup,
68 mock_load_lookup,
69};
70pub use enumerate::enumerate_candidates;
71pub use filter::{AlternativeFilter, FilterClass, FilterContext};
72pub use filters::{
73 AccuracyBound, AccuracyPreferenceFilter, DEFAULT_ACCURACY_BOUND, PrecisionFloorFilter,
74 PrecisionRequirement, StridedInputPreferenceFilter, default_chain,
75};
76pub use judge::{HashMapJudge, JudgeOracle};
77pub use judge_aware_selector::JudgeAwareSelector;
78pub use placement_dp::{ChainInput, PlacementDp};
79pub use route_picker::{LOOKAHEAD_K, RouteCache, TelemetryFingerprint, pick_route, resolve_branch};
80pub use runtime_selector::{RuntimeSelector, WinnerSelector};
81pub use vram_pressure_selector::{
82 BackendRuntimeHandle, BackendRuntimeLookup, OutputBytesEstimator, VramPressureSelector,
83 default_estimate_output_bytes,
84};