Repository navigation
Conversation
BufferCandidate::apply() reported only the driver as touched, so MoveCommitter never recorded the buffers that rebuffering inserted. MoveCommitter::hasBlockingBufferRemovalMove() checks for kBuffer moves on the buffer instance itself, so its "it was from rebuffering" guard never matched them, and UnbufferMove could remove a buffer that BufferMove had just inserted in the same repair session. Rebuffer now remembers the buffers inserted by the last rebufferPin() call, and BufferCandidate adds them to the touched instances. Found on a large design with more frequent buffer removal, where the missing guard produced remove/re-insert loops on the same net for 50 passes until the endpoint was rolled back. Adds TestResizer.BufferMoveMarksInsertedBuffers (fails without the fix) and updates goldens of tests whose repair_timing results change because removal can no longer undo BufferMove's buffers. Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
Blocking removal of every BufferMove-inserted buffer stopped the remove/re-insert loop but also blocked removals that were a net win, e.g. repair_setup4_sequence lost WNS and gained 11% area. Removal may now take out one buffer that rebuffering inserted on a driver. After that, every buffer rebuffering inserted on that driver, earlier or later, is kept, which still breaks the loop. BufferCandidate reports its inserted buffers in a new MoveResult::inserted_buffers field instead of touched_instances, and MoveCommitter tracks the driver of each. Locking only buffers reinserted after the removal let siblings from the first buffer tree keep feeding the cycle and grew repair_fanout8 area to +77%. repair_setup4_sequence and repair_setup_gcd goldens return to master's. Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
…ouched-buffers Signed-off-by: Matt Liberty <mliberty@precisioninno.com> # Conflicts: # src/rsz/test/cpp/TestResizer.cc # src/rsz/test/repair_fanout7_multi.ok # src/rsz/test/repair_fanout8_multi.ok
Resolve the conflicts with master, which renamed src/ to openroad/: - Port the Rebuffer.hh and TestResizer.cc changes of this branch to openroad/rsz, where git did not detect the rename. - BUILD: keep master's test-visible hdrs, which already list src/Rebuffer.hh, and move src/move/BufferCandidate.hh there. - Rebuffer.cc: master moved the top-port check at the start of rebufferPin() into makeBufferedNet(), and the merge put the last_inserted_buffers_ reset there with it. Move the reset back to the start of rebufferPin(). - Goldens keep master's version here; a later commit refreshes them. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
recordRebufferInteraction() took the driver of every accepted buffer move from touched_instances.front(). The StubBufferMoveCandidate of master's TestResizerMt returns a buffer move without touched instances, so TestResizerMt.RepairSetupProfilerNestedCommitThenOuterUndo aborted on the libc++ hardening check of front(). Only BufferMove reports inserted buffers, so return early when a buffer move reports none. Buffer moves without them, such as RebufferMt and the test stub, are not recorded. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Buffer removal may now undo a driver's rebuffering only once, which changes these logs on current master (final WNS, area, last iteration): test master this branch clone_flat, repair_fanout7 -1.213, +47.0%, 1500 -1.213, +48.0%, 1300 repair_fanout7_multi -1.259, +83.2%, 1800 -1.259, +78.6%, 1400 repair_fanout7_skip_pin_swap -1.212, +47.1%, 1400 -1.212, +74.3%, 1300 repair_fanout8 -1.370, +71.1%, 1300 -1.308, +96.5%, 1300 repair_fanout8_multi -1.342, +75.2%, 1400 -1.344, +85.2%, 1200 repair_setup4_sequence -0.358, +16.9%, 316 -0.303, +15.1%, 36 repair_setup_path16 -5.842, +8.6%, 1200 -5.795, +8.8%, 1400 repair_setup_path19 -1.520, +11.5%, 1175 -1.510, +12.5%, 323 repair_setup_path1, 11, 17, and 18 change only the iteration count. clone_flat_out.vok follows clone_flat. All of these tests pass on master as is. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Go back to the first version of this change: BufferCandidate::apply() reports the buffers of the last rebufferPin() call in touched_instances, so MoveCommitter::hasBlockingBufferRemovalMove() keeps all of them with "it was from rebuffering" for the rest of the repair_timing call. This drops the per-driver "undo once" bookkeeping (MoveResult::inserted_buffers, the rebuffer driver map in MoveCommitter, and its empty-move guard). The simple rule needs no extra committer state. On the rsz goldens it is better than "undo once" on the fanout tests and worse where removing a rebuffered buffer helps: repair_setup_path4 keeps two rebuffered buffers in series on its critical path. Replace the two committer tests with TestResizer.BufferMoveMarksInsertedBuffers and refresh the goldens of the 15 tests whose repair_timing results change. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Resolve the conflicts with master in five rsz goldens that both sides changed (repair_setup6_multi and repair_setup_path1, 11, 16, and 19): keep master's version here; the next commit refreshes the ones this branch changes. The source changes of this branch merge cleanly and are unchanged. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
On current master, blocking the removal of rebuffered buffers changes these logs (final WNS, TNS, area): test master this branch repair_setup_path11 -0.072, -0.5, +5.4% -0.072, -0.7, +7.5% repair_setup_path16 -5.906, -1842.4, +7.9% -5.899, -1840.1, +8.5% repair_setup_path19 -1.505, -49.6, +11.7% -1.496, -48.4, +13.4% repair_setup_path1 changes only its last iteration, and repair_setup6_multi now matches master. All five tests pass on master as is. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
There was a problem hiding this comment.
Code Review
This pull request ensures that buffers inserted during setup rebuffering (BufferMove) are correctly tracked and reported as touched instances. Specifically, the Rebuffer class now records the buffers inserted during the most recent rebufferPin call, and BufferCandidate::apply appends these inserted buffers to the list of touched instances returned in MoveResult. This prevents conflict guards, such as MoveCommitter::hasBlockingBufferRemovalMove(), from mistakenly undoing these newly inserted buffers. A new C++ unit test has been added to verify this behavior, and several timing regression test outputs have been updated accordingly. No review comments were provided for evaluation.
|
@maliberty Could you please review this?
|
Clean root-cause fix — propagating inserted buffers through
|
|
Rebuffer kept the buffers of the last rebufferPin() call in last_inserted_buffers_, but exportBufferTree() also appended to it for fullyRebuffer() and applyRebufferTreePlan(), and only rebufferPin() cleared it. The vector could hold buffers of other callers, including instances that were deleted later. Replace the member and lastInsertedBuffers() with an optional inserted_buffers out-parameter on rebufferPin() and exportBufferTree(). BufferCandidate::apply() passes a local vector, so it gets exactly the buffers of its own call, and the other callers pass nothing. BufferMoveMarksInsertedBuffers now checks that touched_instances holds the driver first and exactly move_count buffers after it. No behavior change: the rsz tests pass 331/331 with unchanged goldens. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Summary
BufferCandidate::apply()now reports the buffers that rebuffering inserted intouched_instances, so buffer removal can no longer undo them ("it was from rebuffering") and the remove/re-insert loop on one net is gone.Symptom
Changes
Rebuffer::rebufferPin()BufferCandidate::apply()touched_instances = {driver}touched_instances = {driver, inserted buffers}repair_timingcall ("it was from rebuffering")BUILDmove/BufferCandidate.hhinsrcshdrsflowchart LR B["BufferMove on driver U1<br/>inserts rb1, rb2"] --> T{"touched_instances"} T -->|"Before: U1 only"| R1["UnbufferMove removes rb1<br/>(guard does not match)"] R1 -->|"next pass"| B T -->|"After: U1, rb1, rb2"| R2["UnbufferMove skips rb1, rb2<br/>(it was from rebuffering)"]Impact
repair_timingruntimerepair_timingof nangate45/mempool_group drops from 584 s to 99 s with better TNS.Related
Details
Mechanism
How the loop forms
UnbufferMoveasksMoveCommitter::hasBlockingBufferRemovalMove()before it removes a buffer, and one of its rules is "it was from rebuffering", which checkshasMoves(kBuffer, buffer).BufferCandidate::apply()reported only the driver intouched_instances, so a buffer that rebuffering inserted never matched this rule.touched_instancesholds U1, rb1, and rb2, sohasMoves(kBuffer, rb1)is true and removal skips rb1 for the rest of therepair_timingcall.Why the simple version
MoveResult::inserted_buffersand a buffer-to-driver map inMoveCommitter.4b24103b4c, the two rules give mixed results on the rsz goldens (final WNS / area):Other users of the touched instances
CloneGeneratorskips a driver with a pending buffer move, so the new buffers are not cloned until the move is committed.RebufferMtGeneratorskips a driver that already has a buffer move, which only matters when a PARALLEL_EVAL phase runs after a LEGACY phase in the samerepair_timingcall.Experiments
Setup
4b24103b4c, and After is this PR (e1a83b42b7), which adds only the changes of this PR on top of it.repair_timingphases (LEGACY LAST_GASP CRIT_VT_SWAP).repair_timingon 34 saved post-CTS databases (29 public-PDK, 5 secure-PDK designs), where runtime counts therepair_timingcommand only.ORFS CI, public PDKs (changed designs, finish stage)
ORFS CI, secure PDKs (changed runs, finish stage)
Post-CTS benchmark (changed designs)
Runtime
repair_timingin the CTS and GRT stages takes 2208 → 1684 s in total, where nangate45/mempool_group alone goes 829 → 332 s and the rest (1379 → 1352 s, -2%) matches the drift of unchanged designs (0.94x to 1.00x).Testing
bazelisk test //openroad/rsz/test/...: 331/331 pass, including the newTestResizer.BufferMoveMarksInsertedBuffers, which fails without the fix.clone_flat_out.vokfollows clone_flat.Merge with master
src/toopenroad/, so theRebuffer.hhandTestResizer.ccchanges were ported by hand.