Skip to content

grt: enable post-DRT antenna repair when using CUGR - #11053

Draft
eder-matheus wants to merge 21 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:grt_cugr_repair_antennas_jumper
Draft

grt: enable post-DRT antenna repair when using CUGR#11053
eder-matheus wants to merge 21 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:grt_cugr_repair_antennas_jumper

Conversation

@eder-matheus

Copy link
Copy Markdown
Member

Summary

When using CUGR, we just skipped post-DRT repair antennas. Now, we repair the antenna violations similar to how FastRoute does:

  • CUGR data structures are initialized with congestion information from wires. This is necessary to prevent new congestion hotspots when rerouting the modified nets.
  • repair_antennas detects the violations from the detail route results and fixes the violations using diode insertion.
  • CUGR reroutes the modified nets, ensuring that all the pins of a net will be covered.

New test repair_antennas_post_drt_cugr covers the flow end to end with real detailed routing: CUGR route → detailed_route → 4 violations on the wires → 4 diodes → second detailed_route → 0 violations on the final wires (~20 s, deterministic; the first post-DRT repair test for either engine).

Type of Change

  • New feature

Impact

CUGR sessions can repair antennas after detailed routing instead of skipping; antenna_diodes_count is reported and repaired nets hand fresh guides to the DRT ECO. Diode-net reroutes account for existing wire demand. FastRoute behavior is unchanged — existing goldens byte-identical, including repair_antennas_from_odb.

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

None.

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 Aug 3, 2026
@github-actions github-actions Bot added the size/M label Aug 3, 2026
@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 implements rebuilding the engine state from detailed routes for CUGR during antenna repair, aligning its behavior with FastRoute. It introduces makeRouteFromWires to convert detailed wires into a gcell-granularity route, and updates the antenna repair and route update flows to handle CUGR state restoration and wire destruction. Additionally, a new integration test is added to verify post-detailed-route antenna repair with CUGR. Feedback was provided regarding a potential null pointer dereference in makeRouteFromWires when retrieving a via shape, which could lead to a segmentation fault.

Comment thread src/grt/src/GlobalRouter.cpp

@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: 1a74885061

ℹ️ 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 Outdated
Comment thread src/grt/src/GlobalRouter.cpp Outdated
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>
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: 112a4e8461

ℹ️ 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
…ate/OpenROAD into grt_cugr_repair_antennas_jumper

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
@openroad-ci
openroad-ci force-pushed the grt_cugr_repair_antennas_jumper branch from 112a4e8 to 6a306b5 Compare August 4, 2026 13:03
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: d740399103

ℹ️ 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".

fastroute_->getNetId(db_net, net_id, exists);
ndr_nets.emplace_back(db_net, net_id);
if (use_cugr_) {
initCUGR(min_layer, max_layer);

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 Reset CUGR state before reinitializing

When repair_antennas is invoked after an earlier global_route -use_cugr/detailed_route, this re-enters initCUGR() on the existing CUGR instance. CUGR::init() appends to gr_nets_, net_indices_, and db_net_map_ without clearing the previous contents, so after this new path the object contains duplicate GRNet entries; a subsequent full CUGR route scans gr_nets_, routes the same indices repeatedly, and can commit stale demand multiple times. Clear or recreate the CUGR state before this re-init.

Useful? React with 👍 / 👎.

Comment on lines +1487 to +1489
for (int level = via_min_layer;
level < std::min(via_max_layer, max_layer);
level++) {

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 Project above-range pins when clamping adopted vias

When a detailed route reaches a top-level pin on max_layer + 1, this loop now clamps the via stack to stop at max_layer, but GRNet still creates that pin's access point on the actual above-range pin layer and restoreNetRoute() requires one of those AP cells to be present in the restored tree. Fresh evidence beyond the earlier via-bound issue is that the new coverage validation rejects the clamped tree even though buildTreeFromRoute() no longer rejects the via segment, so the net falls into the failed-adoption path and its detailed-route demand is not modeled during antenna repair; project the coverage AP to the routing ceiling as well.

AGENTS.md reference: AGENTS.md:L20-L20

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.

1 participant