Skip to content

Commit

Permalink
More comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Shreve committed Aug 12, 2024
1 parent ddf34eb commit 0826ad7
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 86 deletions.
3 changes: 2 additions & 1 deletion vpr/src/base/vpr_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
#ifndef NO_SERVER

#include "gateio.h"
# include "lookahead_profiler.h"
#include "taskresolver.h"

# include "lookahead_profiler.h"

class SetupHoldTimingInfo;
class PostClusterDelayCalculator;

Expand Down
12 changes: 9 additions & 3 deletions vpr/src/route/connection_router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,9 +924,15 @@ void ConnectionRouter<Heap>::add_route_tree_node_to_heap(
tot_cost,
describe_rr_node(device_ctx.rr_graph, device_ctx.grid, device_ctx.rr_indexed_data, inode, is_flat_).c_str());

push_back_node(&heap_, rr_node_route_inf_,
inode, tot_cost, RREdgeId::INVALID(),
backward_path_cost, backward_path_delay, backward_path_congestion, R_upstream);
push_back_node(&heap_,
rr_node_route_inf_,
inode,
tot_cost,
RREdgeId::INVALID(),
backward_path_cost,
backward_path_delay,
backward_path_congestion,
R_upstream);
} else {
float expected_total_cost = compute_node_cost_using_rcv(cost_params, inode, target_node, rt_node.Tdel, 0, R_upstream);

Expand Down
1 change: 1 addition & 0 deletions vpr/src/route/connection_router.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class ConnectionRouter : public ConnectionRouterInterface {
// Ensure route budgets have been calculated before enabling this
void set_rcv_enabled(bool enable) final;

// Get a const reference to the router's lookahead
const RouterLookahead& get_router_lookahead() const {
return router_lookahead_;
}
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/route/lookahead_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void LookaheadProfiler::record(int iteration,
const RouterLookahead& router_lookahead,
const ParentNetId& net_id,
const Netlist<>& net_list,
std::vector<RRNodeId> branch_inodes) {
const std::vector<RRNodeId>& branch_inodes) {
auto& device_ctx = g_vpr_ctx.device();
const auto& rr_graph = device_ctx.rr_graph;
auto& route_ctx = g_vpr_ctx.routing();
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/route/lookahead_profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class LookaheadProfiler {
const RouterLookahead& router_lookahead,
const ParentNetId& net_id,
const Netlist<>& net_list,
std::vector<RRNodeId> branch_inodes);
const std::vector<RRNodeId>& branch_inodes);

private:
///@breif The output filestream.
Expand Down
12 changes: 9 additions & 3 deletions vpr/src/route/route_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,15 @@ void reserve_locally_used_opins(HeapInterface* heap, float pres_fac, float acc_f

//Add the OPIN to the heap according to it's congestion cost
cost = get_rr_cong_cost(to_node, pres_fac);
add_node_to_heap(heap, route_ctx.rr_node_route_inf,
to_node, cost, RREdgeId::INVALID(),
0., 0., 0., 0.);
add_node_to_heap(heap,
route_ctx.rr_node_route_inf,
to_node,
cost,
RREdgeId::INVALID(),
0.,
0.,
0.,
0.);
}

for (ipin = 0; ipin < num_local_opin; ipin++) {
Expand Down
3 changes: 3 additions & 0 deletions vpr/src/route/router_delay_profiling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ bool RouterDelayProfiler::calculate_delay(RRNodeId source_node,
float RouterDelayProfiler::get_min_delay(int physical_tile_type_idx, int from_layer, int to_layer, int dx, int dy) const {
return min_delays_[physical_tile_type_idx][from_layer][to_layer][dx][dy];
}
const Netlist<>& RouterDelayProfiler::get_net_list() const {
return net_list_;
}

//Returns the shortest path delay from src_node to all RR nodes in the RR graph, or NaN if no path exists
vtr::vector<RRNodeId, float> calculate_all_path_delays_from_rr_node(RRNodeId src_rr_node,
Expand Down
7 changes: 4 additions & 3 deletions vpr/src/route/router_delay_profiling.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ class RouterDelayProfiler {
*/
float get_min_delay(int physical_tile_type_idx, int from_layer, int to_layer, int dx, int dy) const;

const Netlist<>& get_net_list() {
return net_list_;
}
/**
* @brief Get a const reference to the netlist.
*/
const Netlist<>& get_net_list() const;

private:
const Netlist<>& net_list_;
Expand Down
29 changes: 29 additions & 0 deletions vpr/src/route/router_lookahead.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,44 @@ class RouterLookahead {
public:
/**
* @brief Get expected cost from node to target_node.
*
* @attention Either compute or read methods must be invoked before invoking get_expected_cost.
*
* @param node The source node from which the cost to the target node is obtained.
* @param target_node The target node to which the cost is obtained.
* @param params Contain the router parameter such as connection criticality, etc. Used to calculate the cost based on the delay and congestion costs.
* @param R_upstream Upstream resistance to get to the "node".
*
* @return
*/
virtual float get_expected_cost(RRNodeId node, RRNodeId target_node, const t_conn_cost_params& params, float R_upstream) const = 0;

/**
* @brief Get expected (delay, congestion) from node to target_node.
*
* @attention Either compute or read methods must be invoked before invoking get_expected_delay_and_cong.
*
* @param node The source node from which the cost to the target node is obtained.
* @param target_node The target node to which the cost is obtained.
* @param params Contain the router parameter such as connection criticality, etc.
* @param R_upstream Upstream resistance to get to the "node".
*
* @return (delay, congestion)
*
* @warning (delay, congestion) are NOT multiplied by (params.criticality, 1. - params.criticality), respectively.
* scale_delay_and_cong_by_criticality should be called after this function before adding these to calculate the
* expected total cost.
*/
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;

/**
* @brief Multiply delay by params.criticality and cong by (1. - params.criticality). Used in conjunction with
* get_expected_delay_and_cong to calculate the total expected cost.
*
* @param delay
* @param cong
* @param params
*/
void scale_delay_and_cong_by_criticality(float& delay, float& cong, const t_conn_cost_params& params) const;

/**
Expand Down
5 changes: 4 additions & 1 deletion vpr/src/route/router_lookahead_compressed_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,10 @@ float CompressedMapLookahead::get_expected_cost(RRNodeId current_node, RRNodeId
}
}

std::pair<float, float> CompressedMapLookahead::get_expected_delay_and_cong(RRNodeId from_node, RRNodeId to_node, const t_conn_cost_params& /*params*/, float) const {
std::pair<float, float> CompressedMapLookahead::get_expected_delay_and_cong(RRNodeId from_node,
RRNodeId to_node,
const t_conn_cost_params& /*params*/,
float /*R_upstream*/) const {
auto& device_ctx = g_vpr_ctx.device();
auto& rr_graph = device_ctx.rr_graph;

Expand Down
Loading

0 comments on commit 0826ad7

Please sign in to comment.