Skip to content

Commit ca4f2d1

Browse files
committed
lookahead_cost: avoid building the segment map
Signed-off-by: Alessandro Comodi <[email protected]>
1 parent fa49e3f commit ca4f2d1

File tree

3 files changed

+7
-25
lines changed

3 files changed

+7
-25
lines changed

vpr/src/route/router_lookahead_cost_map.cpp

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,6 @@ static vtr::Point<T> closest_point_in_rect(const vtr::Rect<T>& r, const vtr::Poi
4646
}
4747
}
4848

49-
// build the segment map
50-
void CostMap::build_segment_map() {
51-
const auto& device_ctx = g_vpr_ctx.device();
52-
segment_map_.resize(device_ctx.rr_nodes.size());
53-
for (size_t i = 0; i < segment_map_.size(); ++i) {
54-
auto& from_node = device_ctx.rr_nodes[i];
55-
56-
int from_cost_index = from_node.cost_index();
57-
int from_seg_index = device_ctx.rr_indexed_data[from_cost_index].seg_index;
58-
59-
segment_map_[i] = from_seg_index;
60-
}
61-
}
62-
6349
// resize internal data structures
6450
void CostMap::set_counts(size_t seg_count) {
6551
cost_map_.clear();
@@ -73,7 +59,12 @@ void CostMap::set_counts(size_t seg_count) {
7359

7460
// cached node -> segment map
7561
int CostMap::node_to_segment(int from_node_ind) const {
76-
return segment_map_[from_node_ind];
62+
const auto& device_ctx = g_vpr_ctx.device();
63+
64+
auto& from_node = device_ctx.rr_nodes[from_node_ind];
65+
66+
int from_cost_index = from_node.cost_index();
67+
return device_ctx.rr_indexed_data[from_cost_index].seg_index;
7768
}
7869

7970
static util::Cost_Entry penalize(const util::Cost_Entry& entry, int distance, float penalty) {
@@ -425,7 +416,6 @@ static void FromFloat(VprFloatEntry::Builder* out, const float& in) {
425416
}
426417

427418
void CostMap::read(const std::string& file) {
428-
build_segment_map();
429419
MmapFile f(file);
430420

431421
::capnp::ReaderOptions opts = default_large_capnp_opts();

vpr/src/route/router_lookahead_cost_map.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,7 @@ class CostMap {
3030
void set_counts(size_t seg_count);
3131

3232
/**
33-
* @brief Builds a node to segments map for a fast lookup
34-
*/
35-
void build_segment_map();
36-
37-
/**
38-
* @brief Queries the segment map to get the segment index given the corresponding node index
33+
* @brief Gets the segment index relative to the input node index
3934
*
4035
* @param from_node_ind index of the node to search in the segment map
4136
* @return The index of the segment corresponding to the input node id
@@ -103,8 +98,6 @@ class CostMap {
10398
///<delta locations that fall outside of a segment's bounding box.
10499
///<The penalty map is addressed as follows penalty_[0][segment_index]
105100

106-
std::vector<int> segment_map_; ///<Segment map to lookup to the segment index given the node index
107-
108101
size_t seg_count_; ///<Total segment count in the architecture
109102

110103
/**

vpr/src/route/router_lookahead_extended_map.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ void ExtendedMapLookahead::compute(const std::vector<t_segment_inf>& segment_inf
394394
/* free previous delay map and allocate new one */
395395
auto& device_ctx = g_vpr_ctx.device();
396396
cost_map_.set_counts(segment_inf.size());
397-
cost_map_.build_segment_map();
398397

399398
VTR_ASSERT(REPRESENTATIVE_ENTRY_METHOD == util::SMALLEST);
400399
util::RoutingCosts all_delay_costs;

0 commit comments

Comments
 (0)