Skip to content

grt: implement resistance-aware for CUGR#10594

Draft
eder-matheus wants to merge 17 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:grt_cugr_resistance_aware
Draft

grt: implement resistance-aware for CUGR#10594
eder-matheus wants to merge 17 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:grt_cugr_resistance_aware

Conversation

@eder-matheus
Copy link
Copy Markdown
Member

Summary

Implement resistance-aware cost to CUGR routing flow.

Type of Change

  • New feature
  • Breaking change

Impact

When using -resistance_aware flag, CUGR now responds with computing costs and prioritizing nets, in order to prioritize low-resistance metal layers for long, high fanout, critical nets. The core logic tries to mimic how FastRoute handles resistance aware, but the costs are mainly applied to the PatterRoute stages.

New unit tests were added for validation. CI is running.

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.
  • I have signed my commits (DCO).

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>
…es-aware

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
…ware cost

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>
…tween congestion and timing

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 self-assigned this Jun 4, 2026
@github-actions github-actions Bot added the size/L label Jun 4, 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 implements a resistance-aware routing feature in the CUGR global router, allowing critical nets to be biased toward lower-resistance upper metal layers. Key changes include calculating wire and via resistance costs, computing resistance-aware net scores, and integrating these costs into pattern routing, alongside several timing and mechanism validation tests. Feedback on these changes highlights opportunities to improve robustness: specifically, finding the first non-zero layer resistance as a reference instead of assuming layer 0 is valid, adding defensive null-checks for the STA network access, and ensuring markResAwareNets early-returns when the critical net percentage is zero to avoid incorrectly marking nets.

Comment on lines +533 to +538
const double ref = design_->getLayer(0).getViaResistance();
const double via_r = design_->getLayer(lower_layer).getViaResistance();
// Techs that leave cut-layer resistance unpopulated make this 0
if (ref <= 0.0 || via_r <= 0.0) {
return 0;
}
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.

high

Using design_->getLayer(0).getViaResistance() as the reference ref is risky. In many PDKs, the bottom-most layer (layer 0) or its contact/via layer might have zero or undefined via resistance, while higher routing layers have valid via resistances. If layer 0's via resistance is 0.0, ref becomes 0.0, which silently disables the via resistance penalty for all layers. We should iterate through the layers to find the first non-zero via resistance to use as the reference.

Suggested change
const double ref = design_->getLayer(0).getViaResistance();
const double via_r = design_->getLayer(lower_layer).getViaResistance();
// Techs that leave cut-layer resistance unpopulated make this 0
if (ref <= 0.0 || via_r <= 0.0) {
return 0;
}
double ref = 0.0;
for (int l = 0; l < getNumLayers(); ++l) {
ref = design_->getLayer(l).getViaResistance();
if (ref > 0.0) {
break;
}
}
const double via_r = design_->getLayer(lower_layer).getViaResistance();
// Techs that leave cut-layer resistance unpopulated make this 0
if (ref <= 0.0 || via_r <= 0.0) {
return 0;
}

Comment thread src/grt/src/GlobalRouter.cpp
Comment on lines +170 to +172
if (!resistance_aware_) {
return;
}
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.

medium

If percentage is 0.0f, the function still executes and will mark the worst net(s) as critical/res-aware because threshold_index becomes 0 and slack_th is set to slacks[0]. This contradicts the warning in CUGR::route() which states that -resistance_aware has no effect when -critical_nets_percentage is 0. We should early return if percentage <= 0.0f.

  if (!resistance_aware_ || percentage <= 0.0f) {
    return;
  }

Comment on lines +506 to +511
// Layer-0 sheet resistance is the reference (matches FastRoute); 0 if
// any input is undefined.
const double ref = design_->getLayer(0).getResistance();
if (width <= 0.0 || ref <= 0.0 || layer.getResistance() <= 0.0) {
return 0;
}
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.

medium

For consistency and robustness, we should also find the first non-zero routing layer resistance as the reference ref in case layer 0 has zero or undefined resistance.

  // Find the first non-zero sheet resistance as the reference (matches FastRoute); 0 if
  // any input is undefined.
  double ref = 0.0;
  for (int l = 0; l < getNumLayers(); ++l) {
    ref = design_->getLayer(l).getResistance();
    if (ref > 0.0) {
      break;
    }
  }
  if (width <= 0.0 || ref <= 0.0 || layer.getResistance() <= 0.0) {
    return 0;
  }

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