Skip to content

feat: add physical-capacity routing with HighDensitySolverB02 - #2271

Closed
seveibar wants to merge 11 commits into
mainfrom
fix/bugreport101-routing-performance
Closed

feat: add physical-capacity routing with HighDensitySolverB02#2271
seveibar wants to merge 11 commits into
mainfrom
fix/bugreport101-routing-performance

Conversation

@seveibar

@seveibar seveibar commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What this does

Bugreport101 looks like a 37-connection board, but expands to 190 terminals, 155 post-escape point-pair routes, 718 physical-capacity high-density nodes, and 1,173 exact local route pairs. The original cache-free Pipeline 7 effort-1 solve took about 395.9 seconds.

This PR replaces the earlier search-budget heuristic with a new routing path:

  • physical-capacity portal pathing uses only authoritative legal shared-edge slots and never fabricates sub-pitch duplicate terminals;
  • HighDensitySolverB02, supplied by the pinned @tscircuit/high-density-b01 package, composes a bounded B01 partial-route seed with conflict-directed planar and cross-layer repair, then publishes output only after strict trace/via clearance validation;
  • a thin autorouter adapter preserves explicit pair topology and order, terminal PCB port IDs, root connection names, and region IDs while retaining the existing duplicated-portal and node-obstacle applicability gates;
  • TwoChordLaneIntraNodeSolver handles the common perpendicular two-chord channel case deterministically;
  • every specialized winner is accepted only after endpoint/root/region preservation, via-transition and bounds checks, package geometry validation, and 0.10 mm copper-clearance validation.

The exact former hotspot topology_merge_19__sub_0_2 fell from about 51.6 seconds to about 0.15 seconds. Final isolated high-density routing fell from 105.3 seconds to 13.1 seconds, with 63 HighDensitySolverB02 winners and 4 two-chord winners.

End-to-end result

Two clean opt-in runs on the reference machine:

Metric Previous optimized draft New solver path
Total solve 116.1 s 43.7 s / 44.3 s
Port-point pathing 8.8 s 7.5 s
High-density routing 51.2 s 13.1 s / 13.6 s
Exact DRC improvement 12.8 s 6.6 s / 6.8 s
Power expansion 21.7 s 9.6 s
Relaxed DRC errors 47 22

The post-integration run using merged HighDensitySolverB02 completed in 41.808 seconds with the same 2,498,457 iterations and 22 relaxed DRC errors. The original <120_000 ms contract remains unchanged. This is not a claim that the whole board is DRC-clean; the remaining 22 issues stay visible and regression-guarded.

Scope and safety

The output-changing route is explicit and default-off via:

highDensityRoutingMode: "physical-capacity"

The Bugreport101 test and Cosmos fixture opt in. Legacy Pipeline 7 callers retain duplicate-port preprocessing, uniform redistribution, one-step pathing scheduler granularity, and the existing HD portfolio. The previous initial/grown iteration caps, largest-scale-first ordering, and unvalidated post-shrink repair-seed policy have been removed from this branch.

Supporting optimizations include:

  • batched tiny-hypergraph parent stepping in physical-capacity mode, with strict option validation;
  • exact-geometry evaluator memoization;
  • per-route spatial-conflict memoization during useless-via removal;
  • reusable immutable obstacle and same-net metadata in power expansion.

The GitHub-only Cosmos verification step uses a 6 GiB Node heap. Its 4.1 GiB default heap consistently aborted while rendering the 4,881-module fixture bundle; the external Vercel deployment was already green.

Visual snapshot

The env-gated regression includes this current routed snapshot in addition to the always-reviewed unrouted input snapshot:

Bugreport101 physical-capacity routed output

Upstream dependencies

All dependencies are pinned by commit SHA.

Validation

  • env-gated full Bugreport101 solve after B02 integration: 41,808 ms, 2,498,457 iterations, and 22 relaxed DRC errors
  • routed SVG snapshot matched without update mode
  • focused HighDensitySolverB02 integration coverage: 2 tests, 2,754 assertions, 0 failures
  • focused coverage verifies the upstream-backed portfolio winner, deterministic dominant-node and cross-layer output, exact repeated-name pair identity, non-null terminal metadata, bounds, vias, obstacle gating, and strict geometry clearance
  • related physical-capacity, two-chord, and legacy-isolation tests pass
  • bunx tsc --noEmit --pretty false passes
  • bun run build passes
  • git diff --check passes

Run the full regression with:

RUN_BUGREPORT101_CM5_SPI_ROUTING_TIMEOUT=1 bun test tests/bugs/bugreport101-cm5-spi-routing-timeout.test.ts --timeout 9999999

The runtime assertion remains env-gated because wall time is hardware-sensitive. The deterministic exact-node tests use iteration, route-identity, and geometry assertions instead of wall-clock thresholds.

@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
capacity-node-autorouter Ready Ready Preview Aug 29, 2026 9:34pm

Request Review

@tscircuitbot

Copy link
Copy Markdown
Contributor

Benchmark This PR

Run benchmarks by commenting on this PR:

/benchmark [benchmark.sh args...]
/benchmark-long [benchmark.sh args...]
/benchmark-all [benchmark.sh args except --dataset]
/benchmark --same-machine
/benchmark-all --same-machine
/profile --dataset 18

Comment /benchmark to run the default dataset, or append any arguments accepted by ./benchmark.sh.
Comment /benchmark-long for an 8-vCPU run that defaults to 8 workers and has an eight-hour timeout.
Comment /benchmark-all to start separate workflow runs and result comments for the default dataset plus srj18, srj19, srj20, srj21, and srj23. You may append benchmark arguments such as --pipeline 9; --dataset is not accepted because the command selects every configured dataset.
Append --same-machine to /benchmark or /benchmark-all to compare current main and the PR head sequentially on the same 8-vCPU Blacksmith runner.
Comment /profile --dataset 18 to compare direct Pipeline 7 stage-time percentages between current main and the PR head sequentially on one Blacksmith runner.

Everything after /benchmark, /benchmark-long, or /benchmark-all is safely forwarded to ./benchmark.sh, except --profile-solvers, which enables profile comparison tables, and --same-machine, which enables the paired runner.
Examples: /benchmark --dataset 18 --sample-timeout 2000s, /benchmark --pipeline 10 --dataset 29, /benchmark --pipeline 10 --dataset 29 --sample 1, /benchmark --pipeline 7 --limit 20, /benchmark all 20 --concurrency 8, /benchmark --same-machine, /benchmark-all --pipeline 9 --same-machine, and /benchmark-long --dataset 18.

Use /update-snapshots (or /us) to run BUN_UPDATE_SNAPSHOTS=1 bun test --timeout 120_000 on the PR branch and auto-commit snapshot updates.
Use /usf to read recent failed test files, update and verify their exact CI test shards, and auto-commit only their snapshots. It uses the configured fast benchmark runner by default; use /usf --ubuntu-latest for GitHub-hosted x64 CI parity.

Any PR whose title contains [BENCHMARK TEST] will automatically run one default-dataset benchmark on PR updates; it does not post a PR result comment.

@seveibar
seveibar force-pushed the fix/bugreport101-routing-performance branch from da9e5f6 to c8a4046 Compare August 28, 2026 02:57
@seveibar
seveibar force-pushed the fix/bugreport101-routing-performance branch from c8a4046 to 7e35667 Compare August 28, 2026 02:59
@seveibar
seveibar force-pushed the fix/bugreport101-routing-performance branch from 7e35667 to c82a1fb Compare August 28, 2026 03:33
@seveibar
seveibar force-pushed the fix/bugreport101-routing-performance branch from c82a1fb to 4dcfbf0 Compare August 28, 2026 03:35
@seveibar seveibar changed the title perf: bound Pipeline 7 work for bugreport101 feat: add physical-capacity high-density solvers Aug 28, 2026
@seveibar seveibar changed the title feat: add physical-capacity high-density solvers feat: add physical-capacity routing with HighDensitySolverB02 Aug 28, 2026
@seveibar

Copy link
Copy Markdown
Contributor Author

/benchmark --same-machine --dataset 18 --pipeline 9

@seveibar

Copy link
Copy Markdown
Contributor Author

/benchmark --same-machine --dataset 18 --pipeline 7

@tscircuitbot

tscircuitbot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Same Machine Benchmark Results

Both revisions ran sequentially in one Blacksmith job on blacksmith-01m15ak03fkehhpndpd7cz19kv-8vcpu.

Dataset: srj18 · Scenarios: 16
Main: 96645b4 · PR: 343bc51

Solver Metric Main PR Delta
Pipeline7 Completion 81.3% (🕒6.3%) 81.3% (🕒6.3%) 0.0 pp
Pipeline7 Relaxed DRC pass 43.8% (🕒6.3%) 43.8% (🕒6.3%) 0.0 pp
Pipeline7 DRC issues 125 125 0
Pipeline7 Timeouts 1 1 0
Pipeline7 P50 time 95.9s 96.0s +0.0%
Pipeline7 P60 time 104.5s 113.1s +8.3%
Pipeline7 P70 time 165.0s 154.9s -6.1%
Pipeline7 P80 time 225.8s 233.8s +3.6%
Pipeline7 P90 time 291.1s 278.1s -4.4%
Pipeline7 P95 time 329.3s 311.9s -5.3%
Pipeline7 Average vias 210.62 210.62 0.0%

Outcome changes: 0 improved, 0 regressed. DRC issues are totaled across solved samples. Timing percentiles include solved and timed-out samples; negative timing deltas are faster.

Workflow: View run
Artifact: Download raw reports

@tscircuitbot

tscircuitbot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Same Machine Benchmark Results

Both revisions ran sequentially in one Blacksmith job on blacksmith-01m15ak04kwbdw3j30aqytrcdy-8vcpu.

Dataset: srj18 · Scenarios: 16
Main: 96645b4 · PR: 343bc51

Solver Metric Main PR Delta
Pipeline9 Completion 75.0% (🕒12.5%) 75.0% (🕒12.5%) 0.0 pp
Pipeline9 Relaxed DRC pass 50.0% (🕒12.5%) 56.3% (🕒12.5%) +6.3 pp
Pipeline9 DRC issues 74 75 +1
Pipeline9 Timeouts 2 2 0
Pipeline9 P50 time 103.7s 107.7s +3.9%
Pipeline9 P60 time 132.8s 130.5s -1.8%
Pipeline9 P70 time 230.8s 197.9s -14.2%
Pipeline9 P80 time 274.5s 261.2s -4.9%
Pipeline9 P90 time 352.6s 350.6s -0.6%
Pipeline9 P95 time 360.0s 360.0s 0.0%
Pipeline9 Average vias 187.50 186.17 -0.7%

Outcome changes: 1 improved, 0 regressed. DRC issues are totaled across solved samples. Timing percentiles include solved and timed-out samples; negative timing deltas are faster.

Changed outcomes (1)
Solver Sample Main PR Main time PR time Delta
Pipeline9 8 Solved (DRC failed) DRC passed 234.1s 195.9s Improved

Workflow: View run
Artifact: Download raw reports

@seveibar

Copy link
Copy Markdown
Contributor Author

Superseded by focused PRs:

The first five are a clean dependency stack. Pipeline 9 branches from the B02 adapter, while GrowShrink remains independent because Bug 101 currently exposes nodes that still rely on the legacy invalid fallback.

@seveibar seveibar closed this Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants