Skip to content

rsz: fix hold-buffer count reset on repair_timing -hold rollback#10835

Open
minjukim55 wants to merge 2 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:secure-issue1737-hold-buffer-count-fix
Open

rsz: fix hold-buffer count reset on repair_timing -hold rollback#10835
minjukim55 wants to merge 2 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:secure-issue1737-hold-buffer-count-fix

Conversation

@minjukim55

Copy link
Copy Markdown
Contributor

Summary

  • repairEndHold() reset inserted_buffer_count_ to 0 on a rolled-back hold-buffer insertion instead of decrementing by one.
  • Each insertion is exactly one journalBegin() + makeHoldDelay() pair, incrementing the count once. journalRestore() only undoes that single insertion, not any buffer committed earlier in the same run — so -- exactly cancels the one insertion just attempted, while = 0 wiped out every buffer counted so far.
  • This corrupted the Inserted N hold buffers line, the per-iteration table, and defeated the max_buffer_percent safety valve (it could never trip).

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Impact

  • No behavior change for runs with zero rollbacks (existing repair_hold* goldens unaffected).
  • Runs where a rollback occurs now report/limit against the real buffer count instead of an under-reported one.

Verification

  • Ran full rsz.repair_hold* ctest group (19 tests) — all pass.

Related Issues

Fixes The-OpenROAD-Project-private/OpenROAD-flow-scripts#1737

repairEndHold() reset inserted_buffer_count_ to 0 whenever a single
hold-buffer insertion was rolled back, instead of decrementing it by
one. Each insertion is exactly one journalBegin()/makeHoldDelay() pair
(count incremented once); journalRestore() only undoes that single
insertion, not any buffer committed earlier in the same repair_hold
run. So the running total (and therefore the final "Inserted N hold
buffers" line, the per-iteration table, and the max_buffer_count safety
valve) no longer reflected reality once any rollback occurred.

Signed-off-by: Minju Kim <mkim@precisioninno.com>
@minjukim55 minjukim55 self-assigned this Jul 7, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

Comment thread src/rsz/src/RepairHold.cc Outdated
&& setup_slack_after < setup_margin)) {
resizer_->journalRestore();
inserted_buffer_count_ = 0;
inserted_buffer_count_--;

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.

RepairHold::makeHoldDelay can return early in which case this would be wrong.

Rework the repair_timing -hold buffer accounting so the counters are
updated only when a trial insertion is committed (journalEnd), mirroring
GlobalSizingPolicy's accept-only accounting. makeHoldDelay now returns a
HoldMoveStats value instead of mutating inserted_buffer_count_ and
resize_count_ as a side effect, so an early return or a rolled-back
insertion contributes nothing. This supersedes the earlier
decrement-on-rollback, which assumed makeHoldDelay always incremented
exactly once and left resize_count_ inflated on rollback.

Apply the same fix to RecoverPower: a downsize that is rolled back
(journalRestore) no longer inflates resize_count_; the count is bumped
only at the journalEnd commit points.

Signed-off-by: Minju Kim <mkim@precisioninno.com>
@github-actions github-actions Bot added size/S and removed size/XS labels Jul 8, 2026
@minjukim55 minjukim55 marked this pull request as ready for review July 8, 2026 05:34
@minjukim55 minjukim55 requested a review from a team as a code owner July 8, 2026 05:34
@minjukim55 minjukim55 requested a review from povik July 8, 2026 05:34
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