Skip to content

Commit 08d48b0

Browse files
make format
1 parent d78d7e1 commit 08d48b0

File tree

1 file changed

+35
-31
lines changed

1 file changed

+35
-31
lines changed

vpr/src/place/net_cost_handler.cpp

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ NetCostHandler::NetCostHandler(const t_placer_opts& placer_opts,
9696
, placer_opts_(placer_opts) {
9797
const auto& device_ctx = g_vpr_ctx.device();
9898

99-
const int num_layers = device_ctx.grid.get_num_layers();
99+
const size_t grid_width = device_ctx.grid.width();
100+
const size_t grid_height = device_ctx.grid.height();
101+
const size_t num_layers = device_ctx.grid.get_num_layers();
100102
const size_t num_nets = g_vpr_ctx.clustering().clb_nlist.nets().size();
101103

102104
is_multi_layer_ = num_layers > 1;
@@ -147,25 +149,20 @@ NetCostHandler::NetCostHandler(const t_placer_opts& placer_opts,
147149

148150
alloc_and_load_chan_w_factors_for_place_cost_();
149151

150-
chanx_util_ = vtr::NdMatrix<double, 3>({{(size_t)device_ctx.grid.get_num_layers(),
151-
device_ctx.grid.width(),
152-
device_ctx.grid.height()}},
153-
0);
154-
155-
chany_util_ = vtr::NdMatrix<double, 3>({{(size_t)device_ctx.grid.get_num_layers(),
156-
device_ctx.grid.width(),
157-
device_ctx.grid.height()}},
158-
0);
159-
160-
acc_chanx_util_ = vtr::PrefixSum2D<double>(chanx_util_.dim_size(1), chanx_util_.dim_size(2),
161-
[&](size_t x, size_t y) -> double {
162-
return chanx_util_[0][x][y];
163-
}, 0);
164-
165-
acc_chany_util_ = vtr::PrefixSum2D<double>(chany_util_.dim_size(1), chany_util_.dim_size(2),
166-
[&](size_t x, size_t y) -> double {
167-
return chany_util_[0][x][y];
168-
}, 0);
152+
chanx_util_ = vtr::NdMatrix<double, 3>({{num_layers, grid_width, grid_height}}, 0);
153+
chany_util_ = vtr::NdMatrix<double, 3>({{num_layers, grid_width, grid_height}}, 0);
154+
155+
acc_chanx_util_ = vtr::PrefixSum2D<double>(grid_width,
156+
grid_height,
157+
[&](size_t x, size_t y) {
158+
return chanx_util_[0][x][y];
159+
});
160+
161+
acc_chany_util_ = vtr::PrefixSum2D<double>(grid_width,
162+
grid_height,
163+
[&](size_t x, size_t y) {
164+
return chany_util_[0][x][y];
165+
});
169166
}
170167

171168
void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_() {
@@ -1426,8 +1423,8 @@ double NetCostHandler::get_net_cube_cong_cost_(ClusterNetId net_id, bool use_ts)
14261423

14271424
const t_bb& bb = use_ts ? ts_bb_coord_new_[net_id] : bb_coords_[net_id];
14281425

1429-
// int distance_x = bb.xmax - bb.xmin + 1;
1430-
// int distance_y = bb.ymax - bb.ymin + 1;
1426+
// int distance_x = bb.xmax - bb.xmin + 1;
1427+
// int distance_y = bb.ymax - bb.ymin + 1;
14311428

14321429
const float threshold = placer_opts_.congestion_chan_util_threshold;
14331430

@@ -1730,6 +1727,11 @@ double NetCostHandler::get_total_wirelength_estimate() const {
17301727

17311728
double NetCostHandler::estimate_routing_chan_util() {
17321729
const auto& cluster_ctx = g_vpr_ctx.clustering();
1730+
const DeviceContext& device_ctx = g_vpr_ctx.device();
1731+
1732+
const size_t grid_width = device_ctx.grid.width();
1733+
const size_t grid_height = device_ctx.grid.height();
1734+
const size_t num_layers = device_ctx.grid.get_num_layers();
17331735

17341736
chanx_util_.fill(0.);
17351737
chany_util_.fill(0.);
@@ -1831,15 +1833,17 @@ double NetCostHandler::estimate_routing_chan_util() {
18311833

18321834
// For now, congestion modeling in the placement stage is limited to a single die
18331835
// TODO: extend it to multiple dice
1834-
acc_chanx_util_ = vtr::PrefixSum2D<double>(chanx_util_.dim_size(1), chanx_util_.dim_size(2),
1835-
[&](size_t x, size_t y) -> double {
1836-
return chanx_util_[0][x][y];
1837-
}, 0);
1838-
1839-
acc_chany_util_ = vtr::PrefixSum2D<double>(chany_util_.dim_size(1), chany_util_.dim_size(2),
1840-
[&](size_t x, size_t y) -> double {
1841-
return chany_util_[0][x][y];
1842-
}, 0);
1836+
acc_chanx_util_ = vtr::PrefixSum2D<double>(grid_width,
1837+
grid_height,
1838+
[&](size_t x, size_t y) {
1839+
return chanx_util_[0][x][y];
1840+
});
1841+
1842+
acc_chany_util_ = vtr::PrefixSum2D<double>(grid_width,
1843+
grid_height,
1844+
[&](size_t x, size_t y) {
1845+
return chany_util_[0][x][y];
1846+
});
18431847

18441848
congestion_modeling_started_ = true;
18451849

0 commit comments

Comments
 (0)