Skip to content

Commit 26e1017

Browse files
move t_rr_node_route_inf from rr_node_type.h to route_commmon.h
1 parent 20dd3f8 commit 26e1017

12 files changed

+88
-65
lines changed

libs/librrgraph/src/base/rr_node_types.h

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -128,45 +128,3 @@ struct t_rr_rc_data {
128128
// This is the data type of fast lookups of an rr-node given an (rr_type, layer, x, y, and the side)
129129
//[0..num_rr_types-1][0..num_layer-1][0..grid_width-1][0..grid_height-1][0..NUM_2D_SIDES-1][0..max_ptc-1]
130130
typedef vtr::array<e_rr_type, vtr::NdMatrix<std::vector<RRNodeId>, 4>, (size_t)e_rr_type::NUM_RR_TYPES> t_rr_node_indices;
131-
132-
/**
133-
* @brief Extra information about each rr_node needed only during routing
134-
* (i.e. during the maze expansion).
135-
*/
136-
struct t_rr_node_route_inf {
137-
/** ID of the edge (globally unique edge ID in the RR Graph)
138-
* that was used to reach this node from the previous node.
139-
* If there is no predecessor, prev_edge = NO_PREVIOUS.
140-
*/
141-
RREdgeId prev_edge;
142-
143-
/** Accumulated cost term from previous Pathfinder iterations. */
144-
float acc_cost;
145-
146-
/** Total cost of the path up to and including this node +
147-
* the expected cost to the target if the timing_driven router
148-
* is being used.
149-
*/
150-
float path_cost;
151-
152-
/** Total cost of the path up to and including this node. */
153-
float backward_path_cost;
154-
155-
/** Upstream resistance to ground from this node in the current
156-
* path search (connection routing), including the resistance
157-
* of the node itself (device_ctx.rr_nodes[index].R).
158-
*/
159-
float R_upstream;
160-
161-
public: // Accessors
162-
/** @return The current occupancy of the associated rr node. */
163-
short occ() const { return occ_; }
164-
165-
public: // Mutators
166-
/** @param new_occ The new occupancy to set. */
167-
void set_occ(int new_occ) { occ_ = new_occ; }
168-
169-
private: // Data
170-
/** The current occupancy of the associated rr node. */
171-
short occ_ = 0;
172-
};

vpr/src/base/globals.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#include "globals.h"
2+
#include "route_common.h"
23

34
VprContext g_vpr_ctx;

vpr/src/base/old_traceback.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "clustered_netlist_fwd.h"
44
#include "globals.h"
55
#include "vtr_assert.h"
6+
#include "route_common.h"
67

78
#include <vector>
89

vpr/src/base/vpr_context.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
class SetupHoldTimingInfo;
4545
class PostClusterDelayCalculator;
46+
struct t_rr_node_route_inf;
4647

4748
#endif /* NO_SERVER */
4849

vpr/src/route/overuse_report.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "physical_types_util.h"
66
#include "vpr_utils.h"
77
#include "vtr_log.h"
8+
#include "route_common.h"
89

910
/**
1011
* @brief Definitions of global and helper routines related to printing RR node overuse info.

vpr/src/route/route_common.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/** @file Impls for more router utils */
22

3+
#include "route_common.h"
4+
35
#include "atom_netlist_utils.h"
46
#include "connection_router_interface.h"
57
#include "describe_rr_node.h"
6-
#include "route_common.h"
78
#include "logic_types.h"
89
#include "physical_types_util.h"
910
#include "route_export.h"

vpr/src/route/route_common.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,48 @@
77
#include "router_stats.h"
88
#include "globals.h"
99

10+
/**
11+
* @brief Extra information about each rr_node needed only during routing
12+
* (i.e. during the maze expansion).
13+
*/
14+
struct t_rr_node_route_inf {
15+
/** ID of the edge (globally unique edge ID in the RR Graph)
16+
* that was used to reach this node from the previous node.
17+
* If there is no predecessor, prev_edge = NO_PREVIOUS.
18+
*/
19+
RREdgeId prev_edge;
20+
21+
/** Accumulated cost term from previous Pathfinder iterations. */
22+
float acc_cost;
23+
24+
/** Total cost of the path up to and including this node +
25+
* the expected cost to the target if the timing_driven router
26+
* is being used.
27+
*/
28+
float path_cost;
29+
30+
/** Total cost of the path up to and including this node. */
31+
float backward_path_cost;
32+
33+
/** Upstream resistance to ground from this node in the current
34+
* path search (connection routing), including the resistance
35+
* of the node itself (device_ctx.rr_nodes[index].R).
36+
*/
37+
float R_upstream;
38+
39+
public: // Accessors
40+
/** @return The current occupancy of the associated rr node. */
41+
short occ() const { return occ_; }
42+
43+
public: // Mutators
44+
/** @param new_occ The new occupancy to set. */
45+
void set_occ(int new_occ) { occ_ = new_occ; }
46+
47+
private: // Data
48+
/** The current occupancy of the associated rr node. */
49+
short occ_ = 0;
50+
};
51+
1052
/** This routine checks to see if this is a resource-feasible routing.
1153
* That is, are all rr_node capacity limitations respected? It assumes
1254
* that the occupancy arrays are up to date when it is called. */

vpr/src/route/route_path_manager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "route_path_manager.h"
22
#include "vpr_context.h"
3+
#include "route_common.h"
34

45
PathManager::PathManager() {
56
// Only init data structure if required by RCV
@@ -23,7 +24,7 @@ bool PathManager::node_exists_in_tree(t_heap_path* path_data,
2324
}
2425
}
2526

26-
// Search through route tree set for nodes existance
27+
// Search through route tree set for nodes existence
2728
auto node_exists_in_route_tree = route_tree_nodes_.find(to_node);
2829

2930
if (node_exists_in_route_tree != route_tree_nodes_.end()) {
@@ -70,7 +71,7 @@ void PathManager::alloc_path_struct(t_heap_path*& tptr) {
7071
// if (tptr == nullptr) {
7172
// Use a free node list to avoid unnecessary data allocation
7273
// If there are unused data structures in memory use these
73-
if (freed_nodes_.size() > 0) {
74+
if (!freed_nodes_.empty()) {
7475
tptr = freed_nodes_.back();
7576
freed_nodes_.pop_back();
7677
} else {

vpr/src/route/route_tree.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "globals.h"
55
#include "netlist_fwd.h"
66
#include "route_debug.h"
7+
#include "route_common.h"
78
#include "rr_graph_fwd.h"
89
#include "vtr_math.h"
910

@@ -13,7 +14,7 @@ RouteTreeNode::RouteTreeNode(RRNodeId _inode, RRSwitchId _parent_switch, RouteTr
1314
: inode(_inode)
1415
, parent_switch(_parent_switch)
1516
, _parent(parent) {
16-
auto& device_ctx = g_vpr_ctx.device();
17+
const auto& device_ctx = g_vpr_ctx.device();
1718
const auto& rr_graph = device_ctx.rr_graph;
1819

1920
re_expand = true;

vpr/src/route/route_utils.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,15 @@ void print_overused_nodes_status(const t_router_opts& router_opts, const Overuse
272272
VTR_LOG("\n");
273273
}
274274

275-
void print_route_status(int itry, double elapsed_sec, float pres_fac, int num_bb_updated, const RouterStats& router_stats, const OveruseInfo& overuse_info, const WirelengthInfo& wirelength_info, std::shared_ptr<const SetupHoldTimingInfo> timing_info, float est_success_iteration) {
275+
void print_route_status(int itry,
276+
double elapsed_sec,
277+
float pres_fac,
278+
int num_bb_updated,
279+
const RouterStats& router_stats,
280+
const OveruseInfo& overuse_info,
281+
const WirelengthInfo& wirelength_info,
282+
std::shared_ptr<const SetupHoldTimingInfo> timing_info,
283+
float est_success_iteration) {
276284
//Iteration
277285
VTR_LOG("%4d", itry);
278286

vpr/src/route/route_utils.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
#include "RoutingDelayCalculator.h"
1212

13-
constexpr float CONGESTED_SLOPE_VAL = -0.04;
14-
1513
/** Identifies the two breakpoint types in routing */
1614
typedef enum router_breakpoint_type {
1715
BP_ROUTE_ITER,
@@ -105,7 +103,15 @@ bool is_iteration_complete(bool routing_is_feasible, const t_router_opts& router
105103

106104
void print_overused_nodes_status(const t_router_opts& router_opts, const OveruseInfo& overuse_info);
107105

108-
void print_route_status(int itry, double elapsed_sec, float pres_fac, int num_bb_updated, const RouterStats& router_stats, const OveruseInfo& overuse_info, const WirelengthInfo& wirelength_info, std::shared_ptr<const SetupHoldTimingInfo> timing_info, float est_success_iteration);
106+
void print_route_status(int itry,
107+
double elapsed_sec,
108+
float pres_fac,
109+
int num_bb_updated,
110+
const RouterStats& router_stats,
111+
const OveruseInfo& overuse_info,
112+
const WirelengthInfo& wirelength_info,
113+
std::shared_ptr<const SetupHoldTimingInfo> timing_info,
114+
float est_success_iteration);
109115

110116
void print_route_status_header();
111117

vpr/src/route/segment_stats.cpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11

2-
#include "vtr_log.h"
2+
#include "segment_stats.h"
33

4+
#include "vtr_log.h"
45
#include "globals.h"
5-
#include "segment_stats.h"
6+
#include "route_common.h"
7+
68

79
/*************** Variables and defines local to this module ****************/
810

9-
#define LONGLINE 0
11+
static constexpr int LONGLINE = 0;
1012

1113
/******************* Subroutine definitions ********************************/
1214

@@ -33,11 +35,11 @@ void get_segment_usage_stats(std::vector<t_segment_inf>& segment_inf) {
3335
{X_AXIS, std::map<int, int>()},
3436
{Y_AXIS, std::map<int, int>()}};
3537

36-
std::set<int, std::less<int>> segment_lengths;
37-
for (const auto& seg_inf : segment_inf) {
38+
std::set<int, std::less<>> segment_lengths;
39+
for (const t_segment_inf& seg_inf : segment_inf) {
3840
int seg_length = seg_inf.longline ? LONGLINE : seg_inf.length;
3941

40-
for (auto ax : {X_AXIS, Y_AXIS}) {
42+
for (e_parallel_axis ax : {X_AXIS, Y_AXIS}) {
4143
directed_cap_by_length[ax].insert({seg_length, 0});
4244
directed_occ_by_length[ax].insert({seg_length, 0});
4345
}
@@ -56,15 +58,15 @@ void get_segment_usage_stats(std::vector<t_segment_inf>& segment_inf) {
5658
{Y_AXIS, std::vector<int>(segment_inf.size(), 0)}};
5759

5860
for (RRNodeId inode : device_ctx.rr_graph.nodes()) {
59-
auto node_type = rr_graph.node_type(inode);
61+
e_rr_type node_type = rr_graph.node_type(inode);
6062
if (node_type == e_rr_type::CHANX || node_type == e_rr_type::CHANY) {
6163
cost_index = rr_graph.node_cost_index(inode);
6264
size_t seg_type = device_ctx.rr_indexed_data[cost_index].seg_index;
6365
int length = segment_inf[seg_type].longline ? LONGLINE : segment_inf[seg_type].length;
6466

6567
const short& inode_capacity = rr_graph.node_capacity(inode);
6668
int occ = route_ctx.rr_node_route_inf[inode].occ();
67-
auto ax = (node_type == e_rr_type::CHANX) ? X_AXIS : Y_AXIS;
69+
e_parallel_axis ax = (node_type == e_rr_type::CHANX) ? X_AXIS : Y_AXIS;
6870

6971
directed_occ_by_length[ax][length] += occ;
7072
directed_cap_by_length[ax][length] += inode_capacity;
@@ -77,8 +79,8 @@ void get_segment_usage_stats(std::vector<t_segment_inf>& segment_inf) {
7779
VTR_LOG("\n");
7880
VTR_LOG("Total Number of Wiring Segments by Direction: direction length number\n");
7981
VTR_LOG(" --------- ------ -------\n");
80-
for (auto length : segment_lengths) {
81-
for (auto ax : {X_AXIS, Y_AXIS}) {
82+
for (int length : segment_lengths) {
83+
for (e_parallel_axis ax : {X_AXIS, Y_AXIS}) {
8284
std::string ax_name = (ax == X_AXIS) ? "X" : "Y";
8385
if (directed_cap_by_length[ax][length] != 0) {
8486
std::string length_str = (length == LONGLINE) ? "longline" : std::to_string(length);
@@ -92,12 +94,12 @@ void get_segment_usage_stats(std::vector<t_segment_inf>& segment_inf) {
9294
}
9395
}
9496

95-
for (auto ax : {X_AXIS, Y_AXIS}) {
97+
for (e_parallel_axis ax : {X_AXIS, Y_AXIS}) {
9698
std::string ax_name = (ax == X_AXIS) ? "X" : "Y";
9799
VTR_LOG("\n");
98100
VTR_LOG("%s - Directed Wiring Segment usage by length: length utilization\n", ax_name.c_str());
99101
VTR_LOG(" ------ -----------\n");
100-
for (auto length : segment_lengths) {
102+
for (int length : segment_lengths) {
101103
if (directed_cap_by_length[ax][length] != 0) {
102104
std::string length_str = (length == LONGLINE) ? "longline" : std::to_string(length);
103105
utilization = (float)directed_occ_by_length[ax][length] / (float)directed_cap_by_length[ax][length];
@@ -112,13 +114,13 @@ void get_segment_usage_stats(std::vector<t_segment_inf>& segment_inf) {
112114
VTR_LOG("\n");
113115
VTR_LOG("Segment occupancy by length: Length utilization\n");
114116
VTR_LOG(" ------ -----------\n");
115-
for (const auto& seg_length : segment_lengths) {
117+
for (const int seg_length : segment_lengths) {
116118
if (directed_cap_by_length[X_AXIS][seg_length] != 0 || directed_cap_by_length[Y_AXIS][seg_length] != 0) {
117119
std::string seg_name = "L" + std::to_string(seg_length);
118120

119121
int occ = 0;
120122
int cap = 0;
121-
for (auto ax : {X_AXIS, Y_AXIS}) {
123+
for (e_parallel_axis ax : {X_AXIS, Y_AXIS}) {
122124
occ += directed_occ_by_length[ax][seg_length];
123125
cap += directed_cap_by_length[ax][seg_length];
124126
}
@@ -137,7 +139,7 @@ void get_segment_usage_stats(std::vector<t_segment_inf>& segment_inf) {
137139
int seg_name_size = static_cast<int>(seg_name.size());
138140
int occ = 0;
139141
int cap = 0;
140-
for (auto ax : {X_AXIS, Y_AXIS}) {
142+
for (e_parallel_axis ax : {X_AXIS, Y_AXIS}) {
141143
occ += directed_occ_by_type[ax][seg_type];
142144
cap += directed_cap_by_type[ax][seg_type];
143145
}

0 commit comments

Comments
 (0)