Skip to content

GRT: Fix FastRoute blocked tracks computation - #11093

Merged
maliberty merged 14 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:grt-m1-congestion
Aug 12, 2026
Merged

GRT: Fix FastRoute blocked tracks computation#11093
maliberty merged 14 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:grt-m1-congestion

Conversation

@jfgava

@jfgava jfgava commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

The problem. initBlockedIntervals converts blocked metal into a track count so it can reduce a gcell edge's capacity. horizontal_blocked_intervals_ / vertical_blocked_intervals_ are interval_set<int> — sets of disjoint intervals — and the old code rounded up each interval separately:

for (const auto& interval_it : intervals) {
  reduce += std::ceil(len(interval_it) / track_space[layer - 1]);
}

Every fragment therefore paid a full track's round-up, so the charge depended on how the blocked region happened to be fragmented, not on how much of it was covered. That makes it non-monotonic: deleting metal that bridged two fragments splits the span, both halves round up independently, and capacity drops even though less metal is blocking.

The fix. Sum the covered length across all intervals first, then round to tracks once:

int64_t blocked_length = 0;
for (const auto& interval_it : intervals) {
  blocked_length += std::abs(interval_it.upper() - interval_it.lower());
}
return std::ceil(static_cast<double>(blocked_length) / track_space);

The charge is now a function of coverage alone, so it can never rise when metal is removed. Extracted into blockedTrackCount() and used by both the vertical and horizontal loops — the defect was symmetric and both are fixed. int64_t accumulation avoids overflow on wide spans.

Scope. Removes the fragmentation artifact; still position-blind (it approximates blocked tracks as length/pitch rather than testing real track coordinates). Exact track counting remains the optional follow-up, which would need the per-layer track origin plumbed into FastRouteCore.

Type of Change

  • Bug fix

Impact

Properly adjust g-cell capacity. This mainly impacts Metal 1 resources.

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).

Related Issues

#10273

jfgava added 9 commits August 5, 2026 22:23
Signed-off-by: Jonas Gava <jfgava@precisioninno.com>
Signed-off-by: Jonas Gava <jfgava@precisioninno.com>
…justment fix

Signed-off-by: Jonas Gava <jfgava@precisioninno.com>
Signed-off-by: Jonas Gava <jfgava@precisioninno.com>
This reverts commit dd6e7b2.

Signed-off-by: Jonas Gava <jfgava@precisioninno.com>
…m li1

Signed-off-by: Jonas Gava <jfgava@precisioninno.com>
Signed-off-by: Jonas Gava <jfgava@precisioninno.com>
Signed-off-by: Jonas Gava <jfgava@precisioninno.com>
@jfgava jfgava self-assigned this Aug 7, 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 a new helper function blockedTrackCount in FastRoute.cpp to calculate the number of blocked tracks by summing the covered length of disjoint intervals and rounding once, which prevents over-charging and non-monotonic behavior. It also updates several test outputs and configuration files to reflect these routing changes. The review feedback identifies a critical issue where a non-positive track_space could lead to a division-by-zero error in the new helper function, and suggests a safe guard check to prevent potential crashes.

Comment thread src/grt/src/fastroute/src/FastRoute.cpp
jfgava added 3 commits August 7, 2026 14:09
Signed-off-by: Jonas Gava <jfgava@precisioninno.com>
Signed-off-by: Jonas Gava <jfgava@precisioninno.com>
@jfgava
jfgava marked this pull request as ready for review August 7, 2026 18:55
@jfgava
jfgava requested review from a team as code owners August 7, 2026 18:55
@jfgava

jfgava commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

I'm running a CI. I'll need to update some metrics. But it seems ok

@maliberty
maliberty enabled auto-merge August 12, 2026 17:30
@maliberty
maliberty merged commit 5beabfb into The-OpenROAD-Project:master Aug 12, 2026
16 checks passed
@maliberty
maliberty deleted the grt-m1-congestion branch August 12, 2026 18:19
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.

4 participants