Make routing documentation task-oriented
This commit is contained in:
parent
2b02c6eae9
commit
24559bb6aa
1 changed files with 142 additions and 140 deletions
|
|
@ -1,67 +1,58 @@
|
|||
# Routing diagnostics and metrics
|
||||
|
||||
Use coverage and physical path verification to establish correctness. Then compare path cost, expansions, and wall time at the same geometry, search budgets, and refinement settings. [Benchmark profiles](topological-routing.md#reproduce-a-comparison)
|
||||
Start with the symptom. A missing net, a worse path, and a slower run call for different evidence. For layout or option changes, first use the [user tuning guide](../DOCS.md#tune-a-run).
|
||||
|
||||
## Automatic reports
|
||||
|
||||
| Field | Interpretation |
|
||||
**Was the run limited by the layout or by a search attempt?** Compare the number of `verified_net_ids` with `max_routed`. A reached bound with a missing net calls for a geometry change. For example, `overloaded-gate` requests four routes through a three-track cut. `capacity_limit.cut_x` locates that cut, so an extra iteration cannot recover the fourth net at the same geometry. If coverage is below the bound, use `stages` to find which nets were skipped, locked, or recovered and where coverage stopped increasing. [Bounds and fixtures](topological-routing.md#benchmark-corpus)
|
||||
|
||||
**Why did the chosen route change?** Start at `stages[selected_stage]`, then work back to the search or planner that produced its paths. The `planner` identifies the source of a proposal. The `mode` identifies the worker that ran it. For example, an `off` worker can verify a bundle seed. Use `planner_rejections` when a constructive layout never reaches selection. Compare per-net paths and costs on the same verified IDs before drawing a quality conclusion. [Report definitions](../inire/results.py)
|
||||
|
||||
**Where did the time go?** Group exclusive `timings` by policy and operation, including failed attempts. Compare with the run's `duration_s`, which also includes orchestration. A short selected search can follow a long unsuccessful one. Detailed traces, corridor reports, and plotted expanded states describe the selected attempt when present. Use `run.metrics` and stage data for work across attempts. [Benchmark profiles](topological-routing.md#reproduce-a-comparison)
|
||||
|
||||
## Route metrics
|
||||
|
||||
Pair each counter with a question about the work. Use a repeated wall-time comparison to confirm the effect. Higher counts can reflect more useful search or coverage.
|
||||
|
||||
| Observation | What to check next |
|
||||
| --- | --- |
|
||||
| `verified_net_ids`, `max_routed` | Verified IDs in the selected layout and the upper bound. `capacity_limit` identifies an applicable vertical cut. `port_conflicts` identifies disjoint conflicts between fixed terminals. |
|
||||
| `selected_stage`, `selected_planner` | Index and planner name of the chosen stage. A refinement stage can win. |
|
||||
| `stages` | Search, verification, and refinement attempts with verified, locked, skipped, and out-of-bounds net IDs as applicable. Each stage has a planner, worker mode, operation, node limit, and optional policy and retry reason. |
|
||||
| `planner_rejections`, `cost_pass_performed` | Rejected constructive candidates and whether weighted column scoring ran. |
|
||||
| `timings`, `duration_s` | Exclusive wall time for planning, search, verification, and refinement, including unsuccessful work. Total duration also includes orchestration between timed operations. |
|
||||
| More expansions and a later selected stage | Compare the node counts and verified IDs of each stage. The original work may have moved into a fallback. |
|
||||
| Similar expansions, more search time | Check `ray_cast_calls*` and `ray_cast_exact_geometry_checks` for visibility work. Compare dynamic `congestion_candidate_ids` with `congestion_exact_pair_checks` to see how much candidate geometry reaches exact tests. |
|
||||
| Verification dominates | Compare `verify_path_report_calls` with `verify_static_buffer_ops` and `verify_dynamic_exact_pair_checks`. This can distinguish repeated path checks from expensive checks of the same paths. |
|
||||
| Refinement takes longer | Compare `refinement_windows_considered`, `refinement_candidates_verified`, and `refinement_candidates_accepted`. Check whether the added windows buy a better path before enlarging the default budget. |
|
||||
| Attempts reach targets while verified coverage stays flat | Compare `iteration_conflict_edges` and `nets_carried_forward`. Inspect pair-local attempts and accepts after congestion stops. `pair_local_search_nodes_expanded` counts searches that returned a locally valid pair, so consult the attempt count to see failed searches. |
|
||||
|
||||
A stage's `mode` names its worker. Its `planner` identifies the algorithm that proposed the layout. A bundle candidate can use an `off` worker for seed verification. `run.topology`, when populated, describes the selected worker's corridor counts, seeded nets, and constrained seed expansions. Detailed traces and expanded states describe the selected attempt. By comparison, `run.metrics` sums the workers' counters across attempts. [Report definitions](../inire/results.py)
|
||||
|
||||
## RouteMetrics
|
||||
|
||||
The counters measure work, so a net can contribute to multiple attempts. Count final verified nets with `result.is_valid` or `run.automatic.verified_net_ids`.
|
||||
|
||||
| Question | Counters |
|
||||
| --- | --- |
|
||||
| How much search ran? | `nodes_expanded`, `moves_generated`, `moves_added`, and `pruned_*` measure expansion, admission, and pruning. `warm_start_paths_built` and `warm_start_paths_used` track seed creation and reuse. |
|
||||
| Did congestion settle? | `route_iterations`, `nets_routed`, and `nets_reached_target` count iterations and attempts. `iteration_reverified_nets`, `iteration_conflict_edges`, and `nets_carried_forward` show verification work, conflicts, and reuse. |
|
||||
| Which geometric queries dominate? | `ray_cast_calls*` splits rays by caller. `ray_cast_candidate_bounds` and `ray_cast_exact_geometry_checks` distinguish broad-phase and exact tests. Tree and grid rebuild counts measure index maintenance. |
|
||||
| How many dynamic candidates reach exact tests? | `congestion_check_calls`, `congestion_candidate_ids`, and `congestion_exact_pair_checks` track queries, candidate objects, and confirmed geometry tests. Cache and precheck counters record reused work and conservative skips. |
|
||||
| What did final checks cost? | `verify_path_report_calls`, `verify_static_buffer_ops`, `verify_dynamic_candidate_nets`, and `verify_dynamic_exact_pair_checks` track verification work. |
|
||||
| Was local repair or refinement productive? | `pair_local_search_*` tracks considered pairs, attempts, accepted replacements, and expansions. `late_phase_capped_*` tracks carried incumbents before repair. `refinement_*` counts windows, candidate construction, checks, and accepted changes. |
|
||||
|
||||
`*_total_ns` fields report measured durations. Stable counters help compare algorithmic changes. Repeated wall times reveal costs that counters miss. The [counter schema](../inire/results.py) lists every field. The [committed example snapshot](performance.md) and its [JSON](performance_baseline.json) record historical observations.
|
||||
`nets_routed` and `nets_reached_target` count attempts. To count final successes use `result.is_valid` or `verified_net_ids`. Fields ending in `_total_ns` measure durations and can vary between identical runs. Use the counter schema for exact field names and the example snapshot to investigate earlier observations. [Counter schema](../inire/results.py) · [Historical example snapshot](performance.md) · [Snapshot JSON](performance_baseline.json)
|
||||
|
||||
## Traces
|
||||
|
||||
Enable the corresponding `DiagnosticsOptions` flag to populate a trace. Trace entries are immutable. Use an `iteration_callback` for live snapshots across attempts. Automatic callback indices increase across workers and the callback count follows the actual schedule.
|
||||
Enable the `DiagnosticsOptions` flag for the question you want to answer.
|
||||
|
||||
| Result field | Contents | Example |
|
||||
| --- | --- | --- |
|
||||
| `iteration_trace` | Per-iteration verified coverage, congestion penalty, conflict counts, and A* work. `net_attempts` attributes expansions, pruning, congestion calls, and seed usage to each rerouted net. | [Iteration trace](iteration_trace.md) |
|
||||
| `conflict_trace` | Post-iteration, restored-best, and final conflict snapshots. Each entry includes complete net IDs, undirected dynamic conflict edges, and the component indices responsible for those edges. Static and self-collision details are counts in each routing report. | [Conflict trace](conflict_trace.md) |
|
||||
| `frontier_trace` | Analysis-only reruns of final reached-but-colliding nets. Records counts and sampled prune events near dynamic overlap hotspots, including move type, state, and reason. | [Frontier trace](frontier_trace.md) |
|
||||
| `pre_pair_frontier_trace` | The relevant unresolved subset iteration before pair-local repair. Records reroute order, conflict edges, per-net attempt work, and targeted frontier analysis. | [Pre-pair trace](pre_pair_frontier_trace.md) |
|
||||
| `expanded_nodes` | Explored integer port states from searches that capture expansions. | [Fan-out example](../examples/07_large_scale_routing.py) |
|
||||
| Question | Flag and result |
|
||||
| --- | --- |
|
||||
| Which net consumed an iteration's budget? | `capture_iteration_trace` records `iteration_trace`. Inspect per-net `net_attempts` for expansions, pruning, congestion calls, and seed usage. |
|
||||
| Which two routes overlap after re-verification? | `capture_conflict_trace` records `conflict_trace`. Use the dynamic conflict edges to find the pair and the component indices to locate the overlap. |
|
||||
| Why was a nearby detour rejected? | `capture_frontier_trace` records `frontier_trace` for reached-but-colliding nets. Look at the sampled states and prune reasons near the final overlap. The analysis leaves the selected route fixed. |
|
||||
| What did the last unresolved iteration hand to pair-local repair? | `capture_pre_pair_frontier_trace` records `pre_pair_frontier_trace`. Check reroute order, conflict edges, and per-net attempt work immediately before repair. |
|
||||
| Where did the router explore? | `capture_expanded` records `expanded_nodes` for plotting. See the [fan-out example](../examples/07_large_scale_routing.py). |
|
||||
|
||||
Frontier analysis leaves the route result fixed. Pair-local repair runs as part of routing and can change the installed paths after a successful whole-set check.
|
||||
The historical no-warm-start fan-out trace shows why both the final result and the iteration trace matter. The last iteration in the first scenario leaves two conflict edges and six completed nets. The run finishes with all ten valid after pair-local repair. When an iteration change alters that handoff, compare the restored snapshot, pair-local acceptance, and the final conflict trace. [Iteration trace](iteration_trace.md#example_07_large_scale_routing_no_warm_start) · [Conflict trace](conflict_trace.md) · [Pre-pair trace](pre_pair_frontier_trace.md)
|
||||
|
||||
For live progress across attempts, use an `iteration_callback`. Use the final result to establish coverage. Callback indices increase across automatic attempts, and the number of callbacks follows the actual search schedule. [Callback API](../DOCS.md#read-the-result)
|
||||
|
||||
## Reproduce and compare
|
||||
|
||||
Capture the same profiles at both revisions for a behavior-preserving change. Exact parity checks results, verified net IDs, path seeds, both costs, stage order and metadata, and stable counters. Add `--callbacks` and `--diagnostics` to both captures to include live callback payloads and detailed traces.
|
||||
1. Start with a fixture that shows the symptom. Capture the same options at both revisions. For a behavior-preserving change, exact parity checks paths, scores, stage metadata, stable counters, and coverage. Add `--callbacks` and `--diagnostics` to both captures when changing callback or trace behavior.
|
||||
2. For a policy change, check verified IDs, paths, and per-net costs first. Advance to the full corpus and relevant holdouts once the focused case behaves as intended. Use interleaved repeats for timing and name the boards that get slower. Time inside failed retries can explain a tail regression that the median obscures.
|
||||
3. If the run gets slower without more expansions, check the operation timings and use the counters above to pick a narrower trace or profile.
|
||||
|
||||
```sh
|
||||
python -m scripts.routing_benchmark_parity capture /tmp/routing-before.json
|
||||
# Run the next capture with the same options on the changed revision.
|
||||
python -m scripts.routing_benchmark_parity capture /tmp/routing-after.json
|
||||
python -m scripts.routing_benchmark_parity capture /tmp/routing-before.json --case stress
|
||||
# Use the same options on the changed revision.
|
||||
python -m scripts.routing_benchmark_parity capture /tmp/routing-after.json --case stress
|
||||
python -m scripts.routing_benchmark_parity compare /tmp/routing-before.json /tmp/routing-after.json
|
||||
```
|
||||
|
||||
For a policy change, compare coverage, verified IDs, paths, and costs before examining intended changes to stage work. Use interleaved repeats for timings. Report the median per board and compare tail boards by name. Separate work inside failed retries from total routing time.
|
||||
Use `scripts.record_iteration_trace` and `scripts.record_pre_pair_frontier_trace` to inspect a late conflict. Use `scripts.record_conflict_trace` and `scripts.record_frontier_trace` to locate an overlap and inspect rejected moves near it. Pass `--output-dir /tmp/inire-trace` for a scratch capture. The trace writers support `--scenario` for an individual built-in case and `--include-performance-only` for the heavier cases.
|
||||
|
||||
```sh
|
||||
python -m scripts.record_performance_baseline --output-dir /tmp/inire-perf
|
||||
python -m scripts.diff_performance_baseline --metric nodes_expanded --metric ray_cast_calls
|
||||
python -m scripts.record_iteration_trace --output-dir /tmp/inire-iteration
|
||||
python -m scripts.record_pre_pair_frontier_trace --output-dir /tmp/inire-pre-pair
|
||||
INIRE_RUN_PERFORMANCE=1 python -m pytest -q inire/tests/test_example_performance.py
|
||||
```
|
||||
|
||||
The trace writers also support `--scenario` and `--include-performance-only`. Use `scripts.record_conflict_trace` and `scripts.record_frontier_trace` for individual hotspot investigations. The [pair-local characterization](pair_local_characterization.md) and [optimization log](optimization_pass_01_log.md) preserve earlier experiments.
|
||||
For isolated timing gates, run `INIRE_RUN_PERFORMANCE=1 python -m pytest -q inire/tests/test_example_performance.py`. Use `scripts.record_performance_baseline` with `--output-dir` to record an example snapshot and `scripts.diff_performance_baseline` with `--baseline` and `--metric` to compare a fresh run. The [pair-local characterization](pair_local_characterization.md) and [optimization log](optimization_pass_01_log.md) preserve earlier experiments.
|
||||
|
|
|
|||
Loading…
Reference in a new issue