Skip to content

grt: replace assert with logger error in CUGR maze route#9870

Open
Divinesoumyadip wants to merge 3 commits intoThe-OpenROAD-Project:masterfrom
Divinesoumyadip:fix/grt-cugr-assert-to-logger
Open

grt: replace assert with logger error in CUGR maze route#9870
Divinesoumyadip wants to merge 3 commits intoThe-OpenROAD-Project:masterfrom
Divinesoumyadip:fix/grt-cugr-assert-to-logger

Conversation

@Divinesoumyadip
Copy link
Contributor

Fixes #9869

Replaces raw assert statements in src/grt/src/cugr/src/CUGR.cpp with proper logger_->error() calls following OpenROAD conventions. assert(tree != nullptr) is replaced with logger error GRT 610 and assert(constants_.min_routing_layer + 1 < grid_graph_->getNumLayers()) is replaced with logger error GRT 611. Removed unused #include <cassert>. Raw asserts crash silently in release builds while logger_->error() provides proper error reporting consistent with the rest of the codebase.

Signed-off-by: Divinesoumyadip <soumyacode7@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 replaces assert calls with logger_->error for better error reporting, which is a good improvement. I've found one potential issue in mazeRoute where using logger_->error could lead to an inconsistent program state. I've suggested using logger_->warn and continuing to the next net to make the router more robust. The other changes look good.

Comment on lines +231 to +233
if (tree == nullptr) {
logger_->error(GRT, 610, "Failed to generate Steiner tree for net {}.", net->getName());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Using logger_->error will throw an exception and terminate the mazeRoute function. This will prevent subsequent nets in net_indices from being routed. However, grid_graph_->removeTreeUsage was already called for all these nets in a separate loop before this one (lines 215-217). This will leave the grid graph usage data in an inconsistent state if the exception is caught and the program continues.

To make the router more robust, consider logging a warning and skipping only the failed net. This allows the process to continue for other nets and keeps the program state consistent.

    if (tree == nullptr) {
      logger_->warn(GRT, 610, "Failed to generate Steiner tree for net {}. Skipping net.", net->getName());
      continue;
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Signed-off-by: Divinesoumyadip <soumyacode7@gmail.com>
@Divinesoumyadip
Copy link
Contributor Author

@eder-matheus Kindly review it .Thnaks in advance.

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Signed-off-by: Divinesoumyadip <soumyacode7@gmail.com>
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

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.

grt: replace assert with logger error in CUGR maze route

1 participant