inire/docs/architecture.md

5.7 KiB

Router architecture

route() uses the same worker to search, replay seeds, and verify paths. An explicit mode configures the worker directly. Automatic routing sets a coverage target and tries different plans or worker settings.

Automatic routing

Automatic routing sets a target for the number of verified nets and tries several ways to reach it. The router selects and optionally refines its best layout before returning a result for each net.

Follow the left column while coverage is below the target. Reaching the target skips the remaining attempts. If the attempts run out, the router selects the best layout it verified.

  1. Set a coverage target. Conflicting aligned port faces and track capacity at rectangular cuts can bound how many nets fit.
  2. Try constructive plans. Bundles assign ordered tracks, columns schedule turns, and compact planners fit short links. Each plan supplies seeds for the worker to verify.
  3. Search for missing routes. Early attempts use small budgets and can hold verified routes fixed. When a column plan stalls, try separated channels or a shared bypass around the keepouts. If the locks cut off a port, retry with movable seeds or different lanes. With one net left, try a verified detour around the locked paths, including incumbents found by the seed fallback. Lattice search handles custom outlines or proxies and is the fallback when corridor planning is unavailable.
  4. Select and refine. Prefer higher verified coverage. Compare cost on matching verified net IDs. Refinement can replace the selected layout only if those IDs remain verified.

Example of a poor lock

Holding the straight trunk fixed in stress-retry-straight-decoy blocks both vertical routes. The residual-dogleg stage finishes the trunk with a four-turn detour, bringing coverage to four out of four. When changing lock ordering, check which stage finishes the trunk.

Detailed search and congestion

  • Propose moves. Weighted A* searches snapped positions and headings. Rays, corners, and corridor waypoints suggest straight endpoints. Admission checks the footprint, cost, and state dominance.
  • Prune histories. The closed set groups arrivals by position and heading. Paths with different final straights or footprints can have different valid continuations, so pruning can discard an alternative.
  • Recheck installed paths. A later route can conflict with one installed earlier. After each iteration, the driver rechecks the installed set and ranks snapshots by completed nets, then conflicts and dynamic collisions.
  • Repair small conflict sets. After restoring the best iteration, try rerouting up to two isolated pairs against the routes held fixed.

Geometry and refinement

  • Replay. Results carry the requested net and the effective net with resolved ports. Seed replay builds physical geometry from the effective start port using the same endpoint and bend calculations as search.
  • Verify. Search uses collision proxies. Verification checks the physical polygons against the board, keepouts, and other paths. In zero-node replay, verify each path's own geometry first, then add cross-net conflicts. Fixed polygons retain their vertices and enter geometric operations at full coordinate precision.
  • Refine. Try replacing sections with at least four quarter turns. Rank detours before building their polygons and verify the complete updated layout.

Validate a change

If you change What to check Where to start
Worker setup or seed replay Resolved ports and path geometry after replay. Worker entry point, placement recipes
Stage order or budgets Which stage wins and whether work reappears in a later attempt. Include tight passages and preplaced crossings. Constructive trials, search trials
Locks or candidate acceptance The verified IDs and their paths after the complete layout is checked. Direct trials, trial selection
Corridor or seed allocation Coverage through shared openings and search work when a corridor reaches the wrong lane or leaves too little turn room. Corridor planning and realization
Moves or reroute scheduling Which moves reach admission and which nets are retried. Move generation, reroute scheduling
Collision or caching Clearance and boundary decisions for both physical and proxy shapes. Compare candidate counts and exact checks along with time. Physical checks, work counters
Pair-local repair Coverage and conflict edges before repair, plus the final installed geometry. Pair-local search, pair repair trace
Cost or refinement Per-net costs on equal verified ID sets and validity after the final check. Path refinement, refinement handoff

Use benchmark profiles for policy comparisons and exact parity for behavior-preserving changes.