Skip to content

misc: better support for soft halos#9837

Open
openroad-ci wants to merge 15 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:mpl-halo-blockages
Open

misc: better support for soft halos#9837
openroad-ci wants to merge 15 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:mpl-halo-blockages

Conversation

@openroad-ci
Copy link
Collaborator

This PR adds support for DEF soft halos across OpenROAD.

  • Modifies ODB to add a flag to dbBox to mark it as a soft or hard halo for dbInst
  • Modifies GPL/CTS to correctly consider halos during placement of instances
    • GPL cannot put instances within any halo, CTS can put instances in soft halos
  • Small bugfix on PDN regarding halo copy from ODB to PDN and use getTransformedHalo
    • PDN considers only hard halos
  • Adjust cutRows function to use getTransformedHalo
    • cutRows also is only concerted with hard halos

joaomai added 14 commits March 19, 2026 16:24
Signed-off-by: João Mai <jmai@precisioninno.com>
Signed-off-by: João Mai <jmai@precisioninno.com>
Signed-off-by: João Mai <jmai@precisioninno.com>
Signed-off-by: João Mai <jmai@precisioninno.com>
Signed-off-by: João Mai <jmai@precisioninno.com>
Signed-off-by: João Mai <jmai@precisioninno.com>
Signed-off-by: João Mai <jmai@precisioninno.com>
Signed-off-by: João Mai <jmai@precisioninno.com>
Signed-off-by: João Mai <jmai@precisioninno.com>
Signed-off-by: João Mai <jmai@precisioninno.com>
Signed-off-by: João Mai <jmai@precisioninno.com>
Signed-off-by: João Mai <jmai@precisioninno.com>
Signed-off-by: João Mai <jmai@precisioninno.com>
Signed-off-by: João Mai <jmai@precisioninno.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 introduces support for soft halos for instances, a feature that is now reflected across various parts of the OpenROAD flow. The changes correctly modify ODB to store a soft flag for halos, update the DEF parser and writer to handle the SOFT keyword, and adjust tools like CTS, GPL, and PDN to respect hard vs. soft halos as per their requirements. The logic seems sound and consistent across all modified components. Additionally, a bug fix for orientation handling in mpl is included. I have one suggestion for a minor performance and style improvement in src/odb/src/zutil/util.cpp.

Comment on lines 137 to 141
if (blockage->getOwnerType() == odb::dbBoxOwner::INST) {
halo = static_cast<odb::dbInst*>(blockage->getBoxOwner())->getHalo();
transformed_halo = static_cast<odb::dbInst*>(blockage->getBoxOwner())
->getTransformedHalo();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This block of code has a couple of minor inefficiencies:

  1. static_cast<odb::dbInst*>(blockage->getBoxOwner()) is performed twice.
  2. getTransformedHalo() is called even if the halo is null or soft. This call is unnecessary in those cases.

Consider refactoring to store the instance pointer and only call getTransformedHalo() when it's confirmed to be a hard halo. Note that for dbBoxOwner::INST, getBoxOwner() is guaranteed to return a valid instance.

Suggested change
if (blockage->getOwnerType() == odb::dbBoxOwner::INST) {
halo = static_cast<odb::dbInst*>(blockage->getBoxOwner())->getHalo();
transformed_halo = static_cast<odb::dbInst*>(blockage->getBoxOwner())
->getTransformedHalo();
}
if (blockage->getOwnerType() == odb::dbBoxOwner::INST) {
auto* inst = static_cast<odb::dbInst*>(blockage->getBoxOwner());
halo = inst->getHalo();
if (halo != nullptr && !halo->isSoft()) {
transformed_halo = inst->getTransformedHalo();
}
}
References
  1. A dbBox with owner type dbBoxOwner::INST will always have a valid owner instance; getBoxOwner() will not return null.

@github-actions
Copy link
Contributor

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

Signed-off-by: João Mai <jmai@precisioninno.com>
@joaomai joaomai requested review from AcKoucher and maliberty March 19, 2026 18:07
@github-actions
Copy link
Contributor

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

{
dbBoxOwner::Value owner_type : 4;
uint32_t visited : 1;
uint32_t soft : 1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this a safe change for the DB? or should this require a version bump?

Copy link
Contributor

Choose a reason for hiding this comment

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

The visited flag is unused, so I think it is safe.


odb::Rect inst_box = inst->getBBox()->getBox();
if (halo != nullptr && !halo->isSoft()) {
odb::Rect halo_box = inst->getTransformedHalo();
Copy link
Collaborator

Choose a reason for hiding this comment

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

somethings off about this.
What is actually stored in the halo_? It was the deltaX, and deltaY of the instance (ie. the halo), but looking at the getTransformedHalo that seems to be doing something completely different

Copy link
Contributor

@joaomai joaomai Mar 19, 2026

Choose a reason for hiding this comment

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

halo_ stores the values of left, bottom, right and top spacing as positive values in xMin, yMin, xMax and yMax respectively. getTransformedHalo returns the halo re-oriented considering the instance orientation.

Comment on lines +874 to +875
odb::Rect halobox = inst->getTransformedHalo();
Rect instbox = inst->getBBox()->getBox();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why removing the check?

switch (getOrientation().getValue()) {
case odb::dbOrientType::Value::R180:
case odb::dbOrientType::Value::MX:
case odb::dbOrientType::Value::MY:
Copy link
Contributor

Choose a reason for hiding this comment

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

It would have been good to include this bug fix in the description as well.

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.

4 participants