Skip to content

grt: fix CUGR min routing layer index#10421

Merged
eder-matheus merged 4 commits into
The-OpenROAD-Project:masterfrom
eder-matheus:grt_cugr_layer_idx
May 13, 2026
Merged

grt: fix CUGR min routing layer index#10421
eder-matheus merged 4 commits into
The-OpenROAD-Project:masterfrom
eder-matheus:grt_cugr_layer_idx

Conversation

@eder-matheus
Copy link
Copy Markdown
Member

Summary

Fix two layer-indexing off-by-one bugs in CUGR that caused the lowest routing layer to be silently excluded.

  1. src/grt/src/cugr/src/Design.cpp (lines 88-93 and 166-167) — Design::min/max_routing_layer_ hold 1-based ODB routing levels, but GRNet::layer_range_ is compared against 0-based grid-graph indices in isInsideLayerRange. The clock-net branch already did the conversion; the signal-net branch did not. Subtract 1 to match.
  2. src/grt/src/cugr/src/CUGR.cpp (line 85) — Constants::min_routing_layer (0-based) was never synced with the user's min routing layer, so pin patches, wire patches, and PatternRoute floors fell back to M2 regardless of input.

Type of Change

  • Bug fix

Impact

For the default OpenROAD flow (min_routing_layer = metal2), CUGR previously excluded metal2 from signal routing. Restoring it on the default cugr_adjustment3 test:

  • Total via count −33 % (4648 → 3095)
  • Total overflow −7 % (481 → 445)
  • M2 V usage 0 % → 59 %, M4/M6 drained correspondingly

For tests that explicitly set -signal met1-..., met1 is now actually used. pin_access2_cugr overflow drops 2 → 0; critical_nets_percentage_cugr overflow drops 400 → 120. Every affected CUGR test improves or stays flat on QoR; no regressions.

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass — all 123 GRT tests green after baseline refresh on the 10 affected CUGR tests.
  • My code follows the repository's formatting guidelines.
  • I have included tests to prevent regressions — existing CUGR tests now exercise the previously-excluded layers; baselines updated to capture the corrected 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>
@eder-matheus eder-matheus requested a review from a team as a code owner May 13, 2026 18:52
@eder-matheus eder-matheus requested a review from jfgava May 13, 2026 18:52
@github-actions
Copy link
Copy Markdown
Contributor

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

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 adjusts layer indexing within the CUGR routing engine by subtracting 1 from routing layer constants and ranges in CUGR.cpp and Design.cpp. These changes significantly impact routing results across various test cases, generally leading to reduced via counts and altered layer demand. Feedback was provided regarding a potential bug in Design.cpp::updateNet, where the absence of clock layer constraints could result in an invalid negative layer index; it is recommended to implement a check consistent with the logic in readNetlist to ensure indices remain valid.

Comment thread src/grt/src/cugr/src/Design.cpp Outdated
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
@github-actions github-actions Bot added size/S and removed size/XS labels May 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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

@eder-matheus eder-matheus enabled auto-merge May 13, 2026 21:28
@github-actions
Copy link
Copy Markdown
Contributor

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

@eder-matheus eder-matheus merged commit 52e5336 into The-OpenROAD-Project:master May 13, 2026
15 of 16 checks passed
@eder-matheus eder-matheus deleted the grt_cugr_layer_idx branch May 14, 2026 00:38
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