Skip to main content

Module ranker

Module ranker 

Source
Expand description

Optimizer ranker (Picker 1) substrate — Phase 1.1 of the picker-work arc.

Builds the types + filter-chain pipeline the in-flight optimizer ranker will operate against. No SystemTopology integration, no candidate enumeration, no cost composition, no filter implementations — all of that lands in subsequent sub-phases:

Sub-phaseScope
1.1This module — AlternativeSet, Candidate, AlternativeFilter, chain
1.2Candidate enumeration via SystemTopology (cross co-located backends)
1.3Precision + tolerance hard filters (PrecisionGuarantee consumers)
1.4Cost ranking — Layer-1 static composition
1.5ExecutionPlan carries AlternativeSets; compile_plan integration

See docs/session-prompts/phase-1-1-alternative-set-filter-chain.md for the TDP resolutions and the full Phase 1 plan.

§The two pickers

Per the 2026-05-30 picker-alternatives audit, the architectural endpoint is two pickers with very different scopes:

  • Picker 1 — the optimizer ranker (this module’s eventual consumer). Plan-time machinery that enumerates candidates via SystemTopology, filters by hard correctness constraints, ranks survivors by composite cost (Layer-1 static + Layer-2 Judge data), and preserves the top-N per architecture v1.0 §04.
  • Picker 2 — the runtime selector. Dispatch-time component that reads pre-blessed AlternativeSets and selects among the top-N based on layer-3 telemetry, checking SystemTopology generation before each dispatch chunk.

Picker 1 lands across Phases 1–3; Picker 2 is Phase 5.

Re-exports§

pub use alternative_set::AlternativeSet;
pub use alternative_set::DecisionContext;
pub use alternative_set::KEEP_PER_DEVICE;
pub use candidate::Candidate;
pub use candidate::CouplingAdjustment;
pub use chain::apply_filter_chain;
pub use chained_selector::ChainedSelector;
pub use cost::CapabilitiesLookup;
pub use cost::TransferEstimator;
pub use cost::apply_inbound_transfer_costs;
pub use cost::composite_ns;
pub use cost::compute_static_costs;
pub use cost::default_backend_rates;
pub use cost_vector::AccuracyClass;
pub use cost_vector::CostVector;
pub use cost_vector::MemoryTiers;
pub use cost_vector::PrecisionDigits;
pub use device_load::DeviceLoadSelector;
pub use device_load::LOAD_TIER_IDLE;
pub use device_load::LOAD_TIER_MODERATE;
pub use device_load::LOAD_TIER_SATURATED;
pub use device_load::LoadLookup;
pub use device_load::MockBackendStreams;
pub use device_load::MockCombinedRuntime;
pub use device_load::load_tier;
pub use device_load::load_tier_for;
pub use device_load::mock_combined_lookup;
pub use device_load::mock_load_lookup;
pub use enumerate::enumerate_candidates;
pub use filter::AlternativeFilter;
pub use filter::FilterClass;
pub use filter::FilterContext;
pub use filters::AccuracyBound;
pub use filters::AccuracyPreferenceFilter;
pub use filters::DEFAULT_ACCURACY_BOUND;
pub use filters::PrecisionFloorFilter;
pub use filters::PrecisionRequirement;
pub use filters::StridedInputPreferenceFilter;
pub use filters::default_chain;
pub use judge::HashMapJudge;
pub use judge::JudgeOracle;
pub use judge_aware_selector::JudgeAwareSelector;
pub use placement_dp::ChainInput;
pub use placement_dp::PlacementDp;
pub use route_picker::LOOKAHEAD_K;
pub use route_picker::RouteCache;
pub use route_picker::TelemetryFingerprint;
pub use route_picker::pick_route;
pub use route_picker::resolve_branch;
pub use runtime_selector::RuntimeSelector;
pub use runtime_selector::WinnerSelector;
pub use vram_pressure_selector::BackendRuntimeHandle;
pub use vram_pressure_selector::BackendRuntimeLookup;
pub use vram_pressure_selector::OutputBytesEstimator;
pub use vram_pressure_selector::VramPressureSelector;
pub use vram_pressure_selector::default_estimate_output_bytes;

Modules§

alternative_set
AlternativeSet — bounded collection of Candidates at one graph decision point.
candidate
Candidate — one (kernel, placement, precision, cost) bundle that the optimizer ranker is considering at a graph decision point.
chain
Filter-chain pipeline: applies an ordered list of AlternativeFilters to an AlternativeSet, respecting each filter’s FilterClass.
chained_selector
ChainedSelector — the production Picker 2 composition: VRAM-pressure GUARD → Judge-measured RANK → static-winner fallback.
cost
Cost composition + ranking for the picker. Phase 1.4 of the picker-work arc.
cost_vector
CostVector — the per-path cost VECTOR the rankers produce, and the Pareto-dominance relation over it.
device_load
DeviceLoadSelector + the load_tier bucketing — Step E Phase C, PR C2: the live-load arm re-pick.
enumerate
Candidate enumeration — walk the binding table for each (BackendId, DeviceLocation) placement the caller hands in and produce an AlternativeSet populated with one Candidate per registered alternative.
filter
AlternativeFilter trait + FilterClass + FilterContext.
filters
Concrete AlternativeFilter implementations shipped in Phase 1.3 of the picker-work arc.
judge
JudgeOracle — abstraction over the Phase 6b empirical profiler for the cost composer’s Layer-2 refinement.
judge_aware_selector
JudgeAwareSelector — Phase 5.2 runtime selector that re-queries the JudgeOracle at dispatch time and re-ranks candidates by fresh empirical measurements.
placement_dp
Carry-forward placement DP — planner Stage 3 (docs/session-prompts/load-time-incremental-planner.md, architecture 04-optimization §Load-time incremental planning, design pillars 3+4).
profile_oracle
ProfileJudgeOracle — the concrete JudgeOracle over the Judge’s measured profile data.
route_picker
The runtime route picker (“Picker 2”) — selects an arm at each Op::Branch decision point by live telemetry.
runtime_selector
RuntimeSelector — Picker 2 substrate.
vram_pressure_selector
VramPressureSelector — Phase 5.2 runtime selector that demotes or skips candidates whose backend can’t fit the projected output at dispatch time.