@@ -155,7 +155,7 @@ NetCostHandler::NetCostHandler(const t_placer_opts& placer_opts,
155155}
156156
157157void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_ () {
158- float place_cost_exp = placer_opts_.place_cost_exp ;
158+ const double place_cost_exp = static_cast < double >( placer_opts_.place_cost_exp ) ;
159159 auto & device_ctx = g_vpr_ctx.device ();
160160
161161 const int grid_height = device_ctx.grid .height ();
@@ -197,7 +197,7 @@ void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_() {
197197 }
198198
199199 chanx_place_cost_fac_[high][low] = (high - low + 1 .) / chanx_place_cost_fac_[high][low];
200- chanx_place_cost_fac_[high][low] = pow ((double )chanx_place_cost_fac_[high][low], ( double ) place_cost_exp);
200+ chanx_place_cost_fac_[high][low] = pow ((double )chanx_place_cost_fac_[high][low], place_cost_exp);
201201 }
202202 }
203203
@@ -227,7 +227,7 @@ void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_() {
227227 }
228228
229229 chany_place_cost_fac_[high][low] = (high - low + 1 .) / chany_place_cost_fac_[high][low];
230- chany_place_cost_fac_[high][low] = pow ((double )chany_place_cost_fac_[high][low], ( double ) place_cost_exp);
230+ chany_place_cost_fac_[high][low] = pow ((double )chany_place_cost_fac_[high][low], place_cost_exp);
231231 }
232232 }
233233
@@ -268,22 +268,27 @@ void NetCostHandler::alloc_and_load_for_fast_vertical_cost_update_() {
268268 * the block on the lower left connection of the block is added twice, that part needs to be removed.
269269 */
270270 for (const auto & src_rr_node : rr_graph.nodes ()) {
271- for (auto edge_range: {rr_graph.configurable_edges (src_rr_node), rr_graph.non_configurable_edges (src_rr_node)}) {
272- for (const auto & rr_edge_idx : edge_range) {
273- const auto & sink_rr_node = rr_graph.edge_sink_node (src_rr_node, rr_edge_idx);
274- if (rr_graph.node_layer (src_rr_node) != rr_graph.node_layer (sink_rr_node)) {
275- // We assume that the nodes driving the inter-layer connection or being driven by it
276- // are not stretched across multiple tiles
277- int src_x = rr_graph.node_xhigh (src_rr_node);
278- int src_y = rr_graph.node_yhigh (src_rr_node);
279- VTR_ASSERT (rr_graph.node_xlow (src_rr_node) == src_x && rr_graph.node_ylow (src_rr_node) == src_y);
280-
281- tile_num_inter_die_conn[src_x][src_y]++;
282- }
271+ for (const auto & rr_edge_idx : rr_graph.edges (src_rr_node)) {
272+ const auto & sink_rr_node = rr_graph.edge_sink_node (src_rr_node, rr_edge_idx);
273+ if (rr_graph.node_layer (src_rr_node) != rr_graph.node_layer (sink_rr_node)) {
274+ // We assume that the nodes driving the inter-layer connection or being driven by it
275+ // are not stretched across multiple tiles
276+ int src_x = rr_graph.node_xhigh (src_rr_node);
277+ int src_y = rr_graph.node_yhigh (src_rr_node);
278+ VTR_ASSERT (rr_graph.node_xlow (src_rr_node) == src_x && rr_graph.node_ylow (src_rr_node) == src_y);
279+
280+ tile_num_inter_die_conn[src_x][src_y]++;
283281 }
284282 }
285283 }
286284
285+ int num_layers = device_ctx.grid .get_num_layers ();
286+ for (size_t x = 0 ; x < device_ctx.grid .width (); x++) {
287+ for (size_t y = 0 ; y < device_ctx.grid .height (); y++) {
288+ tile_num_inter_die_conn[x][y] /= (num_layers-1 );
289+ }
290+ }
291+
287292 // Step 2: Calculate prefix sum of the inter-die connectivity up to and including the channel at (x, y).
288293 acc_tile_num_inter_die_conn_[0 ][0 ] = tile_num_inter_die_conn[0 ][0 ];
289294 // Initialize the first row and column
0 commit comments