Skip to main content

fastest_on_the_twin

Function fastest_on_the_twin 

Source
pub fn fastest_on_the_twin(
    p: &SpatialProgram,
    target: &SpatialTarget,
) -> Option<Candidate>
Expand description

★ ON A TARGET WHOSE TIME IS EXACT, THE PLANNER TIMES ITS CANDIDATES. The fabric’s cycle twin (fabric_cycles_within) is cycle-exact against its RTL, so the planner builds candidates in the work model’s order and times each one, and the fastest is the plan. A model stands in for time only where nothing can measure it; on the fabric every engine change would otherwise leave the model choosing a plan the twin can show is slower.

The timing is bounded and deterministic: the candidates share TWIN_PLANNING_CYCLES cycles of simulation, each one stopping once it is slower than the fastest so far — it can no longer win — so a program small enough for the fabric is timed through every candidate, and a large one is timed through as many of the model’s best as the budget reaches. Only the fastest timed candidate is certified, and the first that certifies is the plan.

None on every other target — the fabric’s lowering is the one that states its local memory’s read latency — and where no candidate builds and finishes within the budget.