7.9 KiB
Routing diagnostics and metrics
Use these reports to investigate a change in planner selection, coverage, or runtime. To troubleshoot a layout you want to route, start with the user guide.
Automatic reports
-
A net is missing. Compare the verified count with
max_routed. If the count falls short of the bound, readstagesfor skipped or locked nets and look for the attempt where coverage stopped increasing. To see a run that reaches its bound of three routes out of four, try the overloaded-gate benchmark. -
The chosen route changed. Start at
stages[selected_stage]. Theplanneridentifies the source of the proposal andmodeidentifies the worker, so a bundle seed can be checked by anoffworker. Useplanner_rejectionsfor constructive candidates that never reached selection. -
The run slowed down. Group exclusive
timingsby policy and operation, including failed attempts.duration_salso includes orchestration. Userun.metricsand stage data for work across attempts. Detailed traces, corridor reports, and expanded states describe the selected attempt when present.
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 |
|---|---|
| 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. |
nets_routed and nets_reached_target count attempts. Use result.is_valid or verified_net_ids to count final successes. Duration counters ending in _total_ns can vary between identical runs. For the full field list, see the RouteMetrics definition.
Traces
Enable the DiagnosticsOptions flag for the question you want to answer.
| 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 the conflicting net IDs and the indices of their overlapping path components. |
| What pruning occurred near the final overlap? | capture_frontier_trace records frontier_trace for reached-but-colliding nets. Inspect the states and prune reasons sampled in that area. The diagnostic replay 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. |
Find overlapping components
- Enable
capture_conflict_tracein the run'sDiagnosticsOptions. In the returnedrun.conflict_trace, use the entry whosestageis"final"to inspect the paths the run returned. - Find the two net IDs in
conflict_edges. In the matchingnetsentry, readcomponent_conflictsforself_component_index,other_net_id, andother_component_index. - Index each net's
pathinrun.results_by_netusing those zero-based indices. Plot the components'physical_geometryon the board and check their spacing against the required clearance. See whether both components compete for the same opening.
For an earlier stage such as restored_best, read the net and component indices from that entry. The final paths may have changed during repair.
Follow a late conflict into pair-local repair
Capture the conflict trace for fan-out with warm starts disabled. The best congestion iteration leaves two disjoint pairs of nets competing for space.
python -m scripts.record_conflict_trace \
--scenario example_07_large_scale_routing_no_warm_start \
--output-dir /tmp/inire-trace
- Open
conflict_trace.jsonand findrestored_best. Six nets are complete and the conflict edges arenet_02withnet_03andnet_06withnet_07. For example, the entry fornet_02reports that its component 1 overlaps component 1 ofnet_03. See the stage summary in the recorded conflict trace. - Compare with
final. All ten nets verified and the conflict edges are empty. The staged trace shows that repair resolved conflicts remaining after the congestion iterations. - To compare expansions and congestion work in the iterations leading up to repair, substitute
scripts.record_iteration_tracein the command. If you need the reroute order and per-net work immediately before repair, substitutescripts.record_pre_pair_frontier_traceand compare with the recorded pre-pair trace.
Use the returned result to count final successes. For live progress during routing, pass an iteration_callback.
Reproduce and compare
- 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
--callbacksand--diagnosticsto both captures when changing callback or trace behavior. - 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.
- If the run gets slower without more expansions, check the operation timings and use the counters above to pick a narrower trace or profile.
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
Select a built-in trace case by name with --scenario. Use --output-dir to write the capture in a scratch directory.
Check timing and counters
- Run the isolated timing gates with
INIRE_RUN_PERFORMANCE=1 python -m pytest -q inire/tests/test_example_performance.py. - Record a snapshot with
python -m scripts.record_performance_baseline --output-dir /tmp/inire-baseline. For the resulting coverage, timing, and counter summary, see the example baseline. - Compare a fresh run with
python -m scripts.diff_performance_baseline. Use--metricto focus on specific work or--baselineto override the default baseline JSON.