Skip to content

grt: resistance-aware final 3D pass once, on its own nets: finalisation 62.1 -> 32.4 s - #12121

Closed
oharboe wants to merge 2 commits into
The-OpenROAD-Project:masterfrom
oharboe:grt-res-aware-3d-once
Closed

oharboe wants to merge 2 commits into
The-OpenROAD-Project:masterfrom
oharboe:grt-res-aware-3d-once

Conversation

@oharboe

@oharboe oharboe commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

With -resistance_aware, on an asap7 block that routes without overflow (61,321 nets):

before after
FastRoute finalisation 62.1 s 32.4 s
period at global route 992.1 ps 993.3 ps (+0.12 %)
period with the pass skipped entirely 1,004.2 ps

Without -resistance_aware nothing changes.

Why

After a 2D route without overflow, FastRoute reroutes in 3D twice, edges under 40 gcells and then under 12. Resistance-aware routing lifts both thresholds, so both passes rip up every edge of every net with negative slack; the second pass only widens the resistance-aware set from 30 % of the critical nets to all of them. On the block above that was 58.8 of FastRoute's 60.5 s, and 31,030 of the 37,198 nets ripped up in the first pass were not resistance-aware: rerouted with the legacy cost on a route with no overflow to relieve.

Change

One commit: with resistance-aware routing on, the final 3D pass runs once, on the nets resistance-aware routing selected (res_aware_nets_only_ in mazeRouteMSMDOrder3D).

The result is not identical

It reroutes fewer nets on purpose, so routes and timing move. The question for review is whether +0.12 % period on the block above, inside an opt-in mode, is acceptable for half the finalisation time.

Tests

  • TestResistanceMode: an unselected net routed on M3 keeps its route through the pass; control: the same net is rerouted onto M1 with resistance-aware routing off.
  • res_aware_nets_percentage and resistance_aware_asap7_fr goldens regenerated: wirelength 24,782 -> 24,984 um on the first; TNS -2,619.2 -> -2,626.5 ps, WNS unchanged, on the second.
  • repair_design6, repair_setup_reroute1 and repair_setup_reroute2 (rsz) no longer diff a log: they check that the reroute reroutes nets and fixes the slew and capacitance violations, or improves WNS and TNS. Without the reroute, the reroute check fails.
  • All grt tests pass.

The integration test, with the measurement, is The-OpenROAD-Project/bazel-orfs#1490.

🤖 Generated with Claude Code

When the 2D route ends without overflow, FastRoute reroutes in 3D in
two passes, edges shorter than 40 gcells and then shorter than 12.
With resistance-aware routing on, both thresholds are lifted: both
passes rip up every edge of every net with negative slack, and the
second only widens the resistance-aware set (30 % of the critical nets
to all of them). On a block that routes without overflow that is most
of global route: 58.8 of 60.5 s of FastRoute on an asap7 block of
61,321 nets. In the first pass 31,030 of the 37,198 nets ripped up are
not resistance-aware (a quarter of the 194 M gcells searched): they are
rerouted with the legacy cost on a route with no overflow to relieve.

The pass now runs once and on the nets resistance-aware routing
selected; without resistance-aware routing it is unchanged. On that
block: finalisation 62.1 -> 32.4 s, period at global route 992.1 ->
993.3 ps (+0.12 %); skipping the pass entirely would cost 1,004.2 ps.

TestResistanceMode checks that an unselected net routed on M3 keeps
its route through the pass, with a control that the same net is
rerouted onto M1 when resistance-aware routing is off. The goldens of
res_aware_nets_percentage and resistance_aware_asap7_fr are
regenerated: wirelength 24,782 -> 24,984 um on the first, TNS
-2,619.2 -> -2,626.5 ps with WNS unchanged on the second.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the size/M label Nov 4, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the 'finalMazeRoute3D' method to handle final 3D maze routing, optimizing the process when resistance-aware routing is enabled by only rerouting selected nets. It also includes comprehensive unit tests and updates to test golden files. The review feedback suggests minor code improvements: using 'std::move' to avoid copying a local vector, explicitly casting a variable to prevent narrowing conversion warnings in tests, and aligning function definition parameter constness with its declaration for consistency.

Comment thread src/grt/test/cpp/TestResistanceMode.cpp Resolved
Comment thread src/grt/test/cpp/TestResistanceMode.cpp Resolved
Comment thread src/grt/src/fastroute/src/FastRoute.cpp Resolved
@oharboe
oharboe marked this pull request as ready for review November 4, 2026 09:14
@oharboe
oharboe requested a review from a team as a code owner November 4, 2026 09:14
@oharboe
oharboe requested a review from eder-matheus November 4, 2026 09:14
@eder-matheus
eder-matheus requested a review from jfgava November 4, 2026 09:17
repair_design6, repair_setup_reroute1 and repair_setup_reroute2 diffed
their log against a .ok, so any change in which nets the resistance-aware
reroute picks failed them. They now check what the reroute is for:

- repair_design6: the design starts with max slew and capacitance
  violations, repair_design -reroute reroutes nets (RSZ-0044), and no
  violation remains.
- repair_setup_reroute1/2: the design starts with setup violations,
  repair_timing reroutes nets resistance-aware (RSZ-0053), and WNS and
  TNS both improve.

Controls: without -reroute (repair_design6) or without the
repair_timing call (repair_setup_reroute2) the reroute check fails with
"Expected 1, got 0".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018PFLaDvDKchGAEykuBJfiJ
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe
oharboe requested a review from a team as a code owner November 4, 2026 15:41
@oharboe
oharboe requested a review from precisionmoon November 4, 2026 15:41
@jfgava

jfgava commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

We need to be careful here. I did a similar experiment before. The multiple maze3D calls significantly improve timing QoR on some private designs. Especially when we have many critical nets and not enough resources for everyone on the upper layers. We do a better job when slowly promoting critical nets in multiple steps. I can run some private tests to see the real impact.

@oharboe

oharboe commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

@jfgava Thank you for the direction. I'm closing this PR, it sounds like whatever is done, it will be something different than this.

@oharboe oharboe closed this Nov 4, 2026
@oharboe

oharboe commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

@jfgava confirmed on a small asap7 block (Uncache from XiangShan, 74k cells): global route alone from its CTS result, with 3D pass variants behind a switch. Upper-layer capacity has to be short and many nets critical for the second pass to matter. As the block comes, almost no net has negative slack, so I tightened the clock to 850 ps (S1), then also squeezed M8–M9 to 0.9 adjustment (S2), the most that still routes without 2D overflow.

nets rerouted (pass 1 + 2) period at grt TNS finalisation
S1, master 11,256 + 8,474 960.8 ps −141,467 ps 24.0 s
S1, this PR (one pass) 2,314 962.7 ps −144,869 ps 13.5 s
S1, two passes, selected nets only 2,314 + 3,622 960.6 ps −141,208 ps 22.8 s
S2, master 17,693 + 16,465 1,005.9 ps −244,868 ps 34.0 s
S2, this PR (one pass) 3,225 1,006.5 ps −245,056 ps 16.4 s
S2, two passes, selected nets only 3,225 + 6,604 1,006.0 ps −244,657 ps 30.3 s

Period and TNS are deterministic; finalisation is the best of three runs on a shared machine.

  • One pass costs about 2 ps and 2.4 % TNS once many nets are critical, as you said.
  • Keeping both passes but skipping the unselected nets matches master's QoR and saves 5–11 % of finalisation: the selected nets do most of the search.
  • Each pass also carries a fixed cost of about 4 s on this block, even when it reroutes no net; probably the slack update at its start, not examined.

Closed stays closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants