AI Generated DPL PR v2
This is a slightly different version of : https://github.com/The-OpenROAD-Project/OpenROAD/pull/8873
It serves exactly the same purpose : to reduce DRWL under high core utilization.
The differences between this and v1 in terms of QoR on our end have been too close to call.
We are submitting this as an alternative, as we believe there are confidential instances which can determine which is better.
As with v1, please only test circuits at or near the highest core utilization at which they will complete the flow.
Please also use a reasonable variation (2-4 choices each) of hyperparameters.
--AI Generated content follows--
Description
This PR introduces a new Two-Pass Power-Aware Detailed Placement Optimization flow to the detailed placer (DPL). This enhancement aims to reduce routed wirelength and power consumption by iteratively refining cell placement based on a hybrid cost function that balances HPWL and power density.
Motivation:
Standard detailed placement primarily focuses on legalization and wirelength minimization. By incorporating power density awareness and a multi-pass budget-constrained approach, this PR allows the placer to make more informed swaps that can reduce routing congestion and power hotspots without significantly degrading timing.
Key Features and Changes:
-
Two-Pass Optimization Flow (
DetailedGlobalSwap::run):- New Logic: Implements a two-phase optimization.
- Pass 1 (HPWL Profiling): Runs a global swap with a relaxed HPWL limit to establish an "optimal" HPWL baseline. This pass's moves are undone to restore the initial state for the next pass.
- Pass 2 (Power Optimization): Iteratively refines placement over multiple stages (4 iterations with varying displacement limits) using a combined objective of wirelength and local power density. This pass operates within an HPWL budget derived from Pass 1.
- Files Changed:
src/dpl/src/optimization/detailed_global.h: Added private member variables (budget_hpwl_,is_profiling_pass_,tradeoff_,power_contribution_,power_weight_) and new private methods (generateWirelengthOptimalMove,generateRandomMove,calculateAdaptivePowerWeight).src/dpl/src/optimization/detailed_global.cxx: Rewrote therunandglobalSwapmethods to implement the two-pass flow. Added new helper functions (generateWirelengthOptimalMove,generateRandomMove,calculateAdaptivePowerWeight).
- New Logic: Implements a two-phase optimization.
-
Power Density Awareness (
Grid):- New Logic: The
Gridclass now tracks and computes power density across its pixels, enabling the placer to identify and mitigate power hotspots. - Files Changed:
src/dpl/src/infrastructure/Grid.h: Added public methodscomputePowerDensityMap,updatePowerDensity,getPowerDensity, and a private helpernormalizeAndUpdatePowerDensity. Added new member variables:power_density_,total_area_,total_pins_,area_weight_,pin_weight_.src/dpl/src/infrastructure/Grid.cpp: Implemented the new power density computation and update logic. Also added missing#include "network.h"forNetworkclass usage.
- New Logic: The
-
Enhanced Padding Handling (
Pixelstruct):- New Logic: The
Pixelstruct'spadding_reserved_bymember was updated from a singleNode*pointer to anstd::unordered_set<Node*>. This allows multiple cells to reserve padding on the same pixel, supporting more complex spacing rules. - Files Changed:
src/dpl/src/infrastructure/Grid.h: Modified thePixelstruct.src/dpl/src/infrastructure/Grid.cpp: UpdatederasePixelandpaintCellPaddingmethods to correctly interact with thestd::unordered_set.src/dpl/src/Opendp.cpp: ModifiedsetFixedGridCellsto useinsert()forpadding_reserved_by.src/dpl/src/PlacementDRC.cpp: ModifiedcheckPaddingto iterate over thepadding_reserved_byset for conflict detection.
- New Logic: The
-
Journaling Improvements (
Journal):- New Logic: The
Journalclass was updated to provide mutable access and support range-based for loops, which are critical for the undo/redo mechanisms used in the multi-pass optimization. - Files Changed:
src/dpl/src/util/journal.h: Addedbegin()andend()methods.src/dpl/src/optimization/detailed_manager.h: UpdatedgetJournal()to return a non-const reference.
- New Logic: The
How to Enable/Disable and Hyperparameters:
The power-aware detailed placement optimization is controlled by the ENABLE_DPO environment variable or configuration setting.
-
Enabling/Disabling:
- The feature is enabled by default through
ENABLE_DPO = 1inflow/scripts/variables.yaml, which is read by the flow scripts. - To disable the feature, you can set
ENABLE_DPO = 0in yourconfig.mkfor a specific design or exportexport ENABLE_DPO=0in your shell environment before running the flow.
- The feature is enabled by default through
-
Exposed Hyperparameters (via
improve_placementcommand arguments):-p <passes>: Sets the number of optimization passes (default: 1).-t <tolerance>: Sets the tolerance for HPWL improvement to stop early (default: 0.01).-x <tradeoff_value>: Controls the trade-off between wirelength-optimal moves and random exploration for power optimization. Value ranges from 0.0 (pure wirelength) to 1.0 (full exploration for power) (default: 0.2).DPO_MAX_DISPLACEMENT <disp_x> <disp_y>: Specifies the maximum allowed displacement for instances during optimization. This can be set in aconfig.mkfile (e.g.,export DPO_MAX_DISPLACEMENT = "100 20"). If unset, adaptive displacement limits are used by the flow (chip dimensions in early iterations, then scaled versions of the original displacement limits).
-
Internal Hyperparameters (not directly exposed via Tcl commands):
num_samples(150): Number of random swaps sampled internally for adaptive power weight calculation.user_knob(35.0): Tuning parameter within adaptive weight calculation to prioritize power over HPWL.