Skip to content

Commit 2976317

Browse files
Merge pull request #8434 from osamahammad21/gpl-regions
GPL: use regions instead of power domains
2 parents 208a76f + c932ccf commit 2976317

File tree

3 files changed

+36
-50
lines changed

3 files changed

+36
-50
lines changed

src/gpl/src/initialPlace.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -132,22 +132,22 @@ void InitialPlace::placeInstsCenter()
132132
const auto db_inst = inst->dbInst();
133133
const auto group = db_inst->getGroup();
134134

135-
if (group && group->getType() == odb::dbGroupType::POWER_DOMAIN) {
136-
auto domain_region = group->getRegion();
137-
int domain_x_min = std::numeric_limits<int>::max();
138-
int domain_y_min = std::numeric_limits<int>::max();
139-
int domain_x_max = std::numeric_limits<int>::min();
140-
int domain_y_max = std::numeric_limits<int>::min();
141-
142-
for (auto boundary : domain_region->getBoundaries()) {
143-
domain_x_min = std::min(domain_x_min, boundary->xMin());
144-
domain_y_min = std::min(domain_y_min, boundary->yMin());
145-
domain_x_max = std::max(domain_x_max, boundary->xMax());
146-
domain_y_max = std::max(domain_y_max, boundary->yMax());
135+
if (group && group->getRegion()) {
136+
auto region = group->getRegion();
137+
int region_x_min = std::numeric_limits<int>::max();
138+
int region_y_min = std::numeric_limits<int>::max();
139+
int region_x_max = std::numeric_limits<int>::min();
140+
int region_y_max = std::numeric_limits<int>::min();
141+
142+
for (auto boundary : region->getBoundaries()) {
143+
region_x_min = std::min(region_x_min, boundary->xMin());
144+
region_y_min = std::min(region_y_min, boundary->yMin());
145+
region_x_max = std::max(region_x_max, boundary->xMax());
146+
region_y_max = std::max(region_y_max, boundary->yMax());
147147
}
148148

149-
inst->setCenterLocation(domain_x_max - (domain_x_max - domain_x_min) / 2,
150-
domain_y_max - (domain_y_max - domain_y_min) / 2);
149+
inst->setCenterLocation(region_x_max - (region_x_max - region_x_min) / 2,
150+
region_y_max - (region_y_max - region_y_min) / 2);
151151
++count_region_center;
152152
} else if (pbc_->isSkipIoMode() && db_inst->isPlaced()) {
153153
// It is helpful to pick up the placement from mpl if available,

src/gpl/src/placerBase.cpp

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,6 @@ void PlacerBase::init()
10681068
void PlacerBase::initInstsForUnusableSites()
10691069
{
10701070
dbSet<dbRow> rows = db_->getChip()->getBlock()->getRows();
1071-
dbSet<dbPowerDomain> pds = db_->getChip()->getBlock()->getPowerDomains();
10721071

10731072
int64_t siteCountX = (die_.coreUx() - die_.coreLx()) / siteSizeX_;
10741073
int64_t siteCountY = (die_.coreUy() - die_.coreLy()) / siteSizeY_;
@@ -1161,29 +1160,19 @@ void PlacerBase::initInstsForUnusableSites()
11611160
// In the case of top level power domain i.e no group,
11621161
// mark all other power domains as empty
11631162
if (group_ == nullptr) {
1164-
for (dbPowerDomain* pd : pds) {
1165-
if (pd->getGroup() != nullptr) {
1166-
for (auto boundary : pd->getGroup()->getRegion()->getBoundaries()) {
1167-
Rect rect = boundary->getBox();
1168-
1169-
std::pair<int, int> pairX = getMinMaxIdx(rect.xMin(),
1170-
rect.xMax(),
1171-
die_.coreLx(),
1172-
siteSizeX_,
1173-
0,
1174-
siteCountX);
1175-
1176-
std::pair<int, int> pairY = getMinMaxIdx(rect.yMin(),
1177-
rect.yMax(),
1178-
die_.coreLy(),
1179-
siteSizeY_,
1180-
0,
1181-
siteCountY);
1182-
1183-
for (int i = pairX.first; i < pairX.second; i++) {
1184-
for (int j = pairY.first; j < pairY.second; j++) {
1185-
siteGrid[j * siteCountX + i] = Empty;
1186-
}
1163+
for (auto region : db_->getChip()->getBlock()->getRegions()) {
1164+
for (auto boundary : region->getBoundaries()) {
1165+
Rect rect = boundary->getBox();
1166+
1167+
std::pair<int, int> pairX = getMinMaxIdx(
1168+
rect.xMin(), rect.xMax(), die_.coreLx(), siteSizeX_, 0, siteCountX);
1169+
1170+
std::pair<int, int> pairY = getMinMaxIdx(
1171+
rect.yMin(), rect.yMax(), die_.coreLy(), siteSizeY_, 0, siteCountY);
1172+
1173+
for (int i = pairX.first; i < pairX.second; i++) {
1174+
for (int j = pairY.first; j < pairY.second; j++) {
1175+
siteGrid[j * siteCountX + i] = Empty;
11871176
}
11881177
}
11891178
}

src/gpl/src/replace.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,9 @@ void Replace::doIncrementalPlace(int threads)
112112

113113
pbVec_.push_back(std::make_shared<PlacerBase>(db_, pbc_, log_));
114114

115-
for (auto pd : db_->getChip()->getBlock()->getPowerDomains()) {
116-
if (pd->getGroup()) {
117-
pbVec_.push_back(
118-
std::make_shared<PlacerBase>(db_, pbc_, log_, pd->getGroup()));
115+
for (auto pd : db_->getChip()->getBlock()->getRegions()) {
116+
for (auto group : pd->getGroups()) {
117+
pbVec_.push_back(std::make_shared<PlacerBase>(db_, pbc_, log_, group));
119118
}
120119
}
121120

@@ -191,10 +190,9 @@ void Replace::doInitialPlace(int threads)
191190

192191
pbVec_.push_back(std::make_shared<PlacerBase>(db_, pbc_, log_));
193192

194-
for (auto pd : db_->getChip()->getBlock()->getPowerDomains()) {
195-
if (pd->getGroup()) {
196-
pbVec_.push_back(
197-
std::make_shared<PlacerBase>(db_, pbc_, log_, pd->getGroup()));
193+
for (auto pd : db_->getChip()->getBlock()->getRegions()) {
194+
for (auto group : pd->getGroups()) {
195+
pbVec_.push_back(std::make_shared<PlacerBase>(db_, pbc_, log_, group));
198196
}
199197
}
200198

@@ -244,10 +242,9 @@ bool Replace::initNesterovPlace(int threads)
244242

245243
pbVec_.push_back(std::make_shared<PlacerBase>(db_, pbc_, log_));
246244

247-
for (auto pd : db_->getChip()->getBlock()->getPowerDomains()) {
248-
if (pd->getGroup()) {
249-
pbVec_.push_back(
250-
std::make_shared<PlacerBase>(db_, pbc_, log_, pd->getGroup()));
245+
for (auto pd : db_->getChip()->getBlock()->getRegions()) {
246+
for (auto group : pd->getGroups()) {
247+
pbVec_.push_back(std::make_shared<PlacerBase>(db_, pbc_, log_, group));
251248
}
252249
}
253250

0 commit comments

Comments
 (0)