Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mpl2: IOs abstraction adaptation to ORFS flow - first version (simplified) #5809

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
48ed28a
mpl2: add cluster data to HardMacro
AcKoucher Sep 9, 2024
662f9e8
mpl2:
AcKoucher Sep 10, 2024
1523d90
mpl2: group IOs based on constraints
AcKoucher Sep 11, 2024
2b34453
mpl2:
AcKoucher Sep 12, 2024
f2daf82
mpl2: support to identify io cluster through soft macro
AcKoucher Sep 12, 2024
daf4647
mpl2: add support to identify if a fixed terminal is an IO during Har…
AcKoucher Sep 12, 2024
a3a614a
mpl2: getter for constraint boundary
AcKoucher Sep 12, 2024
2f6cbfc
mpl2: add constraint boundary dist to WL computation in SA
AcKoucher Sep 12, 2024
8cc4c0f
mpl2: begin debug support for new io clusters
AcKoucher Sep 13, 2024
cf50ff2
mpl2: comment problem
AcKoucher Sep 13, 2024
bb4b51b
mpl2: fix constraints' dist computation
AcKoucher Sep 16, 2024
cea8774
mpl2: add to do's
AcKoucher Sep 16, 2024
eb5e331
mpl2:
AcKoucher Sep 17, 2024
c290301
mpl2: consider net weight when computing min dist to closest edge
AcKoucher Sep 17, 2024
b9f124e
mpl2: remove comment
AcKoucher Sep 17, 2024
69b3212
mpl2: renaming
AcKoucher Sep 17, 2024
a4ffc66
mpl2: make tree data accessible inside core
AcKoucher Sep 18, 2024
749318d
Merge branch 'master' into mpl2-constraints
AcKoucher Sep 19, 2024
da791bc
mpl2: set blocked boundaries based on ppl -exclude argument data
AcKoucher Sep 19, 2024
9a9cfe4
mpl2: fix max penalty based on die hpwl and use it when the constrain…
AcKoucher Sep 19, 2024
e7ef68b
mpl2: incorporate blocked boundaries data for when an IO is constrain…
AcKoucher Sep 20, 2024
29b2c57
mpl2: push IOs to constraint boundary even if it that boundary is blo…
AcKoucher Sep 20, 2024
5ef8868
mpl2: don't draw connection when the NONE closest boundary is blocked
AcKoucher Sep 20, 2024
37b10a0
mpl2: adapt io clusters' blockages to be shaped according to std cell…
AcKoucher Sep 20, 2024
fcc3fb9
mpl2: use both -exclude and constraint regions to compute pin access …
AcKoucher Sep 23, 2024
531aef9
Merge branch 'master' into mpl2-constraints
AcKoucher Sep 23, 2024
e061b57
mpl2: remove duplicated overkill function
AcKoucher Sep 23, 2024
f13cbe4
mpl2: use references
AcKoucher Sep 23, 2024
de728b6
mpl2: add indication when boundary is block in debug mode
AcKoucher Sep 23, 2024
d995e90
mpl2: remove bundledIO related things / clean up
AcKoucher Sep 23, 2024
6fe6636
mpl2: use constraint region instead of pin location in orient improve…
AcKoucher Sep 25, 2024
d5281b8
mpl2: clean TO DOs and adjust tree log
AcKoucher Sep 25, 2024
ede06cd
mpl2: address clang-tidy and format
AcKoucher Sep 26, 2024
8543487
mpl2: improve name and avoid clusters to be pushed toward blocked bou…
AcKoucher Sep 27, 2024
baf2d13
mpl2: separate logical operations with parenthesis (clang-tidy)
AcKoucher Sep 27, 2024
fa767e1
mpl2: add regression test && avoid zero depth blockages when root has…
AcKoucher Oct 1, 2024
bfb55b3
Merge branch 'master' into mpl2-constraints
AcKoucher Oct 11, 2024
1204f57
mpl2: ensure that io clusters data is visible for levels deeper than …
AcKoucher Oct 11, 2024
e145106
mpl2: add test for blocked boundaries' pin access
AcKoucher Oct 11, 2024
8501638
mpl2: make io clusters fixed terminals data visible inside HardSA
AcKoucher Oct 14, 2024
a4a5841
mpl2: clusters connected to an IO cluster of a specific edge will be …
AcKoucher Oct 15, 2024
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: 0 additions & 2 deletions src/mpl2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ rtl_macro_placer
[-tolerance tolerance]
[-max_num_level max_num_level]
[-coarsening_ratio coarsening_ratio]
[-num_bundled_ios num_bundled_ios]
[-large_net_threshold large_net_threshold]
[-signature_net_threshold signature_net_threshold]
[-halo_width halo_width]
Expand Down Expand Up @@ -61,7 +60,6 @@ rtl_macro_placer
| `-tolerance` | Add a margin to the minimum and maximum number of macros/std cells in a cluster. For min, we multiply by (1 - `tol`), and for the max (1 + `tol`). This is to improve the robustness of hierarchical clustering. The allowed values are floats `[0, 1)`, and the default value is `0.1`. |
| `-max_num_level` | Maximum depth of physical hierarchical tree. The default value is `2`, and the allowed values are integers `[0, MAX_INT]`. |
| `-coarsening_ratio` | The larger the coarsening_ratio, the faster the convergence process. The allowed values are floats, and the default value is `10.0`. |
| `-num_bundled_ios` | Specifies the number of bundled pins for the left, right, top, and bottom boundaries. The default value is `3`, and the allowed values are integers `[0, MAX_INT]`. |
| `-large_net_threshold` | Ignore nets with many connections during clustering, such as global nets. The default value is `50`, and the allowed values are integers `[0, MAX_INT]`. |
| `-signature_net_threshold` | Minimum number of connections between two clusters to be identified as connected. The default value is `50`, and the allowed values are integers `[0, MAX_INT]`. |
| `-halo_width` | Horizontal/vertical halo around macros (microns). The allowed values are floats, and the default value is `0.0`. |
Expand Down
1 change: 0 additions & 1 deletion src/mpl2/include/mpl2/rtl_mp.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class MacroPlacer2
float tolerance,
int max_num_level,
float coarsening_ratio,
int num_bundled_ios,
int large_net_threshold,
int signature_net_threshold,
float halo_width,
Expand Down
3 changes: 2 additions & 1 deletion src/mpl2/src/Mpl2Observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <optional>
#include <vector>

#include "clusterEngine.h"
#include "object.h"
#include "odb/geom.h"
#include "utl/Logger.h"
Expand All @@ -61,7 +62,7 @@ class Mpl2Observer
virtual void endSA() {}
virtual void drawResult() {}

virtual void finishedClustering(Cluster* root) {}
virtual void finishedClustering(PhysicalHierarchy* tree) {}

virtual void setMaxLevel(int max_level) {}
virtual void setMacroBlockages(const std::vector<mpl2::Rect>& macro_blockages)
Expand Down
4 changes: 3 additions & 1 deletion src/mpl2/src/SACoreHardMacro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ using utl::MPL;
// Class SACoreHardMacro
// constructors
SACoreHardMacro::SACoreHardMacro(
PhysicalHierarchy* tree,
const Rect& outline,
const std::vector<HardMacro>& macros,
// weight for different penalty
Expand All @@ -64,7 +65,8 @@ SACoreHardMacro::SACoreHardMacro(
unsigned seed,
Mpl2Observer* graphics,
utl::Logger* logger)
: SimulatedAnnealingCore<HardMacro>(outline,
: SimulatedAnnealingCore<HardMacro>(tree,
outline,
macros,
area_weight,
outline_weight,
Expand Down
3 changes: 2 additions & 1 deletion src/mpl2/src/SACoreHardMacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ namespace mpl2 {
class SACoreHardMacro : public SimulatedAnnealingCore<HardMacro>
{
public:
SACoreHardMacro(const Rect& outline,
SACoreHardMacro(PhysicalHierarchy* tree,
const Rect& outline,
const std::vector<HardMacro>& macros,
// weight for different penalty
float area_weight,
Expand Down
7 changes: 4 additions & 3 deletions src/mpl2/src/SACoreSoftMacro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ using utl::MPL;
// Class SACoreSoftMacro
// constructors
SACoreSoftMacro::SACoreSoftMacro(
Cluster* root,
PhysicalHierarchy* tree,
const Rect& outline,
const std::vector<SoftMacro>& macros,
// weight for different penalty
Expand Down Expand Up @@ -71,7 +71,8 @@ SACoreSoftMacro::SACoreSoftMacro(
unsigned seed,
Mpl2Observer* graphics,
utl::Logger* logger)
: SimulatedAnnealingCore<SoftMacro>(outline,
: SimulatedAnnealingCore<SoftMacro>(tree,
outline,
macros,
area_weight,
outline_weight,
Expand All @@ -88,7 +89,7 @@ SACoreSoftMacro::SACoreSoftMacro(
seed,
graphics,
logger),
root_(root)
root_(tree->root.get())
{
boundary_weight_ = boundary_weight;
macro_blockage_weight_ = macro_blockage_weight;
Expand Down
2 changes: 1 addition & 1 deletion src/mpl2/src/SACoreSoftMacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Graphics;
class SACoreSoftMacro : public SimulatedAnnealingCore<SoftMacro>
{
public:
SACoreSoftMacro(Cluster* root,
SACoreSoftMacro(PhysicalHierarchy* tree,
const Rect& outline,
const std::vector<SoftMacro>& macros,
// weight for different penalty
Expand Down
106 changes: 101 additions & 5 deletions src/mpl2/src/SimulatedAnnealingCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ using std::string;
// Class SimulatedAnnealingCore
template <class T>
SimulatedAnnealingCore<T>::SimulatedAnnealingCore(
PhysicalHierarchy* tree,
const Rect& outline, // boundary constraints
const std::vector<T>& macros, // macros (T = HardMacro or T = SoftMacro)
// weight for different penalty
Expand All @@ -68,7 +69,9 @@ SimulatedAnnealingCore<T>::SimulatedAnnealingCore(
unsigned seed,
Mpl2Observer* graphics,
utl::Logger* logger)
: outline_(outline), graphics_(graphics)
: outline_(outline),
blocked_boundaries_(tree->blocked_boundaries),
graphics_(graphics)
{
area_weight_ = area_weight;
outline_weight_ = outline_weight;
Expand All @@ -95,6 +98,26 @@ SimulatedAnnealingCore<T>::SimulatedAnnealingCore(
macros_ = macros;
}

template <class T>
void SimulatedAnnealingCore<T>::setBlockedBoundariesForIOs()
{
if (blocked_boundaries_.find(Boundary::L) != blocked_boundaries_.end()) {
left_is_blocked_ = true;
}

if (blocked_boundaries_.find(Boundary::R) != blocked_boundaries_.end()) {
right_is_blocked_ = true;
}

if (blocked_boundaries_.find(Boundary::B) != blocked_boundaries_.end()) {
bottom_is_blocked_ = true;
}

if (blocked_boundaries_.find(Boundary::T) != blocked_boundaries_.end()) {
top_is_blocked_ = true;
}
}

template <class T>
void SimulatedAnnealingCore<T>::initSequencePair()
{
Expand Down Expand Up @@ -272,10 +295,18 @@ void SimulatedAnnealingCore<T>::calWirelength()
}

for (const auto& net : nets_) {
const float x1 = macros_[net.terminals.first].getPinX();
const float y1 = macros_[net.terminals.first].getPinY();
const float x2 = macros_[net.terminals.second].getPinX();
const float y2 = macros_[net.terminals.second].getPinY();
T& source = macros_[net.terminals.first];
T& target = macros_[net.terminals.second];

if (target.isIOCluster()) {
AcKoucher marked this conversation as resolved.
Show resolved Hide resolved
addBoundaryDistToWirelength(source, target, net.weight);
continue;
}

const float x1 = source.getPinX();
const float y1 = source.getPinY();
const float x2 = target.getPinX();
const float y2 = target.getPinY();
wirelength_ += net.weight * (std::abs(x2 - x1) + std::abs(y2 - y1));
}

Expand All @@ -288,6 +319,71 @@ void SimulatedAnnealingCore<T>::calWirelength()
}
}

template <class T>
void SimulatedAnnealingCore<T>::addBoundaryDistToWirelength(
const T& macro,
const T& io,
const float net_weight)
{
Cluster* io_cluster = io.getCluster();
const Rect die = io_cluster->getBBox();
const float die_hpwl = die.getWidth() + die.getHeight();

if (isOutsideTheOutline(macro)) {
wirelength_ += net_weight * die_hpwl;
return;
}

const float x1 = macro.getPinX();
const float y1 = macro.getPinY();

Boundary constraint_boundary = io_cluster->getConstraintBoundary();

if (constraint_boundary == NONE) {
float dist_to_left = die_hpwl;
if (!left_is_blocked_) {
dist_to_left = std::abs(x1 - die.xMin());
}

float dist_to_right = die_hpwl;
if (!right_is_blocked_) {
dist_to_right = std::abs(x1 - die.xMax());
}

float dist_to_bottom = die_hpwl;
if (!bottom_is_blocked_) {
dist_to_right = std::abs(y1 - die.yMin());
}

float dist_to_top = die_hpwl;
if (!top_is_blocked_) {
dist_to_top = std::abs(y1 - die.yMax());
}

wirelength_
+= net_weight
* std::min(
{dist_to_left, dist_to_right, dist_to_bottom, dist_to_top});
} else if (constraint_boundary == Boundary::L && !left_is_blocked_
AcKoucher marked this conversation as resolved.
Show resolved Hide resolved
|| constraint_boundary == Boundary::R && !right_is_blocked_) {
AcKoucher marked this conversation as resolved.
Show resolved Hide resolved
const float x2 = io.getPinX();
wirelength_ += net_weight * std::abs(x2 - x1);
} else if (constraint_boundary == Boundary::T && !top_is_blocked_
AcKoucher marked this conversation as resolved.
Show resolved Hide resolved
|| constraint_boundary == Boundary::B && !bottom_is_blocked_) {
AcKoucher marked this conversation as resolved.
Show resolved Hide resolved
const float y2 = io.getPinY();
wirelength_ += net_weight * std::abs(y2 - y1);
}
}

// We consider the macro outside the outline based on the location of
// the pin to avoid too many checks.
template <class T>
bool SimulatedAnnealingCore<T>::isOutsideTheOutline(const T& macro) const
{
return macro.getPinX() > outline_.getWidth()
|| macro.getPinY() > outline_.getHeight();
}

template <class T>
void SimulatedAnnealingCore<T>::calFencePenalty()
{
Expand Down
17 changes: 17 additions & 0 deletions src/mpl2/src/SimulatedAnnealingCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <vector>

#include "Mpl2Observer.h"
#include "clusterEngine.h"

namespace utl {
class Logger;
Expand Down Expand Up @@ -68,6 +69,7 @@ class SimulatedAnnealingCore
{
public:
SimulatedAnnealingCore(
PhysicalHierarchy* tree,
const Rect& outline, // boundary constraints
const std::vector<T>& macros, // macros (T = HardMacro or T = SoftMacro)
// weight for different penalty
Expand All @@ -89,6 +91,7 @@ class SimulatedAnnealingCore
Mpl2Observer* graphics,
utl::Logger* logger);

void setBlockedBoundariesForIOs();
void setNumberOfMacrosToPlace(int macros_to_place)
{
macros_to_place_ = macros_to_place;
Expand Down Expand Up @@ -137,6 +140,10 @@ class SimulatedAnnealingCore
virtual void calPenalty() = 0;
void calOutlinePenalty();
void calWirelength();
void addBoundaryDistToWirelength(const T& macro,
const T& io,
float net_weight);
bool isOutsideTheOutline(const T& macro) const;
void calGuidancePenalty();
void calFencePenalty();

Expand All @@ -161,6 +168,9 @@ class SimulatedAnnealingCore
// boundary constraints
Rect outline_;

// Boundaries blocked for IO pins
std::set<Boundary> blocked_boundaries_;

// Number of macros that will actually be part of the sequence pair
int macros_to_place_ = 0;

Expand Down Expand Up @@ -245,6 +255,13 @@ class SimulatedAnnealingCore
bool has_initial_sequence_pair_ = false;
bool centralization_on_ = false;
bool centralization_was_reverted_ = false;

// Blocked boundaries data is kept in bools to avoid overhead
// during SA steps.
bool left_is_blocked_ = false;
bool right_is_blocked_ = false;
bool bottom_is_blocked_ = false;
bool top_is_blocked_ = false;
};

// SACore wrapper function
Expand Down
Loading
Loading