Skip to content

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

Merged
jhkim-pii merged 4 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:secure-issue1737-hold-buffer-count-fix
Jul 21, 2026
Merged

rsz: fix hold-buffer count reset on repair_timing -hold rollback#10835
jhkim-pii merged 4 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

@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.

@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
@github-actions github-actions Bot added size/M and removed size/S labels Jul 10, 2026
@openroad-ci
openroad-ci force-pushed the secure-issue1737-hold-buffer-count-fix branch from 37e6df3 to 9c96ac9 Compare July 12, 2026 13:32
@minjukim55
minjukim55 force-pushed the secure-issue1737-hold-buffer-count-fix branch from 9c96ac9 to 345840b Compare July 12, 2026 14:11
@minjukim55
minjukim55 requested a review from maliberty July 15, 2026 00:52
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>
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>
TestRepairHoldRollback loads the placed gcd design at a tight 0.5ns
clock so it is setup-critical, then runs repair_timing -hold with a
hold margin. Several hold fixes commit and a later one is rolled back
via journalRestore(). The test asserts holdBufferCount() equals the
number of buffers actually left in the netlist.

Before the fix this reported far fewer buffers than are present because
a rolled-back insertion reset inserted_buffer_count_ to 0. Registered
in both CMake and Bazel.

Signed-off-by: Minju Kim <mkim@precisioninno.com>
Rebased onto current master; the count-on-accept fix reports the true
hold-buffer count (previously reset/under-counted on repair_timing -hold
rollback). Regenerate metrics + limits: aes_sky130hd hold 14->343,
jpeg_sky130hd hold 1->41 (limits 411/49 at the standard 1.2x margin).

Signed-off-by: Minju Kim <mkim@precisioninno.com>
@minjukim55
minjukim55 force-pushed the secure-issue1737-hold-buffer-count-fix branch from 345840b to 1f30b01 Compare July 20, 2026 01:37
@minjukim55
minjukim55 requested a review from a team as a code owner July 20, 2026 01:37
@minjukim55
minjukim55 requested a review from eder-matheus July 20, 2026 01:37
@github-actions github-actions Bot added size/L and removed size/M labels Jul 20, 2026
@jhkim-pii
jhkim-pii merged commit f9a281c into The-OpenROAD-Project:master Jul 21, 2026
16 checks passed
@jhkim-pii
jhkim-pii deleted the secure-issue1737-hold-buffer-count-fix branch July 21, 2026 02:56
minjukim55 added a commit to The-OpenROAD-Project-staging/OpenROAD that referenced this pull request Jul 21, 2026
…buffer count fix) into rsz-buffering-boost

rsz sources auto-merged. Regenerate aes_sky130hd / jpeg_sky130hd metric +
limit goldens against the merged binary (buffering-boost + The-OpenROAD-Project#10835): e.g. aes
RSZ::hold_buffer_count settles at 330 (neither the pre-fix 19 nor master 343).

Signed-off-by: Minju Kim <mkim@precisioninno.com>
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.

3 participants