Skip to content

Commit d194bec

Browse files
committed
Implement a simple prefetch loop.
Signed-off-by: Keith Rothman <[email protected]>
1 parent ad9ece7 commit d194bec

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

vpr/src/route/route_timing.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,6 +1960,16 @@ void Router::timing_driven_expand_neighbours(t_heap* current,
19601960
RREdgeId first_edge = rr_nodes_->first_edge(from_node);
19611961
RREdgeId last_edge = rr_nodes_->last_edge(from_node);
19621962
int num_edges = size_t(last_edge) - size_t(first_edge);
1963+
for (int iconn = 0; iconn < num_edges; iconn++) {
1964+
RREdgeId from_edge(size_t(first_edge) + iconn);
1965+
1966+
RRNodeId to_node = rr_nodes_->edge_sink_node(from_edge);
1967+
rr_nodes_->prefetch_node(to_node);
1968+
1969+
int switch_idx = rr_nodes_->edge_switch(from_edge);
1970+
__builtin_prefetch(&rr_switch_inf_[switch_idx], 0, 0);
1971+
}
1972+
19631973
for (int iconn = 0; iconn < num_edges; iconn++) {
19641974
RREdgeId from_edge(size_t(first_edge) + iconn);
19651975
RRNodeId to_node = rr_nodes_->edge_sink_node(from_edge);

vpr/src/route/route_timing.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ class Router {
6464
}
6565
}
6666

67-
void update_cheapest(t_heap* cheapest) {
67+
inline void update_cheapest(t_heap* cheapest) {
6868
update_cheapest(cheapest, &rr_node_route_inf_[cheapest->index]);
6969
}
7070

71-
void update_cheapest(t_heap* cheapest, t_rr_node_route_inf* route_inf) {
71+
inline void update_cheapest(t_heap* cheapest, t_rr_node_route_inf* route_inf) {
7272
//Record final link to target
7373
add_to_mod_list(cheapest->index);
7474

vpr/src/route/rr_graph_storage.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ class t_rr_graph_storage {
216216
short node_track_num(RRNodeId id) const; //Same as ptc_num() but checks that type() is consistent
217217
short node_class_num(RRNodeId id) const; //Same as ptc_num() but checks that type() is consistent
218218

219+
inline void prefetch_node(RRNodeId id) const {
220+
__builtin_prefetch(&storage_[id], 0, 0);
221+
}
222+
219223
/****************
220224
* Edge methods *
221225
****************/

0 commit comments

Comments
 (0)