Repository navigation
place: size incremental placement to the swapped modules and enable repair setup after a swap - #4861
Conversation
Signed-off-by: LucasYuki <lucasyuki@yahoo.com.br>
Signed-off-by: LucasYuki <lucasyuki@yahoo.com.br>
Signed-off-by: LucasYuki <lucasyuki@yahoo.com.br>
Signed-off-by: LucasYuki <lucasyuki@yahoo.com.br>
There was a problem hiding this comment.
Code Review
This pull request updates the placement resize stage to dynamically adjust the incremental placement overflow target when SWAP_ARITH_OPERATORS swaps modules, and ensures setup repair timing is run afterward. It also introduces a helper procedure instance_area_um2 to calculate the total area of instances. The review feedback suggests optimizing this new procedure by performing the area summation in DBUs inside the loop and converting to microns once at the end, which avoids a significant performance bottleneck from repeated Tcl-to-C++ SWIG calls.
| proc instance_area_um2 { args } { | ||
| sta::parse_key_args "instance_area_um2" args keys {} flags {-unplaced} | ||
| set unplaced_only [info exists flags(-unplaced)] | ||
| set area 0.0 | ||
| foreach inst [[ord::get_db_block] getInsts] { | ||
| if { $unplaced_only && [$inst isPlaced] } { | ||
| continue | ||
| } | ||
| set master [$inst getMaster] | ||
| set area [expr { | ||
| $area + [ord::dbu_to_microns [$master getWidth]] | ||
| * [ord::dbu_to_microns [$master getHeight]] | ||
| }] | ||
| } | ||
| return $area | ||
| } |
There was a problem hiding this comment.
Calling ord::dbu_to_microns twice per instance inside the loop introduces a significant performance bottleneck for large designs with millions of instances due to the overhead of Tcl-to-C++ SWIG calls.
We can optimize this by summing the area in DBUs (integers) inside the loop, and then converting the total sum to square microns once at the end using a single conversion factor. This avoids millions of SWIG calls and speeds up the procedure significantly.
proc instance_area_um2 { args } {
sta::parse_key_args "instance_area_um2" args keys {} flags {-unplaced}
set unplaced_only [info exists flags(-unplaced)]
set area_dbu 0
foreach inst [[ord::get_db_block] getInsts] {
if { $unplaced_only && [$inst isPlaced] } {
continue
}
set master [$inst getMaster]
set area_dbu [expr { $area_dbu + [$master getWidth] * [$master getHeight] }]
}
set dbu_factor [ord::dbu_to_microns 1]
return [expr { $area_dbu * $dbu_factor * $dbu_factor }]
}
🔍 QoR checkMetrics reflect the PR merge build — i.e. what will land on the target branch. Commit 62 design(s) checked — 0 with regression(s), 26 without a comparable baseline. |
Summary
Flow side of the arithmetic module swap changes in OpenROAD PR The-OpenROAD-Project/OpenROAD#12391. This PR doesn't change
tools/OpenROAD. It needs the OpenROAD PR for the return value ofreplace_arith_modulesand forglobal_placement -incremental_phase2_overflow, so it can only be merged after #12391 is merged and ORFS'stools/OpenROADpin is updated past it. Until then, step 3_4 fails on designs with SWAP_ARITH_OPERATORS=1. The QoR below comes from a run withtools/OpenROADat #12391's head, 9b1585a2b4. Both branches are based on OpenROAD 4543b6b65b and ORFS 25331f7.Changes
In
resize.tcl(step 3_4), when SWAP_ARITH_OPERATORS=1:global_placement -incrementalgrows with the area the swapped modules add. It is 0.1 plus the share of the new modules' area that does not fit in the area of the cells they replaced,max(0, (new - old) / new), capped at 1. Phase 2 then brings the whole design to 0.1 (-incremental_phase2_overflow 0.1). The log reports both areas and the target.repair_timing_helper -setup -skip_last_gasp). Hold is left to CTS.ENABLE_PLACE_REPAIR_TIMING=1 now runs this setup-only repair instead of setup and hold repair. It still defaults to 0, and no design in the repo sets it. FlowVariables.md and variables.yaml are updated to match.
util.tcladdsinstance_area_um2 [-unplaced], which returns the total instance area in um^2.QoR
All 62 public designs: OpenROAD-flow-scripts-Private » r2_swap_fix_unl_nop2_rtall #7 against master at the same base (Nightly-Public #7774). All designs finish, and the Jenkins QoR check passes.
The 55 designs that swap nothing end with identical WS and TNS. The 7 that swap refuse none; master refuses 16. Master → branch: