drt: Access Point has independent grid penalization#10244
drt: Access Point has independent grid penalization#10244openroad-ci wants to merge 7 commits intoThe-OpenROAD-Project:masterfrom
Conversation
Signed-off-by: bnmfw <bernardoborgessandoval@gmail.com>
Signed-off-by: bnmfw <bernardoborgessandoval@gmail.com>
There was a problem hiding this comment.
Code Review
This pull request introduces Access Point (AP) costs to the FlexGridGraph by utilizing previously unused bits in the Node structure. It adds corresponding getter and setter methods and integrates these costs into the maze router's cost calculation and debug printing. The review feedback highlights an opportunity to improve robustness by adding bounds checks to the new public hasApCost method and suggests a performance optimization in the critical getCosts function to avoid redundant coordinate corrections.
| bool hasApCost(frMIdx x, frMIdx y, frMIdx z, frDirEnum dir) const | ||
| { | ||
| bool sol = false; | ||
| correct(x, y, z, dir); | ||
| switch (dir) { | ||
| case frDirEnum::E: | ||
| sol = hasApCostE(x, y, z); | ||
| break; | ||
| case frDirEnum::N: | ||
| sol = hasApCostN(x, y, z); | ||
| break; | ||
| default: | ||
| sol = hasApCostU(x, y, z); | ||
| } | ||
| return sol; | ||
| } |
There was a problem hiding this comment.
The hasApCost method does not check if the indices x, y, z are within valid bounds after the correct call. While the maze router typically ensures validity before calling cost functions, this method is public and could be called in other contexts. For robustness and consistency with other methods like hasEdge, consider adding an isValid(x, y, z) check.
| bool gridCost = hasGridCost(gridX, gridY, gridZ, dir); | ||
| bool apCost = hasApCost(gridX, gridY, gridZ, dir); |
There was a problem hiding this comment.
Both hasGridCost and hasApCost are called sequentially, and both internally call the correct function with the same arguments. Since correct modifies its arguments, this results in redundant calculations. Given that getCosts is in the performance-critical inner loop of the maze router, consider consolidating these checks or providing a unified helper method in FlexGridGraph to avoid redundant coordinate corrections.
References
- Operations within a loop should be analyzed for redundancy; identical or similar calls should be consolidated to optimize performance in critical sections.
- Logic that is duplicated or shared should be encapsulated in helper functions to improve maintainability and avoid redundancy.
|
clang-tidy review says "All clean, LGTM! 👍" |
osamahammad21
left a comment
There was a problem hiding this comment.
@bnmfw Please address the merge conflicts.
Summary
GRID_COST is used as a generic penalization during DRT to indicate undesirable edges. Wrong way routing and Off Grid routing are examples, although neither possible in the PDK I'm working on. Near DR Worker border and near Access Point are examples present in my PDK. The main issue is that while wrong way, off grid and worker border are static characteristics, that is, they never change during routing, Near AP is dynamic. There is a penalty for routing near APs of other nets, but during the routing of a specific net all the penalty for the APs that it will use are temporarily removed, and here lies the problem. APs and the other penalties all use the
hasGridCost<Dir>group of flags used to indicate the penalty, and these are all marked as false by the router to mean that "there is no penalty for accessing this AP because it belongs to the routed net" but this also removes the penalty for all other static penalties on the region.By separating AP penalty in their own group o variables not only this issue is fixed but it will allow to tune for AP penalization in the future. Currently GRID_COST is applied as a penalty if either AP penalty or static penalty is detected in order to try and preserve the tool old behavior.
Some unit tests were changed. This is happening because on those cases the routing respects the static penalties, even if close to a pin that is being routed.
Type of Change
Impact
[How does this change the tool's behavior?]
Verification
./etc/Build.sh).Related Issues