Repository navigation
Conversation
- Save and restore movable macro state in pre-allocated member buffers in SACoreSoftMacro and SACoreHardMacro, preserving int64_t area_ bit-identically after setWidth, setHeight, or resizeRandomly with zero per-move allocations. - Replace O(n^2) prefix-maximum packing in SimulatedAnnealingCore::packFloorplan with an O(n log n) prefix-maximum Fenwick tree and backward Y pass using pre-allocated buffers. - Reuse pre-allocated member buffers in SACoreSoftMacro::fillCoordsLists and calNotchPenalty, and precompute nets_weight_sum_ and flat IO cluster constraints in SimulatedAnnealingCore. - Report macro area as a percentage of outline area in MPL-0003 when no valid tilings are found. - Expose -random_seed <seed> on rtl_macro_placer and add unit/Tcl tests. Signed-off-by: Eren Dogan <erendogan@google.com>
- Add testonly packing_oracle library (PackingOracle.h, PackingOracle.cpp) using OR-Tools CP-SAT AddNoOverlap2D with fixed intervals, discrete shape literals, and floor-division bounds (A - w < w * h <= A) for soft macros. - Add packing problem text serializer/deserializer and benchmark corpus (testcases/packing_corpus.txt). - Implement SoftPackingHarness and HardPackingHarness inverse adapters and mpl_annealer_packing_unittest. Signed-off-by: Eren Dogan <erendogan@google.com>
- Expose -anneal_end_acceptance <p> and -anneal_patience <f> on rtl_macro_placer with range validation (MPL-0081, MPL-0082) and per-session reset. - Derive min_t from init_temperature_ and anneal_end_acceptance_ so geometric cooling spans a fixed number of acceptance-probability decades, and stop early after t_freeze when best_step stalls for ceil(f * max_num_step_) steps. - Track is_best_result_valid_ in SimulatedAnnealingCore and restore both widths and heights in SACoreSoftMacro::useBestResult. - Maintain a macro-to-net adjacency index for incremental O(|touched_nets|) wirelength updates when at most half of the movable macros move. Signed-off-by: Eren Dogan <erendogan@google.com>
- Add copyNormalizationFactorsFrom, setWeights, and selectBestCandidateByCommonCost to compare candidate annealers under a shared normalization baseline and common SACoreWeights. - Expose -placement_seeds <N> on rtl_macro_placer (MPL-0083) to run N seeds per utilization level in HierRTLMP::placeChildren in deterministic thread batches and rank valid candidates in placeChildren and placeMacros by common cost. - Add unit tests and Tcl regression checks for multi-seed selection and thread-count determinism. Signed-off-by: Eren Dogan <erendogan@google.com>
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
There was a problem hiding this comment.
Code Review
This pull request introduces several enhancements to the macro placer, including an O(n log n) Fenwick tree-based floorplan packing algorithm, incremental wirelength calculations, relative cooling schedules, and multi-seed simulated annealing with common-cost candidate selection. It also exposes new parameters (-random_seed, -anneal_end_acceptance, -anneal_patience, and -placement_seeds) to the Tcl interface and adds comprehensive unit tests. A critical issue was identified in runSingleSeedClusterPlacement where run_id is never incremented, which prevents the exploration of higher utilization levels when running with fewer threads.
|
@joaomai I added a CP SAT solver too to have a ground truth... It adds code and perhaps not part of production code, but this is the second time someone found CP SAT ground truth useful for evaluation RTL MP. |
Signed-off-by: Eren Dogan <erendogan@google.com>
Summary
This improves
mpl(HierRTLMP) simulated annealing robustness, packing quality, and determinism across cluster placement (SACoreSoftMacro) and hard macro placement (SACoreHardMacro):-random_seed, and DiagnosticMPL-0003:SimulatedAnnealingCore::perturb()so every candidate move (packFloorplan(),singleSeqSwap(),doubleSeqSwap(),resizeOneCluster()) immediately callspackFloorplan(), keeping macro coordinates andwidth_/height_synchronized with the Sequence Pair after every perturbation.results_saved_overwrite with true best-everbest_result_tracking (best_cost_,best_pre_cost_,best_norm_*,best_seq_,best_macros_) updated whenever a valid/improved state is discovered and restored viauseBestResult().-random_seed(default1) tortl_macro_placerto thread deterministic base seeds across all SA workers withoutstaticRNG state, ensuring repeatable back-to-back runs within a single OpenROAD session.MPL-0003(SACoreSoftMacro::printResults()) to report exact cluster area vs. outline area (inPackingOracle,//src/mpl/test:mpl_packing_oracle) with disjunctive interval constraints and a fast deadspace pre-filter.src/mpl/test/testcases/packing_corpus.txt) and GTest suites (mpl_annealer_core_unittest,mpl_annealer_packing_unittest).NetEndpointEntry,macro_to_nets_,cached_net_hpwl_) for swap and resize moves while keeping centralized full-recomputation verification incalNormCost().HierRTLMP::runCoarseShaping()tilings with exact deadspace-free bounding boxes (placeMacroretry loop inHierRTLMP::updateMacroClusters()with a deterministic OpenMP parallel multi-seed sweep across valid utilization indices and 3 deterministic seeds per index, plus a two-stage high-budget fallback (2xsteps with1.5xoutline penalty, then4xsteps with2.0xoutline penalty) when no outline-valid placement is found.selectBestCandidateByCommonCost()so candidate SA workers with heterogeneous per-worker normalization baselines (norm_area_penalty_,norm_wl_,norm_guidance_cost_,norm_fence_cost_,norm_ macro_blockage_cost_,norm_notch_cost_) are compared on a unified common normalization baseline rather than raw per-worker normalized costs.Type of Change
Impact
-random_seedinteger argument (default1) tortl_macro_placer. Existing scripts run unchanged.rtl_macro_placermultiple times in the same OpenROAD session now produces identical placements (//src/mpl/test:rerun1-tcl_test).MPL-0003now prints cluster area vs. outline area inMPL-0081,MPL-0082, andMPL-0083for-random_seedvalidation and fallback recovery reporting.mpl_annealer_packing_unittest) to 95.0% (SACoreHardMacro) and 91.7% (SACoreSoftMacro).asap7,gf180,ihp-sg13g2,nangate45,sky130hd,sky130hs),mplcompletes with 0 errors, reduces meanmplruntime by ~41% via patience early-stopping and incremental wirelength evaluation, and reduces post-MPL macro HPWL by up to 27.6% (nangate45/mempool_group) and 19.7% (nangate45/bp_fe).Verification
./etc/Build.sh).Related Issues
#11807