Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
37733f0
Modified DPL v1
PrecisEDAnon Dec 14, 2025
6cee00e
Tune DPL global swap hyperparameters for aggressive exploration (-x 0…
PrecisEDAnon Dec 14, 2025
d3f905a
Clean pre-rebase
PrecisEDAnon Dec 14, 2025
ddaad80
Add extra DPL toggle
PrecisEDAnon Dec 14, 2025
d37ee55
temp fixes
PrecisEDAnon Dec 14, 2025
e2200cb
fixes dec 9
PrecisEDAnon Dec 14, 2025
695f98b
toggle off fixed
PrecisEDAnon Dec 14, 2025
af2e06d
dpl: use global swap params for gs -p/-t
PrecisEDAnon Dec 14, 2025
45fdc3d
Update Optdp.cpp
PrecisEDAnon Dec 18, 2025
17bed70
Update src/dpl/src/infrastructure/Grid.cpp
PrecisEDAnon Dec 18, 2025
37d53e2
Update src/dpl/src/infrastructure/Grid.cpp
PrecisEDAnon Dec 18, 2025
20e4d30
Update src/dpl/src/optimization/detailed_global_legacy.cxx
PrecisEDAnon Dec 18, 2025
39b13e7
Update src/dpl/src/optimization/detailed_global_legacy.cxx
PrecisEDAnon Dec 18, 2025
f73e725
Update src/dpl/src/optimization/detailed_global_legacy.cxx
PrecisEDAnon Dec 18, 2025
5b347da
Update src/dpl/src/optimization/detailed_global_legacy.cxx
PrecisEDAnon Dec 18, 2025
9f01c8a
Update src/dpl/src/optimization/detailed_global_legacy.cxx
PrecisEDAnon Dec 18, 2025
cd3381b
Update src/dpl/src/optimization/detailed_global_legacy.cxx
PrecisEDAnon Dec 18, 2025
28dbe18
Update src/dpl/src/optimization/detailed_global_legacy.cxx
PrecisEDAnon Dec 18, 2025
1662200
Update src/dpl/src/optimization/detailed_global_legacy.cxx
PrecisEDAnon Dec 18, 2025
2ed3295
Update src/dpl/src/optimization/detailed_global_legacy.cxx
PrecisEDAnon Dec 18, 2025
cea246b
Update src/dpl/src/optimization/detailed_global_legacy.cxx
PrecisEDAnon Dec 18, 2025
132a49f
Update detailed_global.cxx
PrecisEDAnon Dec 18, 2025
d5408b2
Update detailed_global_legacy.cxx
PrecisEDAnon Dec 18, 2025
4f9db8a
Update Grid.cpp
PrecisEDAnon Dec 18, 2025
48c0222
Update detailed_global_legacy.cxx
PrecisEDAnon Dec 18, 2025
5a0c9e3
Update detailed_global_legacy.cxx
PrecisEDAnon Dec 18, 2025
d1adc25
Update detailed_global_legacy.cxx
PrecisEDAnon Dec 20, 2025
cb5ce4b
Update Opendp.tcl
PrecisEDAnon Dec 20, 2025
a9fd667
dpl: tidy includes and format
PrecisEDAnon Jan 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/dpl/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ cc_library(
"src/optimization/detailed_generator.h",
"src/optimization/detailed_global.cxx",
"src/optimization/detailed_global.h",
"src/optimization/detailed_global_legacy.cxx",
"src/optimization/detailed_global_legacy.h",
"src/optimization/detailed_manager.cxx",
"src/optimization/detailed_manager.h",
"src/optimization/detailed_mis.cxx",
Expand Down
1 change: 1 addition & 0 deletions src/dpl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ add_library(dpl_lib
src/optimization/detailed_mis.cxx
src/optimization/detailed_reorder.cxx
src/optimization/detailed_global.cxx
src/optimization/detailed_global_legacy.cxx
src/optimization/detailed_vertical.cxx
src/objective/detailed_displacement.cxx
src/objective/detailed_hpwl.cxx
Expand Down
33 changes: 33 additions & 0 deletions src/dpl/include/dpl/Opendp.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,20 @@ using IRDropByPoint = std::map<odb::Point, double>;
struct GapInfo;
struct DecapCell;
struct IRDrop;

struct GlobalSwapParams
{
int passes = 2;
double tolerance = 0.01;
double tradeoff = 0.4;
double profiling_excess = 1.10;
std::vector<double> budget_multipliers{1.50, 1.25, 1.10, 1.04};
double area_weight = 0.4;
double pin_weight = 0.6;
double user_congestion_weight = 35.0;
int sampling_moves = 150;
int normalization_interval = 1000;
};
////////////////////////////////////////////////////////////////

class Opendp
Expand Down Expand Up @@ -118,6 +132,23 @@ class Opendp
bool verbose);
void removeFillers();
void optimizeMirroring();
void resetGlobalSwapParams();
void configureGlobalSwapParams(int passes,
double tolerance,
double tradeoff,
double area_weight,
double pin_weight,
double user_weight,
int sampling_moves,
int normalization_interval,
double profiling_excess,
const std::vector<double>& budget_multipliers);
const GlobalSwapParams& getGlobalSwapParams() const
{
return global_swap_params_;
}
void setExtraDplEnabled(bool enabled) { extra_dpl_enabled_ = enabled; }
bool isExtraDplEnabled() const { return extra_dpl_enabled_; }

// Place decap cells
void addDecapMaster(odb::dbMaster* decap_master, double decap_cap);
Expand Down Expand Up @@ -355,6 +386,8 @@ class Opendp
static constexpr double group_refine_percent_ = .05;
static constexpr double refine_percent_ = .02;
static constexpr int rand_seed_ = 777;
GlobalSwapParams global_swap_params_;
bool extra_dpl_enabled_ = false;
};

int divRound(int dividend, int divisor);
Expand Down
65 changes: 64 additions & 1 deletion src/dpl/src/Opendp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
#include <vector>

#include "PlacementDRC.h"
#include "boost/geometry/geometry.hpp"
#include "boost/geometry/index/predicates.hpp"
#include "dpl/OptMirror.h"
#include "graphics/DplObserver.h"
#include "infrastructure/Coordinates.h"
// NOLINTNEXTLINE(misc-include-cleaner) // Needed for DecapCell/GapInfo
// completeness in ~Opendp()
#include "infrastructure/DecapObjects.h"
#include "infrastructure/Grid.h"
#include "infrastructure/Objects.h"
Expand Down Expand Up @@ -220,6 +222,67 @@ void Opendp::optimizeMirroring()
opt.run();
}

void Opendp::resetGlobalSwapParams()
{
global_swap_params_ = GlobalSwapParams();
}

void Opendp::configureGlobalSwapParams(
int passes,
double tolerance,
double tradeoff,
double area_weight,
double pin_weight,
double user_weight,
int sampling_moves,
int normalization_interval,
double profiling_excess,
const std::vector<double>& budget_multipliers)
{
if (passes > 0) {
global_swap_params_.passes = passes;
}
if (tolerance > 0.0) {
global_swap_params_.tolerance = tolerance;
}
if (tradeoff >= 0.0) {
global_swap_params_.tradeoff = std::max(0.0, std::min(1.0, tradeoff));
}
if (area_weight >= 0.0) {
global_swap_params_.area_weight = area_weight;
}
if (pin_weight >= 0.0) {
global_swap_params_.pin_weight = pin_weight;
}
if (user_weight > 0.0) {
global_swap_params_.user_congestion_weight = user_weight;
}
if (sampling_moves > 0) {
global_swap_params_.sampling_moves = sampling_moves;
}
if (normalization_interval > 0) {
global_swap_params_.normalization_interval = normalization_interval;
}
if (profiling_excess > 0.0) {
global_swap_params_.profiling_excess = profiling_excess;
}
if (!budget_multipliers.empty()) {
global_swap_params_.budget_multipliers = budget_multipliers;
}
if (global_swap_params_.budget_multipliers.empty()) {
global_swap_params_.budget_multipliers = {1.0};
}
if (global_swap_params_.area_weight < 0.0
|| global_swap_params_.pin_weight < 0.0) {
logger_->error(DPL, 1280, "Utilization weights must be non-negative.");
}
if (global_swap_params_.area_weight == 0.0
&& global_swap_params_.pin_weight == 0.0) {
logger_->error(
DPL, 1281, "At least one utilization weight must be greater than 0.");
}
}

int Opendp::disp(const Node* cell) const
{
const DbuPt init = initialLocation(cell, false);
Expand Down
47 changes: 47 additions & 0 deletions src/dpl/src/Opendp.i
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// clang-format off
%{

#include <sstream>

#include "ord/OpenRoad.hh"
#include "graphics/Graphics.h"
#include "graphics/DplObserver.h"
Expand Down Expand Up @@ -113,6 +115,51 @@ void improve_placement_cmd(int seed,
opendp->improvePlacement(seed, max_displacement_x, max_displacement_y);
}

void reset_global_swap_params_cmd()
{
dpl::Opendp* opendp = ord::OpenRoad::openRoad()->getOpendp();
opendp->resetGlobalSwapParams();
}

void configure_global_swap_params_cmd(int passes,
double tolerance,
double tradeoff,
double area_weight,
double pin_weight,
double user_weight,
int sampling_moves,
int normalization_interval,
double profiling_excess,
const char* budget_multipliers_str)
{
std::vector<double> budget_multipliers;
if (budget_multipliers_str != nullptr) {
std::stringstream ss(budget_multipliers_str);
double value;
while (ss >> value) {
budget_multipliers.push_back(value);
}
}

dpl::Opendp* opendp = ord::OpenRoad::openRoad()->getOpendp();
opendp->configureGlobalSwapParams(passes,
tolerance,
tradeoff,
area_weight,
pin_weight,
user_weight,
sampling_moves,
normalization_interval,
profiling_excess,
budget_multipliers);
}

void set_extra_dpl_cmd(bool enable)
{
dpl::Opendp* opendp = ord::OpenRoad::openRoad()->getOpendp();
opendp->setExtraDplEnabled(enable);
}

} // namespace

%} // inline
95 changes: 94 additions & 1 deletion src/dpl/src/Opendp.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,15 @@ proc optimize_mirroring { args } {
sta::define_cmd_args "improve_placement" {\
[-random_seed seed]\
[-max_displacement disp|{disp_x disp_y}]\
[-global_swap_args {options}]\
[-enable_extra_dpl bool]\
[-disallow_one_site_gaps]\
}

proc improve_placement { args } {
sta::parse_key_args "improve_placement" args \
keys {-random_seed -max_displacement} flags {-disallow_one_site_gaps}
keys {-random_seed -max_displacement -global_swap_args -enable_extra_dpl} \
flags {-disallow_one_site_gaps}

if { [ord::get_db_block] == "NULL" } {
utl::error DPL 342 "No design block found."
Expand Down Expand Up @@ -196,6 +199,96 @@ proc improve_placement { args } {
set max_displacement_y 0
}

dpl::reset_global_swap_params_cmd
if { [info exists keys(-global_swap_args)] } {
set global_swap_passes -1
set global_swap_tolerance -1
set global_swap_tradeoff -1
set global_swap_area_weight -1
set global_swap_pin_weight -1
set global_swap_user_weight -1
set global_swap_sampling -1
set global_swap_normalization -1
set global_swap_profiling_excess -1
set global_swap_budget_list {}

set global_swap_args $keys(-global_swap_args)
if { ([llength $global_swap_args] % 2) != 0 } {
sta::error DPL 345 "-global_swap_args must be key/value pairs"
}
foreach {opt value} $global_swap_args {
switch -- $opt {
-passes {
set global_swap_passes $value
}
-tolerance {
set global_swap_tolerance $value
}
-tradeoff {
set global_swap_tradeoff $value
}
-area_weight {
set global_swap_area_weight $value
}
-pin_weight {
set global_swap_pin_weight $value
}
-congestion_user_weight {
set global_swap_user_weight $value
}
-sampling_moves {
set global_swap_sampling $value
}
-normalization_interval {
set global_swap_normalization $value
}
-profiling_excess {
set global_swap_profiling_excess $value
}
-budget_multipliers {
set global_swap_budget_list {}
foreach multiplier $value {
set trimmed [string trim $multiplier]
if { $trimmed eq "" } {
continue
}
if { [catch { expr { double($trimmed) } } parsed] } {
sta::error DPL 347 "Invalid -budget_multipliers value \"$multiplier\""
}
lappend global_swap_budget_list $parsed
}
}
default {
sta::error DPL 346 "Unknown -global_swap_args option $opt"
}
}
}
set global_swap_budget_str ""
if { [llength $global_swap_budget_list] > 0 } {
set global_swap_budget_str [join $global_swap_budget_list " "]
}
dpl::configure_global_swap_params_cmd \
$global_swap_passes \
$global_swap_tolerance \
$global_swap_tradeoff \
$global_swap_area_weight \
$global_swap_pin_weight \
$global_swap_user_weight \
$global_swap_sampling \
$global_swap_normalization \
$global_swap_profiling_excess \
$global_swap_budget_str
}

set extra_dpl_enabled 0
if { [info exists keys(-enable_extra_dpl)] } {
set extra_dpl_enabled $keys(-enable_extra_dpl)
} elseif { [info exists ::env(ENABLE_EXTRA_DPL)] } {
set extra_dpl_enabled $::env(ENABLE_EXTRA_DPL)
}
set extra_dpl_enabled [expr { $extra_dpl_enabled ? 1 : 0 }]
dpl::set_extra_dpl_cmd $extra_dpl_enabled

sta::check_argc_eq0 "improve_placement" $args
dpl::improve_placement_cmd $seed $max_displacement_x $max_displacement_y
}
Expand Down
2 changes: 2 additions & 0 deletions src/dpl/src/Optdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ void Opendp::improvePlacement(const int seed,
// A manager to track cells.
DetailedMgr mgr(arch_.get(), network_.get(), grid_.get(), drc_engine_.get());
mgr.setLogger(logger_);
mgr.setGlobalSwapParams(global_swap_params_);
mgr.setExtraDplEnabled(extra_dpl_enabled_);
// Various settings.
mgr.setSeed(seed);
mgr.setMaxDisplacement(max_displacement_x, max_displacement_y);
Expand Down
Loading