Separate user guides, benchmarks, and routing internals
This commit is contained in:
parent
24559bb6aa
commit
e4d5952677
1 changed files with 846 additions and 270 deletions
|
|
@ -1,95 +1,33 @@
|
|||
# Topological routing and benchmarks
|
||||
<a id="topological-routing-and-benchmarks"></a>
|
||||
|
||||
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).
|
||||
# Topological routing
|
||||
|
||||
Guide mode suggests routes through connected free space. Seed mode also tries to realize those suggestions as physical paths. [Run corridor benchmarks](benchmarks.md#compare-routing-modes)
|
||||
|
||||
## Corridor planning and realization
|
||||
|
||||

|
||||
|
||||
The offset-gates fixture has two openings at different heights. The mesh highlights the portals used by the chosen corridor. The dashed lane remains angular, while detailed guide-mode search fits an S-bend between the openings. [Reproduce the mode comparison](benchmarks.md#compare-routing-modes)
|
||||
|
||||
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.
|
||||
|
||||
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)
|
||||
## When a corridor does not lead to a route
|
||||
|
||||
- **No corridor reported.** Inspect `run.topology` from an explicit guide or seed run. Check snapped port access, mesh padding, and which passages remain connected.
|
||||
- **A corridor exists but seed search stalls.** Check terminal headings and the turn room around each chosen portal.
|
||||
- **Seeds reach their targets and the final routes 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
|
||||
## Moved benchmark sections
|
||||
|
||||
| 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. |
|
||||
|
||||
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
|
||||
|
||||
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 offset-gates --profile matched-budget \
|
||||
--mode off --mode guide --mode seed --nodes 100 --repeat 3 \
|
||||
--json /tmp/inire-modes.json
|
||||
```
|
||||
|
||||
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 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 \
|
||||
--policy baseline --policy probe-full-budget --jobs 6 --json /tmp/inire-probe.json
|
||||
```
|
||||
|
||||
### Retry experiments
|
||||
|
||||
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 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 \
|
||||
--policy baseline --policy late-residual-3000 --repeat 3 --jobs 6 \
|
||||
--json /tmp/inire-residual.json
|
||||
```
|
||||
|
||||
## Automatic nine-net Terminal-Bench 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 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
|
||||
|
||||
The six fixed-placement cases run offline from [converted inputs](../inire/tests/data/external_routing_benchmarks.json). Optical ports snap to a 0.1 µm grid. Device outlines become keepouts with access cutouts. PIC Routing Benchmark contributes splitter-tree, ring-modulator, and MZM cases. LiDAR contributes a toy layout and subsets of the Clements and MRR weight-bank layouts. These fixtures exercise waveguide routing between fixed devices. [PIC data and CC BY 4.0 attribution](https://huggingface.co/datasets/FLYR/pic-benchmark/blob/0c1f445792926d97fae01893c89e96b8a9393800/pic-benchmark/README.md) · [LiDAR source](https://github.com/ScopeX-ASU/LiDAR/tree/4e7004d32b0b80d959553797fb30f0737513de0c/src/picroute/benchmarks) · [LiDAR license](../inire/tests/data/LiDAR-LICENSE.txt)
|
||||
|
||||
The importer checks both pinned archive hashes. It requires PyYAML when regenerating the fixtures.
|
||||
|
||||
```sh
|
||||
mkdir -p /tmp/inire-external-routing
|
||||
curl -fL 'https://huggingface.co/datasets/FLYR/pic-benchmark/resolve/0c1f445792926d97fae01893c89e96b8a9393800/pic-benchmark.zip' \
|
||||
-o /tmp/inire-external-routing/pic-benchmark.zip
|
||||
curl -fL 'https://codeload.github.com/ScopeX-ASU/LiDAR/tar.gz/4e7004d32b0b80d959553797fb30f0737513de0c' \
|
||||
-o /tmp/inire-external-routing/lidar.tar.gz
|
||||
uv run --with 'pyyaml==6.0.3' python -m scripts.import_external_routing_benchmarks \
|
||||
--pic-archive /tmp/inire-external-routing/pic-benchmark.zip \
|
||||
--lidar-archive /tmp/inire-external-routing/lidar.tar.gz
|
||||
```
|
||||
|
||||
## Experiment archive
|
||||
|
||||
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)
|
||||
- <a id="benchmark-corpus"></a>[Choose a benchmark case](benchmarks.md#choose-a-case)
|
||||
- <a id="reproduce-a-comparison"></a>[Compare routing modes](benchmarks.md#compare-routing-modes)
|
||||
- <a id="probe-budget-and-coverage"></a>[Probe and retry measurements](benchmark-results.md#near-port-probe-and-retry-experiments)
|
||||
- <a id="retry-experiments"></a>[Early and late retries](benchmark-results.md#early-and-late-retries)
|
||||
- <a id="automatic-nine-net-terminal-bench-routing"></a>[Reproduce Terminal-Bench routing](benchmark-fixtures.md#automatic-nine-net-terminal-bench-routing)
|
||||
- <a id="imported-fixtures"></a>[Sources and regeneration](benchmark-fixtures.md#imported-fixtures)
|
||||
- <a id="experiment-archive"></a>[Find the archived measurements and scripts](benchmark-results.md#experiment-archive)
|
||||
|
|
|
|||
Loading…
Reference in a new issue