Skip to content

grt: replace logger report with logger info and fix asserts in CUGR#9945

Draft
Divinesoumyadip wants to merge 2 commits intoThe-OpenROAD-Project:masterfrom
Divinesoumyadip:grt/fix-cugr-logger-report-to-info
Draft

grt: replace logger report with logger info and fix asserts in CUGR#9945
Divinesoumyadip wants to merge 2 commits intoThe-OpenROAD-Project:masterfrom
Divinesoumyadip:grt/fix-cugr-logger-report-to-info

Conversation

@Divinesoumyadip
Copy link
Copy Markdown
Contributor

@Divinesoumyadip Divinesoumyadip commented Mar 25, 2026

CUGR.cpp used logger_->report() for all routing stage announcements and statistics output, which bypasses the OpenROAD message ID system and prevents log filtering. Additionally, two raw assert() calls would crash silently in release builds with no diagnostic information.

This PR replaces all 11 logger_->report() calls with logger_->info() using GRT message IDs 1258-1269, replaces the 2 raw asserts with logger_->error() calls (GRT 1270-1271) that include the actual values that caused the failure, and removes the now-unused #include <cassert>.

Related Issues:
Follows pattern established in #9870 and #9938.

@Divinesoumyadip
Copy link
Copy Markdown
Contributor Author

@eder-matheus Check it out when u have time .Thanks again.

Copy link
Copy Markdown
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 refactors the logging mechanism in CUGR.cpp by replacing logger_->report calls with logger_->info and introducing specific message IDs for various stages and statistics. Additionally, it replaces several assert statements with logger_->error calls to provide more robust error handling and diagnostic messages. A review comment suggests enhancing the error message for the null Steiner tree case by including the net ID for improved debugging.

@eder-matheus
Copy link
Copy Markdown
Member

@Divinesoumyadip you have some conflicts in this PR. I see that you're using a very old version of OpenROAD as a base for this PR. Please, make sure to always checkout to the latest master branch before creating new updates.

Signed-off-by: Divinesoumyadip <soumyacode7@gmail.com>
Signed-off-by: Divinesoumyadip <soumyacode7@gmail.com>
@Divinesoumyadip Divinesoumyadip force-pushed the grt/fix-cugr-logger-report-to-info branch from cb8c03a to 1e82a15 Compare March 26, 2026 02:16
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

logger_->info(utl::GRT,
1258,
"{} / {} nets have overflow.",
netIndices.size(),
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.

warning: use of undeclared identifier 'netIndices'; did you mean 'net_indices'? [clang-diagnostic-error]

Suggested change
netIndices.size(),
net_indices.size(),
Additional context

src/grt/src/cugr/src/CUGR.cpp:130: 'net_indices' declared here

void CUGR::updateOverflowNets(std::vector<int>& net_indices)
                                                ^

maze_route.constructSparsifiedGraph(wire_cost_view, grid);
maze_route.run();
std::shared_ptr<SteinerTreeNode> tree = maze_route.getSteinerTree();
for (const int netIndex : netIndices) {
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.

warning: use of undeclared identifier 'netIndices'; did you mean 'net_indices'? [clang-diagnostic-error]

Suggested change
for (const int netIndex : netIndices) {
for (const int netIndex : net_indices) {
Additional context

src/grt/src/cugr/src/CUGR.cpp:209: 'net_indices' declared here

void CUGR::mazeRoute(std::vector<int>& net_indices)
                                       ^

for (const int netIndex : netIndices) {
GRNet* net = gr_nets_[netIndex].get();
MazeRoute mazeRoute(net, grid_graph_.get(), logger_);
mazeRoute.constructSparsifiedGraph(wireCostView, grid);
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.

warning: use of undeclared identifier 'wireCostView'; did you mean 'wire_cost_view'? [clang-diagnostic-error]

Suggested change
mazeRoute.constructSparsifiedGraph(wireCostView, grid);
mazeRoute.constructSparsifiedGraph(wire_cost_view, grid);
Additional context

src/grt/src/cugr/src/CUGR.cpp:224: 'wire_cost_view' declared here

  GridGraphView<CostT> wire_cost_view;
                       ^

logger_->info(utl::GRT,
1265,
"Wire length (metric): {}.",
wireLength / grid_graph_->getM2Pitch());
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.

warning: use of undeclared identifier 'wireLength'; did you mean 'wire_length'? [clang-diagnostic-error]

Suggested change
wireLength / grid_graph_->getM2Pitch());
wire_length / grid_graph_->getM2Pitch());
Additional context

src/grt/src/cugr/src/CUGR.cpp:513: 'wire_length' declared here

  uint64_t wire_length = 0;
           ^

1265,
"Wire length (metric): {}.",
wireLength / grid_graph_->getM2Pitch());
logger_->info(utl::GRT, 1266, "Total via count: {}.", viaCount);
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.

warning: use of undeclared identifier 'viaCount'; did you mean 'via_count'? [clang-diagnostic-error]

Suggested change
logger_->info(utl::GRT, 1266, "Total via count: {}.", viaCount);
logger_->info(utl::GRT, 1266, "Total via count: {}.", via_count);
Additional context

src/grt/src/cugr/src/CUGR.cpp:514: 'via_count' declared here

  int via_count = 0;
      ^

logger_->info(utl::GRT, 1266, "Total via count: {}.", viaCount);
logger_->info(utl::GRT, 1267, "Total wire overflow: {}.", (int) overflow);

logger_->info(utl::GRT, 1268, "Min resource: {}.", minResource);
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.

warning: use of undeclared identifier 'minResource'; did you mean 'min_resource'? [clang-diagnostic-error]

Suggested change
logger_->info(utl::GRT, 1268, "Min resource: {}.", minResource);
logger_->info(utl::GRT, 1268, "Min resource: {}.", min_resource);
Additional context

src/grt/src/cugr/src/CUGR.cpp:546: 'min_resource' declared here

  CapacityT min_resource = std::numeric_limits<CapacityT>::max();
            ^

@Divinesoumyadip Divinesoumyadip marked this pull request as draft March 31, 2026 19:05
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