Skip to content

Commit 352a13b

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

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
@@ -1932,6 +1932,16 @@ void Router::timing_driven_expand_neighbours(t_heap* current,
19321932
RREdgeId first_edge = rr_nodes_->first_edge(from_node);
19331933
RREdgeId last_edge = rr_nodes_->last_edge(from_node);
19341934
int num_edges = size_t(last_edge) - size_t(first_edge);
1935+
for (int iconn = 0; iconn < num_edges; iconn++) {
1936+
RREdgeId from_edge(size_t(first_edge) + iconn);
1937+
1938+
RRNodeId to_node = rr_nodes_->edge_sink_node(from_edge);
1939+
rr_nodes_->prefetch_node(to_node);
1940+
1941+
int switch_idx = rr_nodes_->edge_switch(from_edge);
1942+
__builtin_prefetch(&rr_switch_inf_[switch_idx], 0, 0);
1943+
}
1944+
19351945
for (int iconn = 0; iconn < num_edges; iconn++) {
19361946
RREdgeId from_edge(size_t(first_edge) + iconn);
19371947
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)