@@ -255,7 +255,9 @@ static void store_min_cost_to_sinks(std::unordered_map<int, std::unordered_map<i
255
255
* @brief Iterate over the first and second dimension of f_wire_cost_map to get the minimum cost for each dx and dy_
256
256
* @param internal_opin_global_cost_map This map is populated in this function. [dx][dy] -> cost
257
257
*/
258
- static void min_global_cost_map (vtr::NdMatrix<util::Cost_Entry, 4 >& distance_min_cost);
258
+ static void min_chann_global_cost_map (vtr::NdMatrix<util::Cost_Entry, 4 >& distance_min_cost);
259
+
260
+ static void min_opin_distance_cost_map (const util::t_src_opin_delays& src_opin_delays, vtr::NdMatrix<util::Cost_Entry, 5 >& distance_min_cost);
259
261
260
262
/* *
261
263
* @brief Iterate over all of the wire segments accessible from the SOURCE/OPIN (stored in src_opin_delay_map) and return the minimum cost (congestion and delay) across them to the sink
@@ -377,14 +379,14 @@ float MapLookahead::get_expected_cost(RRNodeId current_node, RRNodeId target_nod
377
379
}
378
380
} else {
379
381
// Since we don't know which type of wires are accessible from an OPIN inside the cluster, we use
380
- // distance_based_min_cost to get an estimation of the global cost, and then, add this cost to the tile_min_cost
382
+ // chann_distance_based_min_cost to get an estimation of the global cost, and then, add this cost to the tile_min_cost
381
383
// to have an estimation of the cost of getting into a cluster - We don't have any estimation of the cost to get out of the cluster
382
384
int delta_x, delta_y;
383
385
get_xy_deltas (current_node, target_node, &delta_x, &delta_y);
384
386
delta_x = abs (delta_x);
385
387
delta_y = abs (delta_y);
386
- delay_cost = params.criticality * distance_based_min_cost [rr_graph.node_layer (current_node)][to_layer_num][delta_x][delta_y].delay ;
387
- cong_cost = (1 . - params.criticality ) * distance_based_min_cost [rr_graph.node_layer (current_node)][to_layer_num][delta_x][delta_y].congestion ;
388
+ delay_cost = params.criticality * chann_distance_based_min_cost [rr_graph.node_layer (current_node)][to_layer_num][delta_x][delta_y].delay ;
389
+ cong_cost = (1 . - params.criticality ) * chann_distance_based_min_cost [rr_graph.node_layer (current_node)][to_layer_num][delta_x][delta_y].congestion ;
388
390
389
391
delay_offset_cost = params.criticality * tile_min_cost.at (to_physical_type->index ).at (to_node_ptc_num).delay ;
390
392
cong_offset_cost = (1 . - params.criticality ) * tile_min_cost.at (to_physical_type->index ).at (to_node_ptc_num).congestion ;
@@ -415,8 +417,8 @@ float MapLookahead::get_expected_cost(RRNodeId current_node, RRNodeId target_nod
415
417
get_xy_deltas (current_node, target_node, &delta_x, &delta_y);
416
418
delta_x = abs (delta_x);
417
419
delta_y = abs (delta_y);
418
- delay_cost = params.criticality * distance_based_min_cost [rr_graph.node_layer (current_node)][to_layer_num][delta_x][delta_y].delay ;
419
- cong_cost = (1 . - params.criticality ) * distance_based_min_cost [rr_graph.node_layer (current_node)][to_layer_num][delta_x][delta_y].congestion ;
420
+ delay_cost = params.criticality * chann_distance_based_min_cost [rr_graph.node_layer (current_node)][to_layer_num][delta_x][delta_y].delay ;
421
+ cong_cost = (1 . - params.criticality ) * chann_distance_based_min_cost [rr_graph.node_layer (current_node)][to_layer_num][delta_x][delta_y].congestion ;
420
422
421
423
delay_offset_cost = params.criticality * tile_min_cost.at (to_physical_type->index ).at (to_node_ptc_num).delay ;
422
424
cong_offset_cost = (1 . - params.criticality ) * tile_min_cost.at (to_physical_type->index ).at (to_node_ptc_num).congestion ;
@@ -540,7 +542,8 @@ void MapLookahead::compute(const std::vector<t_segment_inf>& segment_inf) {
540
542
// from the different physical tile type's SOURCEs & OPINs
541
543
this ->src_opin_delays = util::compute_router_src_opin_lookahead (is_flat_);
542
544
543
- min_global_cost_map (distance_based_min_cost);
545
+ min_chann_global_cost_map (chann_distance_based_min_cost);
546
+ min_opin_distance_cost_map (src_opin_delays, opin_distance_based_min_cost);
544
547
}
545
548
546
549
void MapLookahead::compute_intra_tile () {
@@ -581,8 +584,8 @@ void MapLookahead::read_intra_cluster(const std::string& file) {
581
584
inter_tile_pin_primitive_pin_delay);
582
585
}
583
586
584
- // The information about distance_based_min_cost is not stored in the file, thus it needs to be computed
585
- min_global_cost_map (distance_based_min_cost );
587
+ // The information about chann_distance_based_min_cost is not stored in the file, thus it needs to be computed
588
+ min_chann_global_cost_map (chann_distance_based_min_cost );
586
589
}
587
590
588
591
void MapLookahead::write (const std::string& file) const {
@@ -594,8 +597,8 @@ void MapLookahead::write_intra_cluster(const std::string& file) const {
594
597
inter_tile_pin_primitive_pin_delay);
595
598
}
596
599
597
- float MapLookahead::get_distance_min_delay ( int from_layer, int to_layer, int dx, int dy) const {
598
- return distance_based_min_cost [from_layer][to_layer][dx][dy].delay ;
600
+ float MapLookahead::get_opin_distance_min_delay ( int physical_tile_idx, int from_layer, int to_layer, int dx, int dy) const {
601
+ return opin_distance_based_min_cost[physical_tile_idx] [from_layer][to_layer][dx][dy].delay ;
599
602
}
600
603
601
604
/* ******* Function Definitions ********/
@@ -1463,7 +1466,7 @@ static void store_min_cost_to_sinks(std::unordered_map<int, std::unordered_map<i
1463
1466
VTR_ASSERT (insert_res.second );
1464
1467
}
1465
1468
1466
- static void min_global_cost_map (vtr::NdMatrix<util::Cost_Entry, 4 >& distance_min_cost) {
1469
+ static void min_chann_global_cost_map (vtr::NdMatrix<util::Cost_Entry, 4 >& distance_min_cost) {
1467
1470
int num_layers = g_vpr_ctx.device ().grid .get_num_layers ();
1468
1471
int width = (int )g_vpr_ctx.device ().grid .width ();
1469
1472
int height = (int )g_vpr_ctx.device ().grid .height ();
@@ -1494,6 +1497,43 @@ static void min_global_cost_map(vtr::NdMatrix<util::Cost_Entry, 4>& distance_min
1494
1497
}
1495
1498
}
1496
1499
1500
+ static void min_opin_distance_cost_map (const util::t_src_opin_delays& src_opin_delays, vtr::NdMatrix<util::Cost_Entry, 5 >& distance_min_cost) {
1501
+ int num_tile_types = g_vpr_ctx.device ().physical_tile_types .size ();
1502
+ int num_layers = g_vpr_ctx.device ().grid .get_num_layers ();
1503
+ int width = (int )g_vpr_ctx.device ().grid .width ();
1504
+ int height = (int )g_vpr_ctx.device ().grid .height ();
1505
+ distance_min_cost.resize ({static_cast <unsigned long >(num_tile_types),
1506
+ static_cast <unsigned long >(num_layers),
1507
+ static_cast <unsigned long >(num_layers),
1508
+ static_cast <unsigned long >(width),
1509
+ static_cast <unsigned long >(height)});
1510
+
1511
+ for (int tile_type_idx = 0 ; tile_type_idx < num_tile_types; tile_type_idx++) {
1512
+ for (int from_layer_num = 0 ; from_layer_num < num_layers; from_layer_num++) {
1513
+ for (int to_layer_num = 0 ; to_layer_num < num_layers; to_layer_num++) {
1514
+ for (int dx = 0 ; dx < width; dx++) {
1515
+ for (int dy = 0 ; dy < height; dy++) {
1516
+ float expected_delay_cost = std::numeric_limits<float >::infinity ();
1517
+ float expected_cong_cost = std::numeric_limits<float >::infinity ();
1518
+ util::Cost_Entry min_cost (std::numeric_limits<float >::infinity (), std::numeric_limits<float >::infinity ());
1519
+ for (const auto & tile_opin_map : src_opin_delays[from_layer_num][tile_type_idx]) {
1520
+ std::tie (expected_delay_cost, expected_cong_cost) = get_cost_from_src_opin (tile_opin_map,
1521
+ dx,
1522
+ dy,
1523
+ to_layer_num);
1524
+ if (expected_delay_cost < min_cost.delay ) {
1525
+ min_cost.delay = expected_delay_cost;
1526
+ min_cost.congestion = expected_cong_cost;
1527
+ }
1528
+ }
1529
+ distance_min_cost[tile_type_idx][from_layer_num][to_layer_num][dx][dy] = min_cost;
1530
+ }
1531
+ }
1532
+ }
1533
+ }
1534
+ }
1535
+ }
1536
+
1497
1537
static std::pair<float , float > get_cost_from_src_opin (const std::vector<std::map<int , util::t_reachable_wire_inf>>& src_opin_delay_map,
1498
1538
int delta_x,
1499
1539
int delta_y,
0 commit comments