Skip to content

grt: enhance CUGR's congestion handling#10425

Open
eder-matheus wants to merge 9 commits into
The-OpenROAD-Project:masterfrom
eder-matheus:grt_cugr_congestion
Open

grt: enhance CUGR's congestion handling#10425
eder-matheus wants to merge 9 commits into
The-OpenROAD-Project:masterfrom
eder-matheus:grt_cugr_congestion

Conversation

@eder-matheus
Copy link
Copy Markdown
Member

@eder-matheus eder-matheus commented May 14, 2026

Summary

Adds CUGR's missing stage-4 iterative rip-up and re-route (RRR) loop, plus the supporting infrastructure to fight per-layer overflow concentration on heavily-adjusted designs.

Changes on src/grt/src/cugr/:

  • New stage 4 (CUGR::iterativeRRR) wraps the maze stage in a loop that sharpens the logistic cost slope per iteration (via the new GridGraph::setCostMultiplier) and widens the rip-up set to nets touching near-overflow edges (via the new GridGraph::checkCongestion(tree, threshold) + CUGR::updateCongestedNets). Emits GRT-0117 per iteration and GRT-0118 if overflow remains, mirroring FastRoute's GRT-0102 style.
  • Iteration budget honors the existing -congestion_iterations flag; when -use_cugr is set with no explicit value the default is 5 (FastRoute keeps its default of 50).
  • GridGraph adjustment loop now mirrors FastRoute's floor-to-1 rule (GlobalRouter.cpp:1812): edges with any pre-adjustment capacity keep at least 1 usable track unless the user explicitly asked for 100% reduction.
  • CUGR::saveCongestion rounds per-edge overflow with ceil(demand - cap) so the marker tree still gets entries when overflow is fractional.
  • CUGR::debugCongestion2D (gated on set_debug_level GRT rrr_2d 1) reports the gap between 3D overflow and 2D-aggregate overflow — the spreadable portion of the residual.
  • PatternRoute::calculateRoutingCosts reads the per-net layer range (GRNet::getLayerRange) and branches fixed_layers.isValid() so non-pin Steiner nodes don't get clamped to an inverted interval.

Type of Change

  • New feature
  • Bug fix

Impact

For the canonical stress test (cugr_adjustment3, gcd_nangate45 + 90% layer adjustment): total overflow drops from 445 → 18 units (-96%); wirelength is essentially unchanged (+0.3%); via count rises 36% (4225 vs 3095) as the router accepts longer paths and more vias to absorb redistributed traffic. Other CUGR designs that were already clean remain so. RRR is a no-op when totalOverflow() == 0, so default-flow designs incur only the gate check.

-congestion_iterations N now also drives CUGR (it was FastRoute-only before).

12 .ok / .guideok baselines on the CUGR test suite refreshed to capture the new routings.

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have included tests to prevent regressions — the existing CUGR tests (cugr_adjustment1-3, critical_nets_percentage_cugr, clock_route_cugr*, etc.) now exercise the RRR loop and the adjustment-floor path; their baselines are updated to lock the new behaviour.
  • I have signed my commits (DCO).

Related Issues

None.

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
…le in the routing layers

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
@eder-matheus eder-matheus requested a review from a team as a code owner May 14, 2026 02:41
@eder-matheus eder-matheus requested a review from jfgava May 14, 2026 02:41
@eder-matheus eder-matheus changed the title Grt cugr congestion grt: enhance congestion handling of CUGR May 14, 2026
@eder-matheus eder-matheus changed the title grt: enhance congestion handling of CUGR grt: enhance CUGR's congestion handling May 14, 2026
Copy link
Copy Markdown
Contributor

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

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 an iterative Rip-up and Re-route (RRR) mechanism to the CUGR global router, aimed at resolving persistent congestion by sharpening cost gradients and widening the rip-up set across multiple iterations. Key additions include a 2D congestion diagnosis tool, a configurable iteration limit, and a 'floor-to-1' capacity adjustment rule to ensure at least one usable track remains on adjusted layers. Feedback identifies a critical bug in the congestion reporting logic where the removal of a guard clause causes all edges to report overflow regardless of actual demand. Additionally, it is recommended to refine the early-exit condition in the RRR loop to consistently ignore fractional overflows below 1.0.

Comment thread src/grt/src/cugr/src/CUGR.cpp
Comment thread src/grt/src/cugr/src/CUGR.cpp
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

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.

1 participant