Implement typed and octagonal catalog routing
This commit is contained in:
parent
3b3d1c74fc
commit
7616b398e9
2 changed files with 5544 additions and 85 deletions
|
|
@ -41,3 +41,71 @@ For a mode comparison, use the same problem and options in each call to `route()
|
|||
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.
|
||||
|
||||
## Capture legacy parity
|
||||
|
||||
Run `PYTHONPATH=. python scripts/capture_legacy_routing.py /tmp/inire-parity.json --repeat 3` from the checkout under test. Compare against revision `3b3d1c7` to measure the change to the move evaluator. To capture a Git archive, run the same script by absolute path from the extracted source tree and pass `--revision 3b3d1c7`. The capture records the effective ports, ordered moves, lengths, physical polygons, work counters, options, dependencies, and elapsed time. Use the same dependencies and compare route and work fields independently of elapsed time. The comparison covered 154 cases and modes with three repetitions per checkout and used Python 3.13.18, GEOS 3.13.1, NumPy 2.4.2, SciPy 1.17.1, Shapely 2.1.2, and Rtree 1.4.1. All recorded outcomes, routes, polygons, and deterministic work counters agreed. The sum of the per-case median times was 21.87 s at the reference revision and 21.88 s with the evaluation boundary.
|
||||
|
||||
## Catalog scale benchmarks
|
||||
|
||||
Use the aligned case for long-range profile changes. Use the constrained case for an obstacle detour among 40 connections on the same 5 × 5 mm board at 100 nm pitch. The script verifies the frozen reference routes independently before timing unseeded search.
|
||||
|
||||
```sh
|
||||
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case constrained --mode native
|
||||
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case constrained --mode manhattan
|
||||
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case constrained --mode typed
|
||||
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case constrained --mode typed --no-refinement
|
||||
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case constrained --mode octagonal
|
||||
```
|
||||
|
||||
Native uses the existing Manhattan API. Manhattan uses the catalog evaluator with a single profile and cardinal turns. Typed adds the centered transition. Octagonal also admits 45° bends. The diagonal-savings case keeps cardinal terminals and gives the octagonal search a shorter two-turn path. The diagonal case has a native diagonal terminal pair.
|
||||
|
||||
Use `--guide-pitch 1000` and `--guide-pitch 10000` to compare coarse guidance against explicit routing. The off-coarse case exercises a displaced transition at 1 nm layout precision. On the same case `--auto-pitch 1000` selects 200 nm and verifies the same terminal poses. For a bounded failure control, use `--node-limit 0`. Use `--geometry` to retain the ordered moves and physical polygons with each report.
|
||||
|
||||
The report includes repeated wall times, peak resident memory from the operating system, and per-net cost and physical length. Compare costs on the intersection of the completed net sets. Catalog reports also include work from discarded search attempts and budgeted retries.
|
||||
|
||||
### Representative measurements
|
||||
|
||||
The following constrained-case runs used an AMD Ryzen 9 5900X and a 1000-node detailed-search limit. Times are medians of three runs. The catalog Manhattan and typed configurations completed all 40 requests. Native Manhattan verified 39 within the same node limit.
|
||||
|
||||
| Configuration | Verified | Time | Catalog cost |
|
||||
| --- | ---: | ---: | ---: |
|
||||
| Native Manhattan, refinement disabled | 39 | 1.96 s | 17.9400 |
|
||||
| Catalog Manhattan, refinement disabled | 40 | 0.54 s | 18.4426 |
|
||||
| Typed, refinement disabled | 40 | 2.06 s | 10.2136 |
|
||||
| Typed, refinement enabled | 40 | 2.24 s | 10.0140 |
|
||||
| Octagonal, refinement disabled | 40 | 6.15 s | 10.2136 |
|
||||
| Typed, 1 µm guidance, refinement disabled | 40 | 2.47 s | 10.2136 |
|
||||
| Typed, 10 µm guidance, refinement disabled | 40 | 2.02 s | 10.2136 |
|
||||
|
||||
On the 39 routes verified by native Manhattan, the typed run without refinement cost 9.711. At both guidance pitches, 39 fine routes verified inside their first corridor and one completed after the explicit retry. The diagonal-savings case lowered the planted route from 591.416 µm and cost 0.076 to 481.982 µm and cost 0.06663. Profiling the octagonal run identified geometry admission and straight-span proposals as the largest search costs. Checking the output pose and cost lower bound before geometry evaluation brought the median over all 40 nets to 1.79 s.
|
||||
|
||||
The `corpus-open-lanes` and `corpus-lanes` cases reuse twelve lanes from the existing scale banks. The open lanes all switched profiles and reduced the total catalog cost from 0.648 to 0.552. With the corpus keepouts present, all twelve routed and the total stayed at 0.648 because the wider guide would violate clearance.
|
||||
|
||||
The constrained run with a zero-node budget verified and completed zero routes and reported `node_limit` for all 40. Native Manhattan used 115 MiB peak resident memory on the constrained board. The refined typed run used 90 MiB.
|
||||
|
||||
## Delay and independent-net retry
|
||||
|
||||
```sh
|
||||
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case tuning --no-refinement
|
||||
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case retry --no-refinement
|
||||
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case retry --no-refinement --no-independent-retry
|
||||
```
|
||||
|
||||
The tuning case measures a four-turn detour inside a caller-supplied window. The retry case shows whether the released reservation lets an independent net complete. Compare the verified and completed sets, group skew, straight spans intersecting active tuning windows, checked replacements, and time spent tuning or retrying.
|
||||
|
||||
On the same machine the tuning case matched both routes at zero residual skew in a median of 1.59 s with the shared tuning and retry budget. The first pass examined 1334 proposals, with 524 verified replacements from one eligible span. The released-reservation case completed one independent route with retry and zero with retry disabled, at 1.17 s and 1.15 s median respectively.
|
||||
|
||||
|
||||
## Catalog acceptance checks
|
||||
|
||||
Run the catalog fixtures with Masque 4.0a3 importable to include layout placement and terminal checks.
|
||||
|
||||
```sh
|
||||
python -m pytest -q inire/tests/test_catalog_*.py
|
||||
```
|
||||
|
||||
- The [device set](../inire/tests/catalog_device_set.py) records the three profiles, authored transitions, generated bend settings, and fixed delays. [Device checks](../inire/tests/test_catalog_device_set.py)
|
||||
- The [move and placement checks](../inire/tests/test_catalog_moves.py) cover exact lattice membership, grid-compatible leads, profile transitions, attachments, replay, physical placement, and partial placement.
|
||||
- The [small search oracles](../inire/tests/test_catalog_search_oracle.py) enumerate complete histories and compare them with production proposal and pruning rules.
|
||||
- The [timing checks](../inire/tests/test_catalog_timing_cases.py) cover direction-aware and wavelength-aware delay, matching budgets, window containment, and final verification of the chosen layout.
|
||||
|
|
|
|||
|
|
@ -25,6 +25,45 @@ result = route(problem).results_by_net["input"]
|
|||
- [Bend radius settings](api-reference.md#searchoptions)
|
||||
- [Layout input types and defaults](api-reference.md#routingproblem)
|
||||
|
||||
## Route a typed Masque layout
|
||||
|
||||
The preview adapter lives in `inire.masque`. The integration fixtures exercise Masque 4.0a3. Define named ports on the top-level pattern, using Masque's port mappings to expose ports from preplaced cells. Assign each endpoint its canonical routing profile. The adapter rounds resolved positions to the nearest layout unit before Inire checks exact membership on the routing lattice. Dimensions in the grid, shapes, and catalog use that common layout unit.
|
||||
|
||||
```python
|
||||
from math import pi
|
||||
|
||||
from masque import Pattern, Port
|
||||
from shapely.geometry import box
|
||||
|
||||
from inire.masque import Catalog, Connection, Endpoint, Grid, Profile, StraightVariant, route_and_place
|
||||
|
||||
layout = Pattern(ports={
|
||||
"source": Port((10_000, 20_000), rotation=pi),
|
||||
"destination": Port((90_000, 20_000), rotation=0),
|
||||
})
|
||||
catalog = Catalog("process-a", {"ridge-4": Profile("ridge", width=4000)}, {
|
||||
"ridge-straight": StraightVariant("ridge-4", cost_per_cm=1),
|
||||
})
|
||||
result = route_and_place(
|
||||
layout,
|
||||
{},
|
||||
(Connection("input", Endpoint("source", "ridge-4"), Endpoint("destination", "ridge-4")),),
|
||||
catalog=catalog,
|
||||
grid=Grid(origin=(0, 0), pitch=100, meters_per_unit=1e-9),
|
||||
board=box(0, 0, 100_000, 80_000),
|
||||
layer=1,
|
||||
)
|
||||
assert result.placed == ("input",)
|
||||
```
|
||||
|
||||
Pass a mapping from cell names to Masque patterns for fixed variants. Include blocking polygons from the placed layout in `keepouts`. An endpoint can carry an `Attachment` for one of those polygons when its route must join at the fixed port. Both endpoint names are consumed for each placed connection. A fixed cell can omit its physical centerline length. Nonadjacent pieces separated by a cell with unknown length must meet ordinary self-clearance. With `require_complete=True`, every requested connection and active match group must complete before placement begins.
|
||||
|
||||
To experiment with lattice selection, pass `AutomaticGrid(preferred_pitch=1000, meters_per_unit=1e-9)`. It uses a divisor of the preferred pitch that fits the rounded terminals and the authored fixed-cell displacements. Read the selected grid from the placement result. Pass `CoarseGuidance(pitch=1000)` to propose routes inside coarse corridors while still placing and verifying moves on the selected routing grid. The fine search can retry outside a corridor within the remaining node budget.
|
||||
|
||||
The placement result reports the catalog revision, evaluated routes, consumed terminals, and placement outcome. Each verified route exposes its catalog cost and physical length in layout units when the lengths of all constituent moves are known. Inspect `unavailable_variants` for grid-fit and realization diagnostics.
|
||||
|
||||
Give each `MatchGroup` its member offsets, wavelength in meters, and tolerance. Express offsets and tolerance in group optical length in layout units or in seconds. Supply a `DelayModel` for the process indices and characterized cell delays. To enable a tuning detour, supply that net's polygon in `tuning_windows`. A fixed contribution can be a characterized constant, a function of wavelength, or `None` for missing delay data. Bend lead costs use the profile's lowest declared straight rate by default. Set a bend's `lead_cost_per_cm=0` to include the leads in its placement charge.
|
||||
|
||||
<a id="connect-a-preplaced-crossing"></a>
|
||||
|
||||
## Route between placed crossings
|
||||
|
|
|
|||
Loading…
Reference in a new issue