Skip to content

Secure bufrem fix - #9349

Merged
maliberty merged 41 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:secure-bufrem-fix
Jan 30, 2026
Merged

maliberty merged 41 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:secure-bufrem-fix

Conversation

@openroad-ci

@openroad-ci openroad-ci commented Jan 26, 2026 •

Copy link
Copy Markdown
Member

This enhances buffer removal in repair_timing as follows:

  1. This makes it slew-aware by estimating slews based on Elmore delay model for RC trees.
  2. Small degradation (10%) in slack is allowed if the slack is already violating.

Buffer removal involves two nets: input net connected to buffer input pin and output net connected to buffer output pin.
Estimated slew after buffer removal is calibrated using actual vs. estimated slews at buffer input net and those at buffer output net.

Public PDK designs show improved setup TNS of 4.97% and setup WNS of 7.14%.
Private PDK designs show improved setup TNS of 11.8% and setup WNS of 45.2%

image

ORFS PR The-OpenROAD-Project/OpenROAD-flow-scripts#3834 goes with this.

eder-matheus and others added 30 commits December 26, 2025 21:10
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
…estored

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Cho Moon <cmoon@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
…g routing from guides

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Cho Moon <cmoon@precisioninno.com>
Signed-off-by: Martin Povišer <povik@cutebit.org>
Sample use:

	openroad> rsz::check_slew_after_buffer_rm [get_pin _108226_/SN] [get_cell place8809] [sta::cmd_corner]
	worst pin _108237_/A slew 86.418
	openroad> report_slew _108237_/A
	_108237_/A ^ 9.11:10.63 v 8.17:9.82
	openroad> remove_buffer place8809
	[INFO RSZ-0026] Removed 1 buffers.
	openroad> report_slew _108237_/A
	_108237_/A ^ 39.02:85.49 v 35.41:79.64

Signed-off-by: Martin Povišer <povik@cutebit.org>
Signed-off-by: Cho Moon <cmoon@precisioninno.com>
Signed-off-by: Cho Moon <cmoon@precisioninno.com>
Signed-off-by: Cho Moon <cmoon@precisioninno.com>
Signed-off-by: Cho Moon <cmoon@precisioninno.com>
Signed-off-by: Cho Moon <cmoon@precisioninno.com>
Signed-off-by: Cho Moon <cmoon@precisioninno.com>
Signed-off-by: Cho Moon <cmoon@precisioninno.com>
Signed-off-by: Cho Moon <cmoon@precisioninno.com>
Signed-off-by: Cho Moon <cmoon@precisioninno.com>
Signed-off-by: Cho Moon <cmoon@precisioninno.com>

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request introduces a more sophisticated slew estimation logic for buffer removal, which is a significant improvement for robustness. The code is well-structured, with new helper functions in Resizer and refactoring of common utilities like visitTree. I've identified a few critical issues related to potential division-by-zero and sqrt of negative numbers that should be addressed. I also have a suggestion to improve maintainability by defining a magic number as a named constant, which aligns with repository guidelines.

Comment thread src/rsz/src/RepairDesign.cc Resolved
Comment thread src/rsz/src/Resizer.cc Resolved
Comment thread src/rsz/src/Resizer.cc Resolved
Comment thread src/rsz/src/BaseMove.cc Resolved

@github-actions github-actions Bot left a comment

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.

clang-tidy made some suggestions

Comment thread src/rsz/src/RepairDesign.cc Resolved
Comment thread src/rsz/src/RepairDesign.cc Resolved
Signed-off-by: Cho Moon <cmoon@precisioninno.com>

@github-actions github-actions Bot left a comment

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.

clang-tidy made some suggestions

Comment thread src/rsz/src/RepairDesign.cc Resolved
@precisionmoon

Copy link
Copy Markdown
Contributor

@povik, thanks much for the new buffered net API. Please review and comment.

Comment thread src/rsz/src/BaseMove.cc Outdated
double BaseMove::dbuToMeters(int dist) const
{
return dist / (dbu_ * 1e+6);
return dist / (resizer_->dbu_ * 1e+6);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If resizer already has the dbu_ you want why no just add a public method to resizer to calculate this for you?

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.

Makes sense. Done.

@github-actions github-actions Bot left a comment

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.

clang-tidy made some suggestions

assert(slew_rc_factor_.has_value());
bnet->setMaxLoadSlew(bnet->ref()->maxLoadSlew()
- (r_via * bnet->ref()->cap() * slew_rc_factor_));
- (r_via * bnet->ref()->cap() * (*slew_rc_factor_)));

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.

warning: unchecked access to optional value [bugprone-unchecked-optional-access]

                       - (r_via * bnet->ref()->cap() * (*slew_rc_factor_)));
                                                         ^

double load_slew
= (r_drvr * (c_wire + ref_cap) + r_wire * ref_cap + r_wire * c_wire / 2)
* slew_rc_factor_;
* (*slew_rc_factor_);

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.

warning: unchecked access to optional value [bugprone-unchecked-optional-access]

        * (*slew_rc_factor_);
            ^

- (r_wire * (c_wire / 2 + ref_cap) * slew_rc_factor_));
bnet->setMaxLoadSlew(
bnet->ref()->maxLoadSlew()
- (r_wire * (c_wire / 2 + ref_cap) * (*slew_rc_factor_)));

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.

warning: unchecked access to optional value [bugprone-unchecked-optional-access]

      - (r_wire * (c_wire / 2 + ref_cap) * (*slew_rc_factor_)));
                                             ^

float c = (r_drvr * ref_cap) - (max_load_slew_margined / slew_rc_factor_);
float l = (-b + sqrt(b * b - 4 * a * c)) / (2 * a);
float c
= (r_drvr * ref_cap) - (max_load_slew_margined / (*slew_rc_factor_));

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.

warning: unchecked access to optional value [bugprone-unchecked-optional-access]

          = (r_drvr * ref_cap) - (max_load_slew_margined / (*slew_rc_factor_));
                                                             ^

load_slew = (r_drvr * (c_wire + ref_cap) + r_wire * ref_cap
+ r_wire * c_wire / 2)
* slew_rc_factor_;
* (*slew_rc_factor_);

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.

warning: unchecked access to optional value [bugprone-unchecked-optional-access]

                  * (*slew_rc_factor_);
                      ^

bnet->setMaxLoadSlew(
max_load_slew - (r_wire * (c_wire / 2 + ref_cap) * slew_rc_factor_));
max_load_slew
- (r_wire * (c_wire / 2 + ref_cap) * (*slew_rc_factor_)));

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.

warning: unchecked access to optional value [bugprone-unchecked-optional-access]

          - (r_wire * (c_wire / 2 + ref_cap) * (*slew_rc_factor_)));
                                                 ^

float r_drvr = resizer_->driveResistance(drvr_pin_);
float load_slew = r_drvr * load_cap * slew_rc_factor_;
assert(slew_rc_factor_.has_value());
float load_slew = r_drvr * load_cap * (*slew_rc_factor_);

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.

warning: unchecked access to optional value [bugprone-unchecked-optional-access]

  float load_slew = r_drvr * load_cap * (*slew_rc_factor_);
                                          ^

delayAsString(load_slew, this, 3),
delayAsString(max_load_slew_margined, this, 3));
double slew_left = r_drvr * cap_left * slew_rc_factor_;
double slew_left = r_drvr * cap_left * (*slew_rc_factor_);

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.

warning: unchecked access to optional value [bugprone-unchecked-optional-access]

    double slew_left = r_drvr * cap_left * (*slew_rc_factor_);
                                             ^

double slew_left = r_drvr * cap_left * (*slew_rc_factor_);
double slew_slack_left = maxSlewMargined(max_load_slew_left) - slew_left;
double slew_right = r_drvr * cap_right * slew_rc_factor_;
double slew_right = r_drvr * cap_right * (*slew_rc_factor_);

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.

warning: unchecked access to optional value [bugprone-unchecked-optional-access]

    double slew_right = r_drvr * cap_right * (*slew_rc_factor_);
                                               ^

init();
}
assert(slew_rc_factor_.has_value());
return *slew_rc_factor_;

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.

warning: unchecked access to optional value [bugprone-unchecked-optional-access]

  return *slew_rc_factor_;
          ^

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
@maliberty
maliberty merged commit 9df70ee into The-OpenROAD-Project:master Jan 30, 2026
9 of 10 checks passed
@maliberty
maliberty deleted the secure-bufrem-fix branch January 30, 2026 23:11
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.

6 participants