Skip to content

Commit 0826ad7

Browse files
author
Nathan Shreve
committed
More comments
1 parent ddf34eb commit 0826ad7

12 files changed

+136
-86
lines changed

vpr/src/base/vpr_context.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@
3737
#ifndef NO_SERVER
3838

3939
#include "gateio.h"
40-
# include "lookahead_profiler.h"
4140
#include "taskresolver.h"
4241

42+
# include "lookahead_profiler.h"
43+
4344
class SetupHoldTimingInfo;
4445
class PostClusterDelayCalculator;
4546

vpr/src/route/connection_router.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -924,9 +924,15 @@ void ConnectionRouter<Heap>::add_route_tree_node_to_heap(
924924
tot_cost,
925925
describe_rr_node(device_ctx.rr_graph, device_ctx.grid, device_ctx.rr_indexed_data, inode, is_flat_).c_str());
926926

927-
push_back_node(&heap_, rr_node_route_inf_,
928-
inode, tot_cost, RREdgeId::INVALID(),
929-
backward_path_cost, backward_path_delay, backward_path_congestion, R_upstream);
927+
push_back_node(&heap_,
928+
rr_node_route_inf_,
929+
inode,
930+
tot_cost,
931+
RREdgeId::INVALID(),
932+
backward_path_cost,
933+
backward_path_delay,
934+
backward_path_congestion,
935+
R_upstream);
930936
} else {
931937
float expected_total_cost = compute_node_cost_using_rcv(cost_params, inode, target_node, rt_node.Tdel, 0, R_upstream);
932938

vpr/src/route/connection_router.h

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class ConnectionRouter : public ConnectionRouterInterface {
127127
// Ensure route budgets have been calculated before enabling this
128128
void set_rcv_enabled(bool enable) final;
129129

130+
// Get a const reference to the router's lookahead
130131
const RouterLookahead& get_router_lookahead() const {
131132
return router_lookahead_;
132133
}

vpr/src/route/lookahead_profiler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void LookaheadProfiler::record(int iteration,
1818
const RouterLookahead& router_lookahead,
1919
const ParentNetId& net_id,
2020
const Netlist<>& net_list,
21-
std::vector<RRNodeId> branch_inodes) {
21+
const std::vector<RRNodeId>& branch_inodes) {
2222
auto& device_ctx = g_vpr_ctx.device();
2323
const auto& rr_graph = device_ctx.rr_graph;
2424
auto& route_ctx = g_vpr_ctx.routing();

vpr/src/route/lookahead_profiler.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class LookaheadProfiler {
3838
const RouterLookahead& router_lookahead,
3939
const ParentNetId& net_id,
4040
const Netlist<>& net_list,
41-
std::vector<RRNodeId> branch_inodes);
41+
const std::vector<RRNodeId>& branch_inodes);
4242

4343
private:
4444
///@breif The output filestream.

vpr/src/route/route_common.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -839,9 +839,15 @@ void reserve_locally_used_opins(HeapInterface* heap, float pres_fac, float acc_f
839839

840840
//Add the OPIN to the heap according to it's congestion cost
841841
cost = get_rr_cong_cost(to_node, pres_fac);
842-
add_node_to_heap(heap, route_ctx.rr_node_route_inf,
843-
to_node, cost, RREdgeId::INVALID(),
844-
0., 0., 0., 0.);
842+
add_node_to_heap(heap,
843+
route_ctx.rr_node_route_inf,
844+
to_node,
845+
cost,
846+
RREdgeId::INVALID(),
847+
0.,
848+
0.,
849+
0.,
850+
0.);
845851
}
846852

847853
for (ipin = 0; ipin < num_local_opin; ipin++) {

vpr/src/route/router_delay_profiling.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ bool RouterDelayProfiler::calculate_delay(RRNodeId source_node,
149149
float RouterDelayProfiler::get_min_delay(int physical_tile_type_idx, int from_layer, int to_layer, int dx, int dy) const {
150150
return min_delays_[physical_tile_type_idx][from_layer][to_layer][dx][dy];
151151
}
152+
const Netlist<>& RouterDelayProfiler::get_net_list() const {
153+
return net_list_;
154+
}
152155

153156
//Returns the shortest path delay from src_node to all RR nodes in the RR graph, or NaN if no path exists
154157
vtr::vector<RRNodeId, float> calculate_all_path_delays_from_rr_node(RRNodeId src_rr_node,

vpr/src/route/router_delay_profiling.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ class RouterDelayProfiler {
4343
*/
4444
float get_min_delay(int physical_tile_type_idx, int from_layer, int to_layer, int dx, int dy) const;
4545

46-
const Netlist<>& get_net_list() {
47-
return net_list_;
48-
}
46+
/**
47+
* @brief Get a const reference to the netlist.
48+
*/
49+
const Netlist<>& get_net_list() const;
4950

5051
private:
5152
const Netlist<>& net_list_;

vpr/src/route/router_lookahead.h

+29
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,44 @@ class RouterLookahead {
1515
public:
1616
/**
1717
* @brief Get expected cost from node to target_node.
18+
*
1819
* @attention Either compute or read methods must be invoked before invoking get_expected_cost.
20+
*
1921
* @param node The source node from which the cost to the target node is obtained.
2022
* @param target_node The target node to which the cost is obtained.
2123
* @param params Contain the router parameter such as connection criticality, etc. Used to calculate the cost based on the delay and congestion costs.
2224
* @param R_upstream Upstream resistance to get to the "node".
25+
*
2326
* @return
2427
*/
2528
virtual float get_expected_cost(RRNodeId node, RRNodeId target_node, const t_conn_cost_params& params, float R_upstream) const = 0;
29+
30+
/**
31+
* @brief Get expected (delay, congestion) from node to target_node.
32+
*
33+
* @attention Either compute or read methods must be invoked before invoking get_expected_delay_and_cong.
34+
*
35+
* @param node The source node from which the cost to the target node is obtained.
36+
* @param target_node The target node to which the cost is obtained.
37+
* @param params Contain the router parameter such as connection criticality, etc.
38+
* @param R_upstream Upstream resistance to get to the "node".
39+
*
40+
* @return (delay, congestion)
41+
*
42+
* @warning (delay, congestion) are NOT multiplied by (params.criticality, 1. - params.criticality), respectively.
43+
* scale_delay_and_cong_by_criticality should be called after this function before adding these to calculate the
44+
* expected total cost.
45+
*/
2646
virtual std::pair<float, float> get_expected_delay_and_cong(RRNodeId node, RRNodeId target_node, const t_conn_cost_params& params, float R_upstream) const = 0;
47+
48+
/**
49+
* @brief Multiply delay by params.criticality and cong by (1. - params.criticality). Used in conjunction with
50+
* get_expected_delay_and_cong to calculate the total expected cost.
51+
*
52+
* @param delay
53+
* @param cong
54+
* @param params
55+
*/
2756
void scale_delay_and_cong_by_criticality(float& delay, float& cong, const t_conn_cost_params& params) const;
2857

2958
/**

vpr/src/route/router_lookahead_compressed_map.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,10 @@ float CompressedMapLookahead::get_expected_cost(RRNodeId current_node, RRNodeId
422422
}
423423
}
424424

425-
std::pair<float, float> CompressedMapLookahead::get_expected_delay_and_cong(RRNodeId from_node, RRNodeId to_node, const t_conn_cost_params& /*params*/, float) const {
425+
std::pair<float, float> CompressedMapLookahead::get_expected_delay_and_cong(RRNodeId from_node,
426+
RRNodeId to_node,
427+
const t_conn_cost_params& /*params*/,
428+
float /*R_upstream*/) const {
426429
auto& device_ctx = g_vpr_ctx.device();
427430
auto& rr_graph = device_ctx.rr_graph;
428431

0 commit comments

Comments
 (0)