Repository navigation
Conversation
What: set_dont_use, unset_dont_use and reset_dont_use now clear the VT equivalent cell cache of getVTEquivCells(). Why: getVTEquivCells() skips dont_use cells but caches its result per cell, and the dont_use commands cleared every other dont_use dependent cache except this one. A flow that keeps some VTs on dont_use during one repair and lifts them later in the same session kept the VT lists of the first repair, so VT swap could not reach the lifted VTs. How: - Clear vt_equiv_cells_cache_ in Resizer::setDontUse() and Resizer::resetDontUse(). - New test repair_setup_vt_swap_unset_dont_use (ASAP7 gcd): VT swap with SLVT on dont_use, then again after unset_dont_use. The second repair moved 24 cells and ended at WNS -36.1 ps before, 37 cells and -30.7 ps now. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
What: with only one usable VT (e.g. a flow that puts every VT but the fastest on dont_use), VT swap now moves an instance whose cell is in a dont_use VT to its equivalent in the usable VT. Why: synthesis can map cells outside DONT_USE_CELLS. A platform latch map that always makes latches of one slower VT left clock-enable latches on that VT in a fastest-VT-only flow, and their clock gating checks set the WNS. VtSwap was disabled because vtCategoryCount() counts only the usable buffer VTs, and SizeUpMt keeps the VT of the cell, so no repair move could leave the slower VT cell. How: - Resizer::getVTEquivCells keeps the usable-VT equivalents of a dont_use source cell when fewer than two VT categories are usable. - Resizer::canVtSwap(cell) allows a swap with two or more usable VTs, or for a dont_use cell with a usable-VT equivalent; VtSwapMtGenerator::isApplicable and VtSwapGenerator::selectPathBestCell use it instead of vtCategoryCount(). - SetupParallelEvalPolicy keeps VtSwapMt in a single-VT library when Resizer::hasDontUseVtSwapInstances() finds such an instance. - New test repair_setup_parallel_eval_vt_swap_dont_use: ASAP7 gcd with only SLVT usable; RVT and LVT cells on violating paths move to SLVT (previously no move). Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
What: PARALLEL_EVAL keeps VtSwapMt when the library has two or more VT categories with the dont_use ones included, and Resizer::hasDontUseVtSwapInstances() is removed. Why: the policy scanned every leaf instance at its start to find one on a dont_use VT. The question only decides whether VtSwapMt is in the move set; Resizer::canVtSwap() already decides per cell, so a library level answer is enough and costs nothing per run. How: - getBufferList() counts the VT categories of the buffers before the dont_use filter into LibraryAnalysisData::vt_category_count_with_dont_use. - SetupParallelEvalPolicy::moveEnabled() uses Resizer::vtCategoryCountWithDontUse() > 1. - A library with a single VT still drops VtSwapMt. No golden changes. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
What: - LEGACY setup repair keeps VtSwap when the library has two or more VTs with the dont_use ones included, as PARALLEL_EVAL does. - The library VT data is rebuilt after a dont_use change also without buffer pruning and when getVTEquivCells() runs before findBuffers(). - The VT list of a dont_use cell is no longer shared with its equivalents. Why: - SetupLegacyBase::hasVtSwapCells() still counted the usable VTs only, so the default flow never moved a cell off a dont_use VT. - set_dont_use clears buffer_cells_, but the library VT data was rebuilt only by findBuffers() with pruning. Without pruning, or for a caller that asks getVTEquivCells() first, the VT count of the old dont_use list stayed and VT swap found no equivalent. - getVTEquivCells() cached the list of a source cell for every cell in it. The list of a dont_use source holds that cell, so a usable cell could swap to a dont_use VT (RVT cells moved to SLVT under set_dont_use SLVT). How: - hasVtSwapCells() uses Resizer::vtCategoryCountWithDontUse(). - findBuffersNoPruning() and getVTEquivCells() rebuild the library data when buffer_cells_ is empty. - getVTEquivCells() caches the list for the equivalents only when the source cell is usable. - New tests repair_setup_vt_swap_dont_use (LEGACY, one usable VT) and repair_setup_vt_swap_unset_dont_use_no_pruning; the golden of repair_setup_vt_swap_unset_dont_use changes (SLVT stays at 125 cells while it is dont_use). Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
There was a problem hiding this comment.
Code Review
This pull request enables VT swapping when only one usable VT is available by allowing cells mapped to a dont_use VT to be swapped to the usable VT. It introduces helper methods to track VT categories including dont_use ones and adds corresponding test cases. The reviewer pointed out a critical performance bottleneck in findBuffersNoPruning and getVTEquivCells where using a local buffer_list instead of populating the member variable buffer_cells_ leaves it empty, causing redundant and expensive rebuilds of the library data.
precisionmoon
left a comment
There was a problem hiding this comment.
Please resolve the merge conflicts first.
…vt-only Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com> # Conflicts: # src/rsz/src/policy/SetupParallelEvalPolicy.cc
…ter merge The relative leakage cost that master added to the PARALLEL_EVAL cell swaps changes which VT the second repair_timing picks once SLVT is usable again (SLVT 125 -> 147 instead of 125 -> 168). The first repair, where SLVT is dont_use, is unchanged and SLVT still stays at 125. Regenerate the golden log from the merged build. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
|
@precisionmoon Resolved the conflict. |
Bring in master at bc2631a after the OpenROAD source tree move. Place the four VT swap regression scripts and golden logs in the new openroad/rsz/test directory while preserving the PR's VT swap logic. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
| } | ||
| vt_categories_with_dont_use.insert(cellVTType(master)); | ||
| if (dontUse(buffer)) { | ||
| continue; |
There was a problem hiding this comment.
What happens when cellVTType is "-" (no obstruction layers)? Does this skew the VT count?
There was a problem hiding this comment.
Yes. It is considered as another Vt type. But it does not incur any functional error.
| { | ||
| if (!lib_data_) { | ||
| // A dont_use change clears buffer_cells_; the library data is stale then. | ||
| if (!lib_data_ || buffer_cells_.empty()) { |
There was a problem hiding this comment.
It's not safe to use buffer_cells_.emptyI() as proxy for stale library data. Hold fixing can modify buffer_cells_ also.
There was a problem hiding this comment.
I'll fix it.
In the repair hold, the current buffer_cells_ modification to allow CLKBUF usage for hold fixing looks problematic.
I handled it in another PR: #12360
| if (!lib_data_) { | ||
| // A dont_use change clears buffer_cells_; rebuild the library data when a | ||
| // caller asks before findBuffers() does. | ||
| if (!lib_data_ || buffer_cells_.empty()) { |
There was a problem hiding this comment.
It's not safe to use buffer_cells_.emptyI() as proxy for stale library data. Hold fixing can modify buffer_cells_ also.
There was a problem hiding this comment.
I'll fix it.
In the repair hold, the current buffer_cells_ modification to allow CLKBUF usage for hold fixing looks problematic.
I handled it in another PR: #12360
precisionmoon
left a comment
There was a problem hiding this comment.
Please fix two issues in the comment.
- cellVTType == "-" impacting VT count
- unsafe use of buffer_cells_.empty() for stale lib data
Track the clock-buffer filter used to build library VT data and invalidate it when dont_use changes. Hold repair temporarily includes clock buffers and restores only the selected buffer list, so list emptiness cannot establish whether the analysis matches the current filter. Exclude buffers without an implant-defined VT from the new all-buffer VT count while preserving existing usable-VT analysis. Clear filter-dependent fast-buffer and equivalent-cell caches on refresh, and add C++ regressions for hold, no-pruning and VT lookup paths. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Replace the clock-buffer filter tracking of the previous commit with an explicit reset of lib_data_ in setDontUse() and resetDontUse(), and restore the original !lib_data_ checks in findBuffersNoPruning() and getVTEquivCells(). The library analysis data is built from the usable buffers only, so a dont_use change is what makes it stale. Hold repair no longer swaps the buffer list or the clock-buffer filter (rsz: Use data buffers only for hold repair), so a dont_use change is the only remaining trigger, and buffer_cells_ emptiness is no longer used as a staleness proxy. A reset lib_data_ is rebuilt once by the next getBufferList() call, whereas the proxy rebuilt it on every uncached VT lookup while buffer_cells_ stayed empty. Keep the all-buffer VT count consistent with vtCategoryCount() for cells without implant layers; their handling moves to a separate change. Remove the hold-specific C++ regressions. The unset_dont_use Tcl regressions cover the pruned and unpruned refresh paths, and repair_setup_vt_swap_unset_dont_use_no_pruning fails without the reset. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
A cell without IMPLANT obstructions gets vt_index 0 ("-") from
cellVTType(). It was used as a VT category of its own: vtCategoryCount()
and vtCategoryCountWithDontUse() counted it, findBuffers() and
RepairHold could pick it as the best VT, and VT swap used it as a source
and a target. In a library that mixes implant-defined and implant-less
cells, this adds a VT that does not exist and lets VT swap move cells
between identified VTs and an unknown one.
Name the sentinel VTCategory::kUnclassifiedVtIndex and add
VTCategory::isClassified(). getBufferList() builds the VT categories and
the all-buffer VT count from identified VTs only. getVTEquivCells()
returns no alternatives for an unclassified source cell and skips
unclassified candidates.
With no identified VT, the existing best_vt_index == -1 path in
findBuffers() and RepairHold turns the VT filter off, so a library
without implant layers selects the same buffers as before and
report_buffers reports 0 VT types. A fully identified library is
unchanged. Keep-VT checks in sizing still compare vt_index, so an
unclassified cell sizes only among unclassified cells.
Give BUF_X2 an explicit RVT implant in the VT deduplication test, which
relied on "-" as RVT, and add tests for a library without implant layers
and for a mixed library.
Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
The kUnclassifiedVtIndex initializers in cellVTType() span two lines, so clang-tidy readability-trailing-comma flags them in the PR diff. Add the trailing commas; clang-format then puts each designator on its own line. No functional change. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
vtCategoryCount() and vtCategoryCountWithDontUse() return different counts, but the header did not say what vtCategoryCount() counts, and the comment of vtCategoryCountWithDontUse() said "in the library" although only buffers are counted. Document both as buffer VT counts: the usable buffers for vtCategoryCount() and all buffers with an identified VT, dont_use ones included, for vtCategoryCountWithDontUse(). Comment-only change. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
…vt-only Resolve the TestResizer.cc conflict by keeping both test sets: the VT category tests of this branch and the report_vt_usage tests from master. getBufferList() keeps the unclassified VT exclusion of this branch on top of master's unconditional clock buffer exclusion. report_vt_usage keeps reporting implant-less cells as "-" because cellVTType() still names them so. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
|
Summary
Why this PR is needed
Problem
getVTEquivCells()caches its result per cell, andset_dont_use/unset_dont_use/reset_dont_usedo not clear the cacheunset_dont_use, VT swap still uses the VT list of the earlier repair and cannot reach the lifted VTfindBuffers()with buffer pruninggetVTEquivCells()runs first, the VT count of the old dont_use list stays and VT swap finds no equivalentgetVTEquivCells()caches the list of a dont_use source cell for every cell in itset_dont_useSLVT)repair_setup_vt_swap_unset_dont_use): secondrepair_timingafterunset_dont_useof SLVT.repair_setup_parallel_eval_vt_swap_dont_use): no VT swap before; RVT and LVT cells on violating paths move to SLVT after.Changes
Resizer::setDontUse(),Resizer::resetDontUse()vt_equiv_cells_cache_Resizer::getVTEquivCells()vtCategoryCount() < 2disables the moveResizer::canVtSwap(cell): two or more usable VTs, or a dont_use cell with a usable VT equivalent; used byVtSwapMtGeneratorandVtSwapGeneratorSetupLegacyBase::hasVtSwapCells()Resizer::vtCategoryCountWithDontUse()as PARALLEL_EVAL doesfindBuffers()with pruningfindBuffersNoPruning()andgetVTEquivCells()whenbuffer_cells_is emptygetVTEquivCells()SetupParallelEvalPolicyResizer::vtCategoryCountWithDontUse(), counted once with the library data, no instance scan); a single-VT library still drops itImpact
Details
Commits
rsz: Clear the VT equivalent cache when dont_use changes: The cache fix and its test.rsz: Let VT swap move dont_use VT cells to the usable VT: The single-usable-VT swap and its test.rsz: Gate VtSwapMt on the library VT count instead of an instance scan: Replaces the per-run leaf instance scan with a library-level VT count.rsz: Cover LEGACY VT swap and stale VT data after dont_use changes: The LEGACY gate, the library VT data refresh and the unshared list of a dont_use cell, with two tests.Testing
bazelisk test //src/rsz/test/...with the Tcl format and lint tests: 330 pass.repair_setup_vt_swap_unset_dont_use,repair_setup_vt_swap_unset_dont_use_no_pruning,repair_setup_vt_swap_dont_use(LEGACY),repair_setup_parallel_eval_vt_swap_dont_use.