Skip to content

grt/cugr: improve via demand calculation#10802

Draft
eder-matheus wants to merge 12 commits into
The-OpenROAD-Project:masterfrom
eder-matheus:grt_cugr_vias
Draft

grt/cugr: improve via demand calculation#10802
eder-matheus wants to merge 12 commits into
The-OpenROAD-Project:masterfrom
eder-matheus:grt_cugr_vias

Conversation

@eder-matheus

Copy link
Copy Markdown
Member

Summary

CUGR previously modeled a via's global-routing demand as a min-area-derived stub length inflated by a flat via_multiplier = 2.0 — a proxy with no perpendicular (track-blocking) term. This replaces it with a model built from the via's real enclosure geometry read from the tech:

demand = (enclosure_along / gcell) * ((enclosure_perp + 2*spacing) / pitch)

i.e. "how much of a track's length the pad spans" times "how many tracks it blocks across." This removes the magic via_multiplier on the geometry path and better approximates the resource a via consumes at detailed routing. The via
geometry is extracted once in Design; GridGraph consumes the digested per-layer demand.

Also included:

  • Via selection ranks candidates (OR_DEFAULT, then LEF-default, then fewest cuts, then smallest enclosure) instead of relying on ODB declaration order.
  • Spacing falls back to the parallel-run-length value when the plain spacing rule is 0 (advanced techs), so the perpendicular term is not silently dropped.
  • Warns (GRT-173) when a layer pair has no via and the legacy min-area proxy is used as a fallback.

Type of Change

  • New feature
  • Refactoring

Impact

Affects CUGR only (global_route -use_cugr); the default FastRoute path is unchanged. Via-demand magnitudes change per layer, which shifts CUGR routing, congestion, and guides: neutral on uncongested designs, improved on realistically congested designs (lower reported overflow and wirelength, e.g. aes-class designs 58->27 and 101->42 overflow with shorter wirelength), and higher reported congestion only on an extreme 90%-capacity stress test (the model correctly charging fat upper-metal vias under starvation; RRR still converges). Resistance-aware timing is preserved. A new warning (GRT-173) is emitted for techs with no via for a routing-layer pair. All CUGR test goldens were regenerated.

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

N/A

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>
…op dead field

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
…er default

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

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
@github-actions github-actions Bot added the size/M label Jul 3, 2026
@eder-matheus

Copy link
Copy Markdown
Member Author

@codex review

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba01782fdc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/grt/src/cugr/src/Design.cpp Outdated
Comment on lines +418 to +422
lo_dx = r.dx();
lo_dy = r.dy();
} else if (box->getTechLayer() == upper_tl) {
up_dx = r.dx();
up_dy = r.dy();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Accumulate via metal extents across all boxes

When the selected tech via has more than one RECT on a routing layer, this loop overwrites lo_dx/lo_dy or up_dx/up_dy with whichever dbBox is visited last. That makes the new via-demand model charge a single rectangle rather than the via's full routing-layer footprint, so compound/default vias can have congestion and cost under-reported in a way that depends on box order. Please union/accumulate the routing-layer bbox before calling viaDemandLength.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We would support such a non-standard via.

@maliberty

Copy link
Copy Markdown
Member

(perp + 2 * spacing) / pitch

Do you want to use ceil? You can't really partially block a track.

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

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 63bd0c554a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +383 to +384
const std::tuple<bool, bool, int, int64_t> key{
!or_default, !via->isDefault(), cuts, enc_area};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Prefer single-cut vias before LEF defaults

When a layer has both a LEF DEFAULT multi-cut via and any single-cut via, this tuple selects the default multi-cut via because !via->isDefault() is ranked before cuts. I checked DRT's initDefaultVias in src/drt/src/io/io_parser_helper.cpp:95-106: it groups candidates by cut count and always chooses from the 1-cut group when available, with getViaRawPriority only ordering inside that group. In that scenario CUGR now charges congestion for a different footprint than detailed routing will use, which can push routes away from vias DRT would actually place.

Useful? React with 👍 / 👎.

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