@@ -278,6 +278,8 @@ static void free_placement_structs(const t_placer_opts& placer_opts, const t_noc
278
278
279
279
static void alloc_and_load_for_fast_cost_update (float place_cost_exp);
280
280
281
+ static void alloc_and_load_for_fast_vertical_cost_update (float place_cost_exp);
282
+
281
283
static void free_fast_cost_update ();
282
284
283
285
static double comp_bb_cost (e_cost_methods method);
@@ -3099,6 +3101,7 @@ static double get_net_cost(ClusterNetId net_id, const t_bb& bbptr) {
3099
3101
3100
3102
double ncost, crossing;
3101
3103
auto & cluster_ctx = g_vpr_ctx.clustering ();
3104
+ const bool is_multi_layer = (g_vpr_ctx.device ().grid .get_num_layers () > 1 );
3102
3105
3103
3106
crossing = wirelength_crossing_count (
3104
3107
cluster_ctx.clb_nlist .net_pins (net_id).size ());
@@ -3902,6 +3905,7 @@ static void alloc_and_load_for_fast_cost_update(float place_cost_exp) {
3902
3905
3903
3906
chanx_place_cost_fac.resize ({device_ctx.grid .height (), device_ctx.grid .height () + 1 });
3904
3907
chany_place_cost_fac.resize ({device_ctx.grid .width (), device_ctx.grid .width () + 1 });
3908
+ chanz_place_cost_fac.resize ({device_ctx.grid .width (), device_ctx.grid .width () + 1 });
3905
3909
3906
3910
/* First compute the number of tracks between channel high and channel *
3907
3911
* low, inclusive, in an efficient manner. */
@@ -3977,6 +3981,73 @@ static void alloc_and_load_for_fast_cost_update(float place_cost_exp) {
3977
3981
(double )chany_place_cost_fac[high][low],
3978
3982
(double )place_cost_exp);
3979
3983
}
3984
+
3985
+ alloc_and_load_for_fast_vertical_cost_update (place_cost_exp);
3986
+
3987
+ }
3988
+
3989
+ static void alloc_and_load_for_fast_vertical_cost_update (float place_cost_exp) {
3990
+ const auto & device_ctx = g_vpr_ctx.device ();
3991
+ const auto & rr_graph = device_ctx.rr_graph ;
3992
+ const int num_tiles = device_ctx.grid .height () * device_ctx.grid .width ();
3993
+ vtr::NdMatrix<float , 3 > tile_num_inter_die_conn ({device_ctx.grid .width (),
3994
+ device_ctx.grid .height (),
3995
+ static_cast <size_t >(device_ctx.grid .get_num_layers ())}, 0 );
3996
+
3997
+ for (const auto & src_rr_node : rr_graph.nodes ()) {
3998
+ for (const auto & rr_edge_idx : rr_graph.configurable_edges (src_rr_node)) {
3999
+ const auto & sink_rr_node = rr_graph.edge_sink_node (src_rr_node, rr_edge_idx);
4000
+ if (rr_graph.node_layer (src_rr_node) != rr_graph.node_layer (sink_rr_node)) {
4001
+ int src_x = rr_graph.node_xhigh (src_rr_node);
4002
+ int src_y = rr_graph.node_yhigh (src_rr_node);
4003
+ VTR_ASSERT (rr_graph.node_xlow (src_rr_node) == src_x && rr_graph.node_ylow (src_rr_node) == src_y);
4004
+
4005
+ int src_layer = rr_graph.node_layer (src_rr_node);
4006
+ tile_num_inter_die_conn[src_x][src_y][src_layer]++;
4007
+ }
4008
+ }
4009
+
4010
+ for (const auto & rr_edge_idx : rr_graph.non_configurable_edges (src_rr_node)) {
4011
+ const auto & sink_rr_node = rr_graph.edge_sink_node (src_rr_node, rr_edge_idx);
4012
+ if (rr_graph.node_layer (src_rr_node) != rr_graph.node_layer (sink_rr_node)) {
4013
+ int src_x = rr_graph.node_xhigh (src_rr_node);
4014
+ VTR_ASSERT (rr_graph.node_xlow (src_rr_node) == src_x && rr_graph.node_xlow (src_rr_node) == src_x);
4015
+ int src_y = rr_graph.node_yhigh (src_rr_node);
4016
+ VTR_ASSERT (rr_graph.node_ylow (src_rr_node) == src_y && rr_graph.node_ylow (src_rr_node) == src_y);
4017
+ int src_layer = rr_graph.node_layer (src_rr_node);
4018
+ tile_num_inter_die_conn[src_x][src_y][src_layer]++;
4019
+ }
4020
+ }
4021
+ }
4022
+
4023
+ chanz_place_cost_fac[0 ][0 ][0 ][0 ][0 ][0 ] = tile_num_inter_die_conn[0 ][0 ][0 ];
4024
+
4025
+ for (int layer_high_num = 1 ; layer_high_num < device_ctx.grid .get_num_layers (); layer_high_num++) {
4026
+ for (int x_high = 1 ; x_high < (int )device_ctx.grid .width (); x_high++) {
4027
+ for (int y_high = 1 ; y_high < (int )device_ctx.grid .height (); y_high++) {
4028
+ for (int layer_low_num = 0 ; layer_low_num < layer_high_num; layer_low_num++) {
4029
+ for (int x_low = 0 ; x_low < x_high; x_low++) {
4030
+ for (int y_low = 0 ; y_low < y_high; y_low++) {
4031
+ int num_inter_die_conn = 0 ;
4032
+ for (int layer_num = layer_low_num; layer_num <= layer_high_num; layer_num++) {
4033
+ for (int x = x_low; x <= x_high; x++) {
4034
+ for (int y = y_low; y <= y_high; y++) {
4035
+ num_inter_die_conn += tile_num_inter_die_conn[x][y][layer_num];
4036
+ }
4037
+ }
4038
+ }
4039
+ chanz_place_cost_fac[layer_high_num][x_high][y_high][layer_low_num][x_low][y_low] =
4040
+ (static_cast <float >(num_inter_die_conn) / num_tiles);
4041
+
4042
+ chanz_place_cost_fac[layer_high_num][x_high][y_high][layer_low_num][x_low][y_low] = pow (
4043
+ (double )chanz_place_cost_fac[layer_high_num][x_high][y_high][layer_low_num][x_low][y_low],
4044
+ (double )place_cost_exp);
4045
+ }
4046
+ }
4047
+ }
4048
+ }
4049
+ }
4050
+ }
3980
4051
}
3981
4052
3982
4053
static void check_place (const t_placer_costs& costs,
0 commit comments