Skip to content

grt: ensure CUGR/FastRoute paths will not call functions from the wrong engine#10756

Merged
eder-matheus merged 5 commits into
The-OpenROAD-Project:masterfrom
eder-matheus:grt_cugr_fix
Jun 25, 2026
Merged

grt: ensure CUGR/FastRoute paths will not call functions from the wrong engine#10756
eder-matheus merged 5 commits into
The-OpenROAD-Project:masterfrom
eder-matheus:grt_cugr_fix

Conversation

@eder-matheus

Copy link
Copy Markdown
Member

Summary

Isolate the CUGR global-routing engine from the FastRoute engine so that running one never invokes the other's initialization or routing functions. Previously the use_cugr path still fell through FastRoute-only setup (grid mirroring, FastRoute netlist build, edge/regularity setup, resistance-aware/suggest-adjustment calls) that CUGR neither needs nor reads.

Key changes:

  • Extract FastRoute grid mirroring into mirrorGridToFastRoute(), called only from initFastRoute/initGridAndNets; initCoreGrid/initGrid are now engine-agnostic.
  • Move initNetlist() out of the shared initNets() into the FastRoute path.
  • Relocate setResistanceAware into the FastRoute branch of updateDirtyRoutes, guard suggestAdjustment, and skip fastroute_->clear() on the CUGR path.
  • getPartialRoutes() now sources incremental partial routes from CUGR instead of fastroute_->getPlanarRoute(), so incremental CUGR parasitics estimation sees real routes rather than empty FastRoute trees.
  • Keep computeUserGlobalAdjustments on the CUGR path (it is engine-agnostic: it propagates the global adjustment into the per-layer tech-layer values CUGR reads); the FastRoute-only obstruction pass stays out of the CUGR path.
  • Report net degree and macro/blockage counts for CUGR via engine-agnostic helpers, so those diagnostics are emitted from a single shared code path for both engines.

After these changes, neither the full-route nor the incremental flow of one engine executes any init/routing function of the other; the only shared presence is that both engine objects are still constructed.

Type of Change

  • Bug fix
  • Refactoring

Impact

  • No QoR change for non-incremental routing: guides are identical for both engines.
  • Incremental CUGR parasitics now use real CUGR routes instead of empty FastRoute trees, which can shift slack-driven critical-net selection (a correctness improvement on the incremental path).
  • CUGR still emits the macro/blockage/net-degree diagnostics; log output is unchanged.

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 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>
@eder-matheus

Copy link
Copy Markdown
Member Author

@codex review

@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 refactors the global router to make grid mirroring, net degree calculation, and macro/blockage reporting engine-agnostic, enabling consistent behavior and reporting across both FastRoute and CUGR engines. It introduces helper methods such as mirrorGridToFastRoute, computeNetDegree, reportNetDegree, and reportMacrosAndBlockages to clean up and unify these tasks, and updates partial routing and congestion adjustments to correctly handle CUGR-specific flows. The review feedback points out a potential issue in reportNetDegree where min_degree could remain set to std::numeric_limits::max() if no nets satisfy the routing criteria, leading to incorrect log outputs, and suggests a fix to reset both min and max degrees to 0 in this scenario.

Comment thread src/grt/src/GlobalRouter.cpp
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>

@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: 428c29eed3

ℹ️ 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/GlobalRouter.cpp
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
@eder-matheus eder-matheus marked this pull request as ready for review June 25, 2026 20:08
@eder-matheus eder-matheus requested a review from a team as a code owner June 25, 2026 20:08
@eder-matheus eder-matheus requested a review from jfgava June 25, 2026 20:08
@eder-matheus eder-matheus merged commit aea03d0 into The-OpenROAD-Project:master Jun 25, 2026
16 checks passed
@eder-matheus eder-matheus deleted the grt_cugr_fix branch June 25, 2026 22:02
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