Skip to content

grt: add incremental routing support to CUGR#9679

Closed
sparsh-karna wants to merge 7 commits intoThe-OpenROAD-Project:masterfrom
sparsh-karna:grt/incremental-cugr
Closed

grt: add incremental routing support to CUGR#9679
sparsh-karna wants to merge 7 commits intoThe-OpenROAD-Project:masterfrom
sparsh-karna:grt/incremental-cugr

Conversation

@sparsh-karna
Copy link

Adds incremental global routing support to the CUGR backend, mirroring the
existing FastRoute incremental API.

Changes

  • Add addDirtyNet() to mark nets needing reroute
  • Add startIncremental() / endIncremental() to CUGR state machine
  • Sort dirty nets by slack before rip-up (improves incremental quality)
  • Add helper method for incremental reroute logic
  • New net topology refresh APIs for buffer insertion changes

Reopens #9645 (accidentally closed during branch cleanup).

sparsh-karna and others added 7 commits March 5, 2026 23:03
Add addDirtyNet(), startIncremental(), and endIncremental() methods
to support incremental global routing in the CUGR engine, along with
dirty_net_indices_ and incremental_mode_ state tracking.

Signed-off-by: TheUnnamedOne-design <aditya07.11.04.12@gmail.com>
Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
Signed-off-by: TheUnnamedOne-design <aditya07.11.04.12@gmail.com>
Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
…rtion

When repair_timing inserts a buffer, a net is split into two. The previous
incremental flow rerouted the stale GRNet objects from init() — pin list,
access points, and bounding box all predated the insertion.

Implement Design::updateNet() and CUGR::updateNet() to refresh per-net
CUGRNet/GRNet state from the database before rerouting. Wire into
endIncremental() and expose as grt::update_net Tcl command.

Also add null guard in GridGraph::commitTree() for freshly rebuilt nets
and a regression test exercising the full incremental update path.

Signed-off-by: Sparsh Karna <sparsh2005karna@gmail.com>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 adds incremental global routing support to the CUGR backend, mirroring the existing FastRoute API. The changes are well-structured, introducing new logic for CUGR within GlobalRouter and implementing the core incremental functionality in the cugr component. The addition of a test case for net topology updates is also a good validation of the new feature. The suggestions to improve performance and code clarity remain valid.

Note: Security Review did not run due to the size of the PR.

Comment on lines +692 to +694
for (const int idx : dirty_net_indices_) {
updateNet(gr_nets_[idx]->getDbNet());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This loop iterates over dirty_net_indices_ to refresh net data before rerouting. While this is safe for std::set as iterators are not invalidated on insertion, it can be confusing. Iterating over the nets_to_route vector, which is a copy of the dirty nets at the beginning of the function, would be clearer and more robust against future changes. This ensures you are iterating over a fixed set of nets.

  for (const int idx : nets_to_route) {
    updateNet(gr_nets_[idx]->getDbNet());
  }

Comment on lines +205 to +211
for (CUGRNet& net : nets_) {
if (net.getDbNet() == db_net) {
net.setPins(std::move(pins));
net.setLayerRange(layer_range);
return;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This loop performs a linear scan over all nets to find the one to update. This can be inefficient if there is a large number of nets, leading to O(N) complexity for each update. To improve performance, consider using a map (e.g., std::unordered_map<odb::dbNet*, int>) to store the mapping from dbNet* to its index in the nets_ vector. This map could be populated in readNetlist and maintained in updateNet, allowing for an average O(1) lookup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants