Skip to content

Commit 7a54df6

Browse files
committed
Improved the comments in overuse_report.h and overuse_report.cpp. Changed all major comments to Doxygen style. Added subtile occupany checking in t_grid_blocks. Fixed a bug where the overuse report may try to print out information for EMPTY_BLOCK_ID when overused IPIN/OPIN nodes are unoccupied by clustered blocks.
1 parent 688ac55 commit 7a54df6

File tree

3 files changed

+105
-14
lines changed

3 files changed

+105
-14
lines changed

vpr/src/base/vpr_types.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,25 @@ struct t_block_loc {
706706

707707
///@brief Stores the clustered blocks placed at a particular grid location
708708
struct t_grid_blocks {
709-
int usage; ///<How many valid blocks are in use at this location
710-
std::vector<ClusterBlockId> blocks; ///<The clustered blocks associated with this grid location
709+
int usage; ///<How many valid blocks are in use at this location
710+
711+
/**
712+
* @brief The clustered blocks associated with this grid location.
713+
*
714+
* Index range: [0..device_ctx.grid[x_loc][y_loc].type->capacity]
715+
*/
716+
std::vector<ClusterBlockId> blocks;
717+
718+
/**
719+
* @brief Test if a subtile at a grid location is occupied by a block.
720+
*
721+
* Returns true if the subtile corresponds to the passed-in id is not
722+
* occupied by a block at this grid location. The subtile id serves
723+
* as the z-dimensional offset in the grid indexing.
724+
*/
725+
inline bool subtile_empty(size_t isubtile) {
726+
return blocks[isubtile] == EMPTY_BLOCK_ID;
727+
}
711728
};
712729

713730
///@brief Names of various files

vpr/src/route/overuse_report.cpp

Lines changed: 67 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
#include "globals.h"
55
#include "vtr_log.h"
66

7+
/**
8+
* @brief Definitions of global and helper routines related to printing RR node overuse info.
9+
*
10+
* All the global routines defined here are declared in the header file overuse_report.h
11+
* The helper routines that are called by the global routine should stay local to this file.
12+
* They provide subroutine hierarchy to allow easier customization of the logfile/report format.
13+
*/
14+
715
static void report_overused_ipin_opin(std::ostream& os, RRNodeId node_id);
816
static void report_overused_chanx_chany(std::ostream& os, RRNodeId node_id);
917
static void report_overused_source_sink(std::ostream& os, RRNodeId node_id);
@@ -12,6 +20,12 @@ static void report_congested_nets(std::ostream& os, const std::set<ClusterNetId>
1220
static void log_overused_nodes_header();
1321
static void log_single_overused_node_status(int overuse_index, RRNodeId inode);
1422

23+
/**
24+
* @brief Print out RR node overuse info in the VPR logfile.
25+
*
26+
* Print out limited amount of overused node info in the vpr.out logfile.
27+
* The limit is specified by the VPR option --max_logged_overused_rr_nodes
28+
*/
1529
void log_overused_nodes_status(int max_logged_overused_rr_nodes) {
1630
const auto& device_ctx = g_vpr_ctx.device();
1731
const auto& route_ctx = g_vpr_ctx.routing();
@@ -36,36 +50,43 @@ void log_overused_nodes_status(int max_logged_overused_rr_nodes) {
3650
}
3751
}
3852

53+
/**
54+
* @brief Print out RR node overuse info in a post-VPR report file.
55+
*
56+
* Print all the overused RR nodes' info in the report file report_overused_nodes.rpt.
57+
* The report generation is turned on by the VPR option: --generate_rr_node_overuse_report on.
58+
*/
3959
void report_overused_nodes() {
4060
const auto& device_ctx = g_vpr_ctx.device();
4161
const auto& route_ctx = g_vpr_ctx.routing();
4262

43-
//Generate overuse info lookup table
63+
/* Generate overuse info lookup table */
4464
std::map<RRNodeId, std::set<ClusterNetId>> nodes_to_nets_lookup;
4565
generate_overused_nodes_to_congested_net_lookup(nodes_to_nets_lookup);
4666

47-
//Open the report file
67+
/* Open the report file and print header info */
4868
std::ofstream os("report_overused_nodes.rpt");
4969
os << "Overused nodes information report on the final failed routing attempt" << '\n';
5070
os << "Total number of overused nodes = " << nodes_to_nets_lookup.size() << '\n';
5171

72+
/* Go through each rr node and the nets that pass through it */
5273
size_t inode = 0;
5374
for (const auto& lookup_pair : nodes_to_nets_lookup) {
5475
const RRNodeId node_id = lookup_pair.first;
5576
const auto& congested_nets = lookup_pair.second;
5677

57-
os << "************************************************\n\n"; //RR Node Separation line
78+
os << "************************************************\n\n"; //Separation line
5879

59-
//Report Basic info
80+
/* Report basic rr node info */
6081
os << "Overused RR node #" << inode << '\n';
6182
os << "Node id = " << size_t(node_id) << '\n';
6283
os << "Occupancy = " << route_ctx.rr_node_route_inf[size_t(node_id)].occ() << '\n';
6384
os << "Capacity = " << device_ctx.rr_nodes.node_capacity(node_id) << "\n\n";
6485

65-
//Report Selective info
86+
/* Report selective info based on the rr node type */
87+
auto node_type = device_ctx.rr_nodes.node_type(node_id);
6688
os << "Node type = " << device_ctx.rr_nodes.node_type_string(node_id) << '\n';
6789

68-
auto node_type = device_ctx.rr_nodes.node_type(node_id);
6990
switch (node_type) {
7091
case IPIN:
7192
case OPIN:
@@ -84,7 +105,9 @@ void report_overused_nodes() {
84105
break;
85106
}
86107

87-
os << "-----------------------------\n"; //Node/net info separation line
108+
/* Finished printing the node info. Now print out the *
109+
* info on the nets passing through this overused node */
110+
os << "-----------------------------\n"; //Separation line
88111
report_congested_nets(os, congested_nets);
89112

90113
++inode;
@@ -93,6 +116,15 @@ void report_overused_nodes() {
93116
os.close();
94117
}
95118

119+
/**
120+
* @brief Generate a overused RR nodes to congested nets lookup table.
121+
*
122+
* Uses map data structure to store a lookup table that matches RR nodes
123+
* to the nets that pass through them. Only overused nodes and congested
124+
* nets will be recorded.
125+
*
126+
* This routine goes through the trace back linked list of each net.
127+
*/
96128
void generate_overused_nodes_to_congested_net_lookup(std::map<RRNodeId, std::set<ClusterNetId>>& nodes_to_nets_lookup) {
97129
const auto& device_ctx = g_vpr_ctx.device();
98130
const auto& route_ctx = g_vpr_ctx.routing();
@@ -112,6 +144,7 @@ void generate_overused_nodes_to_congested_net_lookup(std::map<RRNodeId, std::set
112144
}
113145
}
114146

147+
///@brief Print out information specific to IPIN/OPIN type rr nodes
115148
static void report_overused_ipin_opin(std::ostream& os, RRNodeId node_id) {
116149
const auto& device_ctx = g_vpr_ctx.device();
117150
const auto& place_ctx = g_vpr_ctx.placement();
@@ -128,33 +161,47 @@ static void report_overused_ipin_opin(std::ostream& os, RRNodeId node_id) {
128161
//Add block type for IPINs/OPINs in overused rr-node report
129162
const auto& clb_nlist = g_vpr_ctx.clustering().clb_nlist;
130163
auto& grid_info = place_ctx.grid_blocks[grid_x][grid_y];
131-
auto& grid_blocks = grid_info.blocks;
132164

133165
os << "Grid location: X = " << grid_x << ", Y = " << grid_y << '\n';
134-
os << "Number of blocks currently at this grid location = " << grid_info.usage << '\n';
135-
for (size_t iblock = 0; iblock < grid_blocks.size(); ++iblock) {
136-
ClusterBlockId block_id = grid_blocks[iblock];
166+
os << "Number of blocks currently occupying this grid location = " << grid_info.usage << '\n';
167+
168+
size_t iblock = 0;
169+
for (size_t isubtile = 0; isubtile < grid_blocks.size(); ++isubtile) {
170+
//Check if the block is empty
171+
if (grid_info.subtile_empty[isubtile]) {
172+
continue;
173+
}
174+
175+
//Print out the block index, name and type
176+
ClusterBlockId block_id = grid_info.blocks[isubtile];
137177
os << "Block #" << iblock << ": ";
138178
os << "Block name = " << clb_nlist.block_pb(block_id)->name << ", ";
139179
os << "Block type = " << clb_nlist.block_type(block_id)->name << '\n';
180+
++iblock;
140181
}
141182
}
142183

184+
///@brief Print out information specific to CHANX/CHANY type rr nodes
143185
static void report_overused_chanx_chany(std::ostream& os, RRNodeId node_id) {
144186
const auto& device_ctx = g_vpr_ctx.device();
145187

146188
os << "Track number = " << device_ctx.rr_nodes.node_track_num(node_id) << '\n';
147189
os << "Direction = " << device_ctx.rr_nodes.node_direction_string(node_id) << "\n\n";
148190

191+
//CHANX/CHANY rr nodes span across several grid locations.
192+
//Need to print out their starting and ending locations.
149193
os << "Grid location: " << '\n';
150194
os << "Xlow = " << device_ctx.rr_nodes.node_xlow(node_id) << ", ";
151195
os << "Ylow = " << device_ctx.rr_nodes.node_ylow(node_id) << '\n';
152196
os << "Xhigh = " << device_ctx.rr_nodes.node_xhigh(node_id) << ", ";
153197
os << "Yhigh = " << device_ctx.rr_nodes.node_yhigh(node_id) << '\n';
198+
199+
//Print out associated RC characteristics as they will be non-zero
154200
os << "Resistance = " << device_ctx.rr_nodes.node_R(node_id) << '\n';
155201
os << "Capacitance = " << device_ctx.rr_nodes.node_C(node_id) << '\n';
156202
}
157203

204+
///@brief Print out information specific to SOURCE/SINK type rr nodes
158205
static void report_overused_source_sink(std::ostream& os, RRNodeId node_id) {
159206
const auto& device_ctx = g_vpr_ctx.device();
160207

@@ -168,7 +215,13 @@ static void report_overused_source_sink(std::ostream& os, RRNodeId node_id) {
168215
os << "Grid location: X = " << grid_x << ", Y = " << grid_y << '\n';
169216
}
170217

171-
//Reported congested nets at a specific rr node
218+
/**
219+
* @brief Print out info on congested nets in the router.
220+
*
221+
* Report information on the congested nets that pass through a specific rr node. *
222+
* These nets are congested because the number of nets currently passing through *
223+
* this rr node exceed the node's routing net capacity.
224+
*/
172225
static void report_congested_nets(std::ostream& os, const std::set<ClusterNetId>& congested_nets) {
173226
const auto& clb_nlist = g_vpr_ctx.clustering().clb_nlist;
174227
os << "Number of nets passing through this RR node = " << congested_nets.size() << '\n';
@@ -186,6 +239,7 @@ static void report_congested_nets(std::ostream& os, const std::set<ClusterNetId>
186239
os << '\n';
187240
}
188241

242+
///@brief Print out the header of the overused rr node info in the logfile
189243
static void log_overused_nodes_header() {
190244
VTR_LOG("Routing Failure Diagnostics: Printing Overused Nodes Information\n");
191245
VTR_LOG("------ ------- ---------- --------- -------- ------------ ------- ------- ------- ------- ------- -------\n");
@@ -194,6 +248,7 @@ static void log_overused_nodes_header() {
194248
VTR_LOG("------ ------- ---------- --------- -------- ------------ ------- ------- ------- ------- ------- -------\n");
195249
}
196250

251+
///@brief Print out a single-line info that corresponds to a single overused rr node in the logfile
197252
static void log_single_overused_node_status(int overuse_index, RRNodeId node_id) {
198253
const auto& device_ctx = g_vpr_ctx.device();
199254
const auto& route_ctx = g_vpr_ctx.routing();

vpr/src/route/overuse_report.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@
33
#include "rr_graph_storage.h"
44
#include <map>
55

6+
/**
7+
* @brief Global routines related to displaying RR node overuse info.
8+
*
9+
* This file contains all the routines that print out the information on overused RR nodes
10+
* and congested nets. The main purpose of these routines is to aid the debugging process
11+
* should the VPR fail to implement the circuit. Functionalities that resolve these circuit
12+
* issues should NOT be included here or in overuse_report.cpp
13+
*
14+
* An RR node is overused when the number of nets passing through it exceed the node's
15+
* routing net capacity. A successfully routed circuit is void of these overused nodes.
16+
*
17+
* All the nets passing through an overused RR node are flagged as congested nets.
18+
*/
19+
20+
///@brief Print out RR node overuse info in the VPR logfile.
621
void log_overused_nodes_status(int max_logged_overused_rr_nodes);
22+
23+
///@brief Print out RR node overuse info in a post-VPR report file.
724
void report_overused_nodes();
25+
26+
///@brief Generate a overused RR nodes to congested nets lookup table.
827
void generate_overused_nodes_to_congested_net_lookup(std::map<RRNodeId, std::set<ClusterNetId>>& nodes_to_nets_lookup);

0 commit comments

Comments
 (0)