Skip to content

Commit 24d5ad9

Browse files
committed
vpr: place_delay_model: use get_opin_min_delay to return a delay between two locations
1 parent e2b3381 commit 24d5ad9

5 files changed

+35
-22
lines changed

vpr/src/place/place_delay_model.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ float SimpleDelayModel::delay(const t_physical_tile_loc& from_loc, int /*from_pi
164164
int delta_x = std::abs(from_loc.x - to_loc.x);
165165
int delta_y = std::abs(from_loc.y - to_loc.y);
166166

167-
return delays_[from_loc.layer_num][to_loc.layer_num][delta_x][delta_y];
167+
int from_tile_idx = g_vpr_ctx.device().grid.get_physical_type(from_loc)->index;
168+
return delays_[from_tile_idx][from_loc.layer_num][to_loc.layer_num][delta_x][delta_y];
168169
}
169170

170171
/**

vpr/src/place/place_delay_model.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ class SimpleDelayModel : public PlaceDelayModel {
238238
void write(const std::string& /*file*/) const override {}
239239

240240
private:
241-
vtr::NdMatrix<float, 4> delays_; // [0..num_layers-1][0..max_dx][0..max_dy]
241+
vtr::NdMatrix<float, 5> delays_; // [0..num_layers-1][0..max_dx][0..max_dy]
242242
float cross_layer_delay_;
243243
bool is_flat_;
244244
};

vpr/src/place/timing_place_lookup.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static vtr::NdMatrix<float, 3> compute_delta_delay_model(
143143
int longest_length,
144144
bool is_flat);
145145

146-
static vtr::NdMatrix<float, 4> compute_simple_delay_model(RouterDelayProfiler& route_profiler);
146+
static vtr::NdMatrix<float, 5> compute_simple_delay_model(RouterDelayProfiler& route_profiler);
147147

148148
static bool find_direct_connect_sample_locations(const t_direct_inf* direct,
149149
t_physical_tile_type_ptr from_type,
@@ -1016,18 +1016,27 @@ static vtr::NdMatrix<float, 3> compute_delta_delay_model(
10161016
return delta_delays;
10171017
}
10181018

1019-
static vtr::NdMatrix<float, 4> compute_simple_delay_model(RouterDelayProfiler& route_profiler) {
1019+
static vtr::NdMatrix<float, 5> compute_simple_delay_model(RouterDelayProfiler& route_profiler) {
10201020
const auto& grid = g_vpr_ctx.device().grid;
1021-
vtr::NdMatrix<float, 4> delta_delays({static_cast<unsigned long>(grid.get_num_layers()),
1021+
int num_physical_tile_types = static_cast<int>(g_vpr_ctx.device().physical_tile_types.size());
1022+
vtr::NdMatrix<float, 5> delta_delays({static_cast<unsigned long>(num_physical_tile_types),
1023+
static_cast<unsigned long>(grid.get_num_layers()),
10221024
static_cast<unsigned long>(grid.get_num_layers()),
10231025
grid.width(),
10241026
grid.height()});
1025-
for (int from_layer = 0; from_layer < grid.get_num_layers(); ++from_layer) {
1026-
for (int to_layer = 0; to_layer < grid.get_num_layers(); ++to_layer) {
1027-
for (int dx = 0; dx < static_cast<int>(grid.width()); ++dx) {
1028-
for (int dy = 0; dy < static_cast<int>(grid.height()); ++dy) {
1029-
float min_delay = route_profiler.get_min_delay(from_layer, to_layer, dx, dy);
1030-
delta_delays[from_layer][to_layer][dx][dy] = min_delay;
1027+
1028+
for (int physical_tile_type_idx = 0; physical_tile_type_idx < num_physical_tile_types; ++physical_tile_type_idx) {
1029+
for (int from_layer = 0; from_layer < grid.get_num_layers(); ++from_layer) {
1030+
for (int to_layer = 0; to_layer < grid.get_num_layers(); ++to_layer) {
1031+
for (int dx = 0; dx < static_cast<int>(grid.width()); ++dx) {
1032+
for (int dy = 0; dy < static_cast<int>(grid.height()); ++dy) {
1033+
float min_delay = route_profiler.get_min_delay(physical_tile_type_idx,
1034+
from_layer,
1035+
to_layer,
1036+
dx,
1037+
dy);
1038+
delta_delays[physical_tile_type_idx][from_layer][to_layer][dx][dy] = min_delay;
1039+
}
10311040
}
10321041
}
10331042
}

vpr/src/route/router_delay_profiling.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,19 @@ RouterDelayProfiler::RouterDelayProfiler(const Netlist<>& net_list,
2323
is_flat)
2424
, is_flat_(is_flat) {
2525
const auto& grid = g_vpr_ctx.device().grid;
26-
min_delays_.resize({static_cast<unsigned long>(grid.get_num_layers()),
26+
min_delays_.resize({g_vpr_ctx.device().physical_tile_types.size(),
27+
static_cast<unsigned long>(grid.get_num_layers()),
2728
static_cast<unsigned long>(grid.get_num_layers()),
2829
grid.width(),
2930
grid.height()});
30-
for (int from_layer = 0; from_layer < grid.get_num_layers(); ++from_layer) {
31-
for (int to_layer = 0; to_layer < grid.get_num_layers(); ++to_layer) {
32-
for (int dx = 0; dx < static_cast<int>(grid.width()); ++dx) {
33-
for (int dy = 0; dy < static_cast<int>(grid.height()); ++dy) {
34-
float min_delay = lookahead->get_distance_min_delay(from_layer, to_layer, dx, dy);
35-
min_delays_[from_layer][to_layer][dx][dy] = min_delay;
31+
for (int physical_tile_type_idx = 0; physical_tile_type_idx < static_cast<int>(g_vpr_ctx.device().physical_tile_types.size()); ++physical_tile_type_idx) {
32+
for (int from_layer = 0; from_layer < grid.get_num_layers(); ++from_layer) {
33+
for (int to_layer = 0; to_layer < grid.get_num_layers(); ++to_layer) {
34+
for (int dx = 0; dx < static_cast<int>(grid.width()); ++dx) {
35+
for (int dy = 0; dy < static_cast<int>(grid.height()); ++dy) {
36+
float min_delay = lookahead->get_opin_distance_min_delay(physical_tile_type_idx, from_layer, to_layer, dx, dy);
37+
min_delays_[physical_tile_type_idx][from_layer][to_layer][dx][dy] = min_delay;
38+
}
3639
}
3740
}
3841
}
@@ -129,8 +132,8 @@ bool RouterDelayProfiler::calculate_delay(RRNodeId source_node,
129132
return found_path;
130133
}
131134

132-
float RouterDelayProfiler::get_min_delay(int from_layer, int to_layer, int dx, int dy) const {
133-
return min_delays_[from_layer][to_layer][dx][dy];
135+
float RouterDelayProfiler::get_min_delay(int physical_tile_type_idx, int from_layer, int to_layer, int dx, int dy) const {
136+
return min_delays_[physical_tile_type_idx][from_layer][to_layer][dx][dy];
134137
}
135138

136139
//Returns the shortest path delay from src_node to all RR nodes in the RR graph, or NaN if no path exists

vpr/src/route/router_delay_profiling.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ class RouterDelayProfiler {
3131
float* net_delay,
3232
int layer_num);
3333

34-
float get_min_delay(int from_layer, int to_layer, int dx, int dy) const;
34+
float get_min_delay(int physical_tile_type_idx, int from_layer, int to_layer, int dx, int dy) const;
3535

3636
private:
3737
const Netlist<>& net_list_;
3838
RouterStats router_stats_;
3939
ConnectionRouter<BinaryHeap> router_;
40-
vtr::NdMatrix<float, 4> min_delays_;
40+
vtr::NdMatrix<float, 5> min_delays_;
4141
bool is_flat_;
4242
};
4343

0 commit comments

Comments
 (0)