inire/docs/benchmarks.md
Jan Petykiewicz a05980e8af Retire routing archives and consolidate documentation tooling
Generate the guide, walkthrough, and gallery figures from one command. Keep benchmark fixtures and attribution with the tests and fold the durable findings from completed plans into the guides.
2026-12-02 20:33:19 -08:00

43 lines
2.5 KiB
Markdown

# Routing benchmarks
## Run a benchmark
From the repository root, run the overloaded-gate fixture.
```sh
python -m pytest -m routing_corpus -k overloaded-gate
```
The test checks that three of the four nets verify. All four nets need to cross a vertical cut with room for three tracks. Use `-k lidar-clements-8x8` to check an imported board with a bound of three out of six set by port spacing.
### Run the full benchmark corpus
```sh
python -m pytest -m routing_corpus
```
The default test suite includes the corpus. Run `python -m pytest -m retry_holdout` to focus on the holdouts.
## Choose a case
Use `pytest --collect-only -q -m routing_corpus` to list the case IDs. Start with a board that exhibits the behavior and select it with `-k`.
- For tight corners and S-bend slots, start with the micron-scale geometry fixtures.
- For preplaced devices, choose a case such as `crossing-obstructed-approaches` or `crossing-staggered-grid`.
- For a change to retry order, include the held-out return shelves, bypasses, and competing trunks.
The [fixture guide](benchmark-fixtures.md) describes these layouts and their known bounds. The [corpus registry](../inire/tests/routing_corpus.py) lists the groups and options.
## Choose a profile
The corpus uses automatic routing under `corpus-regression`, with a 500-node search limit, a 500-node seed budget per net, and up to three congestion iterations per attempt. On the three `search-low-length-cost` boards it also checks the original 80- or 130-node lattice budget.
### Compare routing modes
For a mode comparison, use the same problem and options in each call to `route()`. Change the topology mode and compare verified IDs, route cost on matching net sets, and work counters. The [complex-routing walkthrough](complex-routing-example-1.md#compare-all-routing-modes) shows this comparison with a 100-node search budget.
## Compare the results
1. **Coverage and bounds.** Check which nets verified and whether their count reached the expected bound. The tests also verify known reference routes where available.
2. **Cost on matching net sets.** Benchmark-weighted length weights physical straights, 90-degree bends, and S-bends by 1, 4, and 13. Native objective cost uses the run's configured objective.
3. **Search and time.** Compare expansions and repeated wall times at the same settings. Constructive stages can spend time planning and verifying even with zero expansions. Inspect the [automatic reports](routing-diagnostics.md#automatic-reports) to find which stage performed the work.