Skip to content

dpl: negotiation, introduce regions and fix power rail alignment#10175

Open
gudeh wants to merge 11 commits intoThe-OpenROAD-Project:masterfrom
gudeh:dpl-negotiation-fixes
Open

dpl: negotiation, introduce regions and fix power rail alignment#10175
gudeh wants to merge 11 commits intoThe-OpenROAD-Project:masterfrom
gudeh:dpl-negotiation-fixes

Conversation

@gudeh
Copy link
Copy Markdown
Contributor

@gudeh gudeh commented Apr 17, 2026

Summary

Introduce regions knowledge to the new negotiation legalizer and remove assumptions about power rail alignment.

Type of Change

  • Bug fix
  • New feature

Impact

Negotiation can legalize based on regions and fixes some issues with rail alignment during legalization.

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

After the change in PR #10167, the negotiation legalizer is failing during check_placement.

gudeh added 6 commits April 16, 2026 18:41
fix rail alignment for negotiation,
debug: include cell orientation when selected

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.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 enhances the Negotiation Legalizer by deriving power-rail types from DB row orientations and LEF geometry, and adding support for region-constrained cells via groups. Feedback focuses on performance optimizations to avoid bottlenecks in debug printing and ODB lookups, preventing console flooding from warnings, and correcting logic for cell flippability and orientation visualization.

Comment thread src/dpl/src/NegotiationLegalizer.cpp Outdated
Comment thread src/dpl/src/NegotiationLegalizerPass.cpp Outdated
Comment thread src/dpl/src/graphics/Graphics.cpp Outdated
Comment on lines +776 to 778
if (cell.height == 1) {
// Consider all single height cells flippable
cell.flippable = true;
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.

medium

Restricting the automatic flippability to only cell.height == 1 excludes multi-row cells with an odd number of rows (e.g., 3-row cells). These cells also have different power rail types at their top and bottom edges, and thus flipping them is a valid way to resolve rail mismatches. The previous logic using % 2 == 1 was more general and correct for rail alignment.

Suggested change
if (cell.height == 1) {
// Consider all single height cells flippable
cell.flippable = true;
if (cell.height % 2 == 1) {
// Consider all odd height cells flippable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was actually considering to remove this and keeping only the getSymmetryX() which comes right before these lines and not override it.

Comment on lines +646 to +667
odb::dbRegion* odb_region = db_inst->getRegion();
if (odb_region == nullptr) {
auto* grp = db_inst->getGroup();
if (grp != nullptr) {
odb_region = grp->getRegion();
}
}
struct RegionRectInline
{
int xlo, ylo, xhi, yhi;
};
std::vector<RegionRectInline> region_rects_inline;
if (odb_region != nullptr) {
for (auto* box : odb_region->getBoundaries()) {
RegionRectInline r;
r.xlo = (box->xMin() - die_xlo_) / site_width_;
r.ylo = (box->yMin() - die_ylo_) / row_height_;
r.xhi = (box->xMax() - die_xlo_) / site_width_;
r.yhi = (box->yMax() - die_ylo_) / row_height_;
region_rects_inline.push_back(r);
}
}
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.

medium

Accessing ODB to fetch region boundaries and converting them to grid coordinates for every single instance is inefficient, as many instances typically share the same region. This information should be cached in a map (e.g., std::unordered_map<odb::dbRegion*, std::vector<RegionRectInline>>) to avoid redundant processing.

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

Comment thread src/dpl/src/graphics/Graphics.cpp Outdated
Comment thread src/dpl/src/graphics/Graphics.cpp Outdated
Comment thread src/dpl/src/graphics/Graphics.cpp Outdated
Comment thread src/dpl/src/graphics/Graphics.cpp Outdated
Comment thread src/dpl/src/graphics/Graphics.cpp Outdated
Comment thread src/dpl/src/graphics/Graphics.cpp Outdated
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
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

Comment thread src/dpl/src/graphics/Graphics.cpp Outdated
Comment thread src/dpl/src/graphics/Graphics.cpp Outdated
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
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

Comment thread src/dpl/src/graphics/Graphics.cpp
gudeh added 2 commits April 18, 2026 09:45
transform warn into debugPrint

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
@github-actions
Copy link
Copy Markdown
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants