@@ -96,7 +96,9 @@ NetCostHandler::NetCostHandler(const t_placer_opts& placer_opts,
96
96
, placer_opts_(placer_opts) {
97
97
const auto & device_ctx = g_vpr_ctx.device ();
98
98
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 ();
100
102
const size_t num_nets = g_vpr_ctx.clustering ().clb_nlist .nets ().size ();
101
103
102
104
is_multi_layer_ = num_layers > 1 ;
@@ -147,25 +149,20 @@ NetCostHandler::NetCostHandler(const t_placer_opts& placer_opts,
147
149
148
150
alloc_and_load_chan_w_factors_for_place_cost_ ();
149
151
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
+ });
169
166
}
170
167
171
168
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)
1426
1423
1427
1424
const t_bb& bb = use_ts ? ts_bb_coord_new_[net_id] : bb_coords_[net_id];
1428
1425
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;
1431
1428
1432
1429
const float threshold = placer_opts_.congestion_chan_util_threshold ;
1433
1430
@@ -1730,6 +1727,11 @@ double NetCostHandler::get_total_wirelength_estimate() const {
1730
1727
1731
1728
double NetCostHandler::estimate_routing_chan_util () {
1732
1729
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 ();
1733
1735
1734
1736
chanx_util_.fill (0 .);
1735
1737
chany_util_.fill (0 .);
@@ -1831,15 +1833,17 @@ double NetCostHandler::estimate_routing_chan_util() {
1831
1833
1832
1834
// For now, congestion modeling in the placement stage is limited to a single die
1833
1835
// 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
+ });
1843
1847
1844
1848
congestion_modeling_started_ = true ;
1845
1849
0 commit comments