Make routing documentation task-oriented
This commit is contained in:
parent
2b02c6eae9
commit
24559bb6aa
1 changed files with 142 additions and 140 deletions
|
|
@ -1,56 +1,50 @@
|
|||
# Topological routing and benchmarks
|
||||
|
||||
[`guide`](../DOCS.md#topological-routing) suggests corridors to the lattice router. `seed` also tries to turn those corridors into verified starting routes. The default automatic policy combines constructive layouts, corridor search, and lattice retries. [Automatic stage order](architecture.md#automatic-routing)
|
||||
Use this guide to decide whether a routing problem needs better corridors, better detailed moves, or a different retry order. If you are choosing an option for your own layout, start with the [routing modes](../DOCS.md#topological-routing).
|
||||
|
||||
## Corridor planning and realization
|
||||
|
||||
1. **Build free space.** Inset the board by half the widest net's width. Expand each obstacle by that half-width plus clearance. Constrained Delaunay triangles cover the remaining space. Shared edges connect the triangles and serve as portals. Attach a port using a short lead along its heading when space permits.
|
||||
2. **Choose corridors and lanes.** Rank alternative portal sequences using distance, existing occupancy, and estimated overflow. Sample lanes across each portal using the estimated track pitch. Prefer lanes with room to turn and penalize routes that approach another net's port lead or reservation. A joint retry can vary the lanes for several residual nets sharing a portal.
|
||||
3. **Realize physical paths.** The lane sketch supplies candidate endpoints and lateral offsets for straight and S-bend moves. In guide mode, the worker can leave the corridor and pay a soft cost. Seed mode uses bounded search to realize alternative corridors and gives the first corridor at least half the per-net seed budget when alternatives exist. Seed realization checks physical geometry against obstacles and earlier seeds.
|
||||
4. **Complete and verify.** The first detailed iteration respects installed corridor paths as blockers. Later iterations can negotiate overlaps and try alternative guides. Reached-target routes reserve routing space during corridor-based search. Partial routes remain available in the result. Refinement and final verification use the detailed router.
|
||||
1. **Find connected space for centerlines.** Inset the board by half the widest net's width and expand obstacles by that half-width plus clearance. Shared edges of a constrained Delaunay triangulation act as portals. A short lead tries to attach each terminal to the mesh along its heading. Using the widest net gives the planner a common representation. Narrower nets may still find a path in lattice search through a passage this mesh excludes.
|
||||
2. **Choose a passage and a lane.** Rank portal sequences by distance, occupancy, and estimated overflow. Use lane samples and estimated turn room to select where to cross each portal without crowding another net's access. A different lane through the same portal can make space for a turn. Joint retries use that distinction to revise a shared passage assignment.
|
||||
3. **Turn the sketch into a path.** Guide mode adds soft costs and move suggestions, so detailed search can leave an awkward corridor. Seed mode first tries to find a physical path inside a corridor and verifies it against obstacles and earlier seeds. It gives the first corridor at least half the per-net budget when there are alternatives. Later detailed iterations can move an incumbent or try another guide. Final verification checks the actual routed geometry.
|
||||
|
||||
Corridor widths and turn room are estimates. The ordinary verifier checks the actual routed components. The mesh and lane logic live in [`_topology.py`](../inire/router/_topology.py). [Curvilinear detailed routing](https://websrv.cecs.uci.edu/~papers/compendium94-03/papers/1998/aspdac98/pdffiles/06c_3.pdf) · [LiDAR 2.0](https://scopex-asu.github.io/files/publications/PD_TCAD2025_LiDARv2.pdf)
|
||||
When debugging `guide` or `seed`, use the explicit mode so you can inspect that worker's `run.topology`. If a net has no corridor, check port access, mesh padding, and which passages remain connected. If it has a corridor and seed realization uses the budget without finishing, check the port headings and the space to turn at each portal. When seeds reach their targets and the final paths still overlap, inspect lane order and congestion before adding seed nodes. [Mesh and lane allocation](../inire/router/_topology.py) · [Trace guide](routing-diagnostics.md#traces)
|
||||
|
||||
For the design background on routing through shared triangle edges and on constraints specific to photonic waveguides, see the earlier detailed-routing work. [Curvilinear detailed routing](https://websrv.cecs.uci.edu/~papers/compendium94-03/papers/1998/aspdac98/pdffiles/06c_3.pdf) · [LiDAR 2.0](https://scopex-asu.github.io/files/publications/PD_TCAD2025_LiDARv2.pdf)
|
||||
|
||||
## Benchmark corpus
|
||||
|
||||
| `--case` | Boards | Coverage |
|
||||
| --- | ---: | --- |
|
||||
| `all` | 37 | Original layouts with shared gates, ordered tracks, detours, and Terminal-Bench variants. |
|
||||
| `broad` | 16 | Four earlier holdouts, six fallback cases with caller seeds or custom geometry, and six imported layouts. |
|
||||
| `crossings` | 4 | Fixed crossing devices with separate external nets and accessible ports. |
|
||||
| `stress` | 10 | Known-feasible layouts with folded returns, competing locks, tight turns, and shared passages. |
|
||||
| `corpus` | 67 | All groups above. The correctness suite checks expected coverage and bounds at the corpus-regression budget. |
|
||||
| `retry-holdout` | 10 | Additional unseeded layouts with 63 nets across return shelves, crossing detours, and competing trunks. |
|
||||
| What you are changing | Select with `--case` |
|
||||
| --- | --- |
|
||||
| Placement and ordered-track planners | `all` covers the original layouts, including shared gates, detours, and Terminal-Bench variants. |
|
||||
| Fallbacks, seed handling, or bend geometry | `broad` includes caller seeds, custom bends, imported layouts, and the first holdout set. |
|
||||
| Device access and short links | `crossings` routes external legs to preplaced crossing cells. Check that changes keep the ports accessible. |
|
||||
| Lock ordering, aperture allocation, or turn limits | `stress` covers known-feasible folded returns, competing locks, tight turns, and shared passages. |
|
||||
| Overall routing coverage | `corpus` combines these four groups. The correctness suite checks expected coverage and bounds with `corpus-regression`. |
|
||||
| A retry tuned on the regression corpus | `retry-holdout` adds related but previously unseen layouts, including return shelves and crossing bypasses. It can expose a trigger that works on one fixture and wastes time on a close variant. |
|
||||
|
||||
The fixture harness verifies authored witness paths independently of the timed runs. The fixed-crossing inputs include only the routed external legs. Internal paths belong to the placed devices. The two partial boards in the 67-board corpus reach their geometric bounds. The overloaded gate routes three of four nets through a three-track opening. The imported LiDAR Clements layout routes three of six nets at its required clearance because three disjoint pairs of fixed ports conflict. [Fixture groups](../inire/tests/routing_corpus.py)
|
||||
Use a verified witness to establish feasibility without supplying its paths to the timed run. For intentionally overconstrained layouts, compare against the proven bound. The overloaded gate tests limited passage capacity, while the imported LiDAR Clements layout tests disjoint conflicts between fixed ports. More search cannot exceed either bound at the same geometry. [Fixture groups](../inire/tests/routing_corpus.py)
|
||||
|
||||
### Reproduce a comparison
|
||||
|
||||
`public-defaults` keeps fixture geometry and uses the public budgets and objective. `corpus-regression` uses 500 search nodes, 500 seed nodes, and three configured congestion iterations. `matched-budget` uses 500 search nodes and two configured congestion iterations by default and accepts CLI overrides. The two budget profiles use benchmark weights for automatic candidate selection.
|
||||
Choose `public-defaults` to measure the behavior users get from the public policy with the fixture geometry. Choose `corpus-regression` to reproduce the test budget of 500 search nodes, 500 seed nodes, and three configured congestion iterations. Use `matched-budget` to isolate routing-mode differences with the same configured budget. It defaults to 500 search nodes and two configured iterations and accepts overrides. The two budget profiles use benchmark weights for automatic candidate selection.
|
||||
|
||||
`offset-gates` is a small check for whether a corridor helps detailed search. At the reduced budget below, `guide` completes the net with no corridor seed. `seed` also completes it at the same cost. That comparison shows that guidance alone is enough on this fixture. Use it to check a change to corridor hints before spending time tuning seed allocation.
|
||||
|
||||
```sh
|
||||
python -m scripts.compare_topological_routing --list
|
||||
python -m scripts.compare_topological_routing --case corpus --profile corpus-regression \
|
||||
--mode automatic --repeat 3 --json /tmp/inire-corpus.json
|
||||
python -m scripts.compare_topological_routing --case crossings --profile matched-budget \
|
||||
--mode off --mode guide --mode seed --mode automatic --repeat 3 \
|
||||
python -m scripts.compare_topological_routing --case offset-gates --profile matched-budget \
|
||||
--mode off --mode guide --mode seed --nodes 100 --repeat 3 \
|
||||
--json /tmp/inire-modes.json
|
||||
```
|
||||
|
||||
Compare verified IDs and bounds before cost. The benchmark-weighted score multiplies physical straight, 90-degree bend, and S-bend lengths by 1, 4, and 13. Native cost uses the run's objective. A* expansions count work across attempts, including warm starts and seed realization. Compare paired timings under the same profile and worker count. [Metrics and parity tools](routing-diagnostics.md)
|
||||
Check verified IDs and bounds first. A lower total cost can result from dropping a net. Compare the benchmark-weighted score when judging length by component type and native cost when judging the run's configured objective. The benchmark weights physical lengths of straight, 90-degree bend, and S-bend segments by 1, 4, and 13. Compare paired timings under the same profile and worker count. [Metrics and parity tools](routing-diagnostics.md)
|
||||
|
||||
## Probe budget and coverage
|
||||
|
||||
The default near-port stage for arc proxies uses at most two congestion iterations. On the 77-board comparison, the cap preserved the exact paths, verified net IDs, and costs in both profiles. Alternate bend proxies retain their configured probe iteration budget. In the clipped-proxy example, the full probe found a cheaper path than the wider retry.
|
||||
|
||||
| Boards and profile | Verified nets | Full probe expansions | Two-iteration expansions |
|
||||
| --- | ---: | ---: | ---: |
|
||||
| Regression corpus, public defaults | 433/437 | 59,695 | 46,066 |
|
||||
| Regression corpus, corpus regression | 433/437 | 30,093 | 27,743 |
|
||||
| Retry holdouts, public defaults | 60/63 | 121,941 | 109,549 |
|
||||
| Retry holdouts, corpus regression | 59/63 | 71,761 | 69,511 |
|
||||
|
||||
Under public defaults the splitter tree stayed at 6/6. In three paired repeats its median went from 5.76 s to 5.38 s and expansions fell from 5,764 to 4,875. A one-iteration cap increased route cost on a crossing approach. The two-iteration cap increased expansions on the mixed port-bank stress board by 495 because the wider retry did the work there.
|
||||
The two-iteration probe cuts repeated shallow searches on layouts such as the splitter tree. It reduced public-default expansion counts by 23% on the regression corpus with identical paths there and on the holdouts. The mixed port-bank case did more work because the shorter probe passed the last net to the wider retry. Test both stages when changing the cap. A one-iteration cap increased the cost of a crossing approach, and the clipped-proxy regression required the original probe budget to keep its cheaper route. These are reasons to check path quality and proxy geometry as well as total expansions. [Probe budget in the policy](architecture.md#automatic-routing)
|
||||
|
||||
```sh
|
||||
python -m scripts.benchmark_retry_order --case corpus --case retry-holdout \
|
||||
|
|
@ -59,9 +53,9 @@ python -m scripts.benchmark_retry_order --case corpus --case retry-holdout \
|
|||
|
||||
### Retry experiments
|
||||
|
||||
Before the probe cap, the early 1,500-node lattice retry completed one of five triggered public-default holdouts. The four failures used 5,398 extra expansions. Early near-port incumbent recovery completed three of six triggered case/profile runs and increased one net's weighted cost by 10.0 and native cost by 5.65. These experiments preserved aggregate coverage. The early incumbent variants and their commands are archived in commit `ea5cfe7`.
|
||||
Early retries can save time when they replace a more expensive stage. Their failures add work before the ordinary fallback. The holdout runs found both effects and a case where early incumbent recovery selected a higher-cost path at the same coverage. Review failed-retry time and common-net cost when deciding whether an early exit is worth using. The archived experiments include the trigger counts and the original commands. [Experiment archive](#experiment-archive)
|
||||
|
||||
The experimental `late-residual-3000` policy runs only after the usual fallbacks leave one unresolved net. It requires room in the caller's search budget and rejects disconnected residuals. With the pre-cap public-default baseline it improved the ten holdouts from 60/63 to 63/63. It completed both 8/9 crossing boards and the 3/4 west-roof board while keeping all previously verified paths. The three retries added 3,881 expansions. The policy did no extra work on boards that already reached their bound.
|
||||
The experimental `late-residual-3000` policy tests a different question. Can a wider search recover the last net while keeping the rest fixed? It requires room in the caller's budget and skips attempts whose locks disconnect the remaining ports. In the pre-cap holdout sweep it completed the last net on two crossing boards and a return shelf, with all previously verified paths intact. Use the experiment to measure the cost of completing one more net after the normal policy stalls.
|
||||
|
||||
```sh
|
||||
python -m scripts.benchmark_retry_order --case retry-holdout --profile public-defaults \
|
||||
|
|
@ -71,13 +65,13 @@ python -m scripts.benchmark_retry_order --case retry-holdout --profile public-de
|
|||
|
||||
## Automatic nine-net Terminal-Bench routing
|
||||
|
||||
The upstream task supplies point terminals. Inire's `bundle` mode with `infer_terminal_headings=True` derives a schedule from the unseeded input. It orders tracks through rectangular barriers, locates the short net and outer return, and reserves room for bend tangencies. The ordinary seed materializer and verifier check the resulting layout. The exported solution verified **9/9** at **44,684.25** benchmark-weighted cost and zero A* expansions. The pinned upstream score limit is **46,968.60**. [Bundle planner](../inire/router/_bundle.py) · [Pinned upstream task](https://github.com/harbor-framework/terminal-bench/tree/249d125b59c0a5352d9e132195cfead6d81446be/tasks/photonic-waveguide-routing)
|
||||
Use this as a check on ordered placement and heading inference. The upstream task supplies point terminals, so `bundle` mode can infer headings and reserve room for the outer return and bend tangencies. The export command starts from the unseeded input. Its nine routes passed the pinned checker below the upstream cost limit. Use the fixed-heading `terminal-bench` fixture to check automatic routing when the headings are part of the input. [Bundle planner](../inire/router/_bundle.py) · [Pinned upstream task](https://github.com/harbor-framework/terminal-bench/tree/249d125b59c0a5352d9e132195cfead6d81446be/tasks/photonic-waveguide-routing)
|
||||
|
||||
```sh
|
||||
python -m scripts.route_terminal_bench --output /tmp/inire-terminal-bench.json
|
||||
```
|
||||
|
||||
The `terminal-bench` fixture instead supplies fixed east-facing headings and exercises the automatic policy, including a turnaround for the return. The `terminal-bench-point-terminals` fixture allows heading inference. The export CLI's `--reference-lane-plan` and `--single-bottom-track` flags replay authored comparisons. [Reference plan](../inire/tests/terminal_bench_lane_plan.py)
|
||||
The export CLI's `--reference-lane-plan` and `--single-bottom-track` flags replay authored layouts for comparison. Use the unseeded export to measure the planner and the reference flags to check feasibility or compare lane assignments. [Reference plan](../inire/tests/terminal_bench_lane_plan.py)
|
||||
|
||||
## Imported fixtures
|
||||
|
||||
|
|
@ -98,4 +92,4 @@ uv run --with 'pyyaml==6.0.3' python -m scripts.import_external_routing_benchmar
|
|||
|
||||
## Experiment archive
|
||||
|
||||
Run `git show ea5cfe7:docs/topological-routing.md` for the earlier policy matrices, budget sweeps, and manual Terminal-Bench lane measurements. Use `git worktree add --detach /tmp/inire-routing-archive ea5cfe7` to reproduce those commands with the corresponding benchmark driver. [Original goal](routing-policy-goal.md) · [Refactor plan](routing-refactor-plan.md)
|
||||
Use `git show ea5cfe7:docs/topological-routing.md` for the original retry experiments, budget sweeps, and manual Terminal-Bench lane comparisons. Use `git show 2b02c6e:docs/topological-routing.md` for the measured probe and holdout tables. For retired policies, check out `ea5cfe7` in a separate worktree to run the matching driver. [Original goal](routing-policy-goal.md) · [Refactor plan](routing-refactor-plan.md)
|
||||
|
|
|
|||
Loading…
Reference in a new issue