Skip to content

drt: initMazeCost_ap_helper refactor#10040

Open
openroad-ci wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:drt_ap_grid_helper_refactor
Open

drt: initMazeCost_ap_helper refactor#10040
openroad-ci wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:drt_ap_grid_helper_refactor

Conversation

@openroad-ci
Copy link
Copy Markdown
Collaborator

Summary

the initMazeCost_ap_helper is verbose and has a lot of unnecessary indentation. I mostly moved things around and applied guards when possible. The function does the exact same thing.

Clang-format made some changes by itself when I fed it through the file.

I also used the reverse() function inside the correct() function and eliminated correctU() as it was completely equivalent to correct() in every context it was called.

Type of Change

  • Refactoring

Impact

No functional behavior changed

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 signed my commits (DCO).

Related Issues

#9850

Signed-off-by: bnmfw <bernardoborgessandoval@gmail.com>
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 initMazeCost_ap_helper in FlexDR_init.cpp to improve readability through early exits and consolidated logic. In FlexGridGraph.h, the correctU method was replaced with a more general correct function. Feedback suggests replacing a std::cout warning with a proper logger error call when failing to find grids for marker costs to ensure critical failures are not missed.

Comment on lines +2077 to +2079
std::cout << "Warning: marker bloat 4x width but could not find "
"two grids "
"to add marker cost\n";
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.

high

Unexpected failures during the routing flow, such as failing to find grids to add marker cost, should be logged as an error instead of a warning. This ensures that critical failure messages are not missed by the user. Additionally, avoid manual formatting changes and rely on the logger's standard output.

Suggested change
std::cout << "Warning: marker bloat 4x width but could not find "
"two grids "
"to add marker cost\n";
logger->error(utl::DRT, 1000, "marker bloat 4x width but could not find two grids to add marker cost");
References
  1. Unexpected failures during the routing flow, such as failing to generate a Steiner tree, should be logged as an error, not a warning. This ensures the end user does not miss critical failure messages.
  2. Rely on clang-format for code formatting instead of applying manual style changes.

Copy link
Copy Markdown
Contributor

@bnmfw bnmfw Apr 2, 2026

Choose a reason for hiding this comment

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

@maliberty I sometimes find these kinds of "internal DRT errors" which look obsolete/legacy to me, should we transform them into actual error or get rid of them?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Transform them unless you are certain they can't happen.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

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

@bnmfw bnmfw requested review from QuantamHD and osamahammad21 April 2, 2026 20:24
@bnmfw bnmfw added the drt Detailed Routing label Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

drt Detailed Routing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants