grt: add incremental deleted-net cleanup for CUGR#10578
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements net removal support in the CUGR global router by adding removeNet methods to the CUGR and Design classes and tracking deleted nets. The review feedback highlights a critical dangling pointer hazard caused by deferring net deletion via pending_deleted_nets_, recommending synchronous removal instead. Additionally, the feedback suggests several performance optimizations, such as replacing std::map with std::unordered_map to reduce lookup overhead and using std::move to avoid expensive copies of pin vectors during net deletion.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
@sparsh-karna Please resolve the conflicts. Merge the latest master into your branch. |
070df87 to
ad1e1a5
Compare
updated |
ad1e1a5 to
1d08380
Compare
Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
- Remove pending_deleted_nets_ to process net removal synchronously in inDbNetDestroy, avoiding dangling pointer issues during ECO. - Switch from std::map to std::unordered_map in CUGR for O(1) net lookups. - Use std::move for pin vectors in Design::removeNet to avoid expensive deep copies. Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
1d08380 to
5c7983d
Compare
- Move CUGR net removal logic from GRouteDbCbk into GlobalRouter::removeNet. - Centralize net deletion handling for both FastRoute and CUGR engines. - Ensure null safety in GlobalRouter::removeNet. Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
- Switch to a simpler net removal approach by invalidating nets in vectors instead of rebuilding the entire vector (matching FastRoute behavior). - Add isValid() checks to CUGR and Design loops to handle invalidated nets. - Remove const from CUGRNet/CUGRPin index_ to support move/assignment during reallocation. Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
|
@codex review |
Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c5aa82a8b
ℹ️ 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".
Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
- Encapsulate FastRoute-specific net removal logic in an else block inside GlobalRouter::removeNet. - Prevents unnecessary lookups and processing of db_net_map_ when CUGR is active. Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
eder-matheus
left a comment
There was a problem hiding this comment.
The remaining changes look good. Please look at my last request.
|
|
||
| GRNet* gr_net = it->second; | ||
| if (gr_net->getRoutingTree()) { | ||
| grid_graph_->removeTreeUsage(gr_net->getRoutingTree()); |
There was a problem hiding this comment.
The NDR costs pointed by Codex weren't fixed yet. Please update the removeTreeUsage call with the suggested getNdrCosts
Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
- Replace find() != end() and find() == end() with contains() where applicable to satisfy readability-container-contains. - Replace count() with contains() for boolean membership checks. - Run clang-format on modified files. Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
Implements CUGR::removeNet so that when a net is destroyed during ECO (buffer removal, gate downsizing), its routing tree demand is synchronously decremented from the GridGraph and all internal CUGR mappings are cleaned up before the next -end_incremental call. Wires the existing inDbNetDestroy ODB callback in GlobalRouter behind the use_cugr_ flag. Adds regression test incremental_deleted_net.tcl.
NOTE: The test suite for this functionality is not added in this pr, and will be added after the changes are finalized and approved for testing.
All 122 GRT regression tests pass locally.