Skip to content

Commit 2d833bf

Browse files
add comments
1 parent 4794d13 commit 2d833bf

File tree

4 files changed

+64
-57
lines changed

4 files changed

+64
-57
lines changed

vpr/src/route/router_lookahead/router_lookahead_map_utils.cpp

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -988,26 +988,26 @@ static void dijkstra_flood_to_wires(int itile,
988988
int ptc = rr_graph.node_ptc_num(node);
989989
int root_layer_num = rr_graph.node_layer_low(node);
990990

991-
/*
992-
* Perform Dijkstra from the SOURCE/OPIN of interest, stopping at the first
993-
* reachable wires (i.e. until we hit the inter-block routing network), or a SINK
994-
* (via a direct-connect).
995-
*
996-
* Note that typical RR graphs are structured :
997-
*
998-
* SOURCE ---> OPIN --> CHANX/CHANY
999-
* |
1000-
* --> OPIN --> CHANX/CHANY
1001-
* |
1002-
* ...
1003-
*
1004-
* possibly with direct-connects of the form:
1005-
*
1006-
* SOURCE --> OPIN --> IPIN --> SINK
1007-
*
1008-
* and there is a small number of fixed hops from SOURCE/OPIN to CHANX/CHANY or
1009-
* to a SINK (via a direct-connect), so this runs very fast (i.e. O(1))
1010-
*/
991+
992+
// Perform Dijkstra from the SOURCE/OPIN of interest, stopping at the first
993+
// reachable wires (i.e. until we hit the inter-block routing network), or a SINK
994+
// (via a direct-connect).
995+
//
996+
// Note that typical RR graphs are structured :
997+
//
998+
// SOURCE ---> OPIN --> CHANX/CHANY/CHANZ
999+
// |
1000+
// --> OPIN --> CHANX/CHANY/CHANZ
1001+
// |
1002+
// ...
1003+
//
1004+
// possibly with direct-connects of the form:
1005+
//
1006+
// SOURCE --> OPIN --> IPIN --> SINK
1007+
//
1008+
// and there is a small number of fixed hops from SOURCE/OPIN to CHANX/CHANY or
1009+
// to a SINK (via a direct-connect), so this runs very fast (i.e. O(1))
1010+
10111011
pq.push(root);
10121012
while (!pq.empty()) {
10131013
t_pq_entry curr = pq.top();
@@ -1016,23 +1016,24 @@ static void dijkstra_flood_to_wires(int itile,
10161016
e_rr_type curr_rr_type = rr_graph.node_type(curr.node);
10171017
int curr_layer_num = rr_graph.node_layer_low(curr.node);
10181018
if (curr_rr_type == e_rr_type::CHANX || curr_rr_type == e_rr_type::CHANY || curr_rr_type == e_rr_type::CHANZ || curr_rr_type == e_rr_type::SINK) {
1019-
// We stop expansion at any CHANX/CHANY/SINK
1019+
// We stop expansion at any CHANX/CHANY/CHANZ/SINK
10201020
int seg_index;
10211021
if (curr_rr_type != e_rr_type::SINK) {
1022-
//It's a wire, figure out its type
1022+
// It's a wire, figure out its type
10231023
RRIndexedDataId cost_index = rr_graph.node_cost_index(curr.node);
10241024
seg_index = device_ctx.rr_indexed_data[cost_index].seg_index;
10251025
} else {
10261026
// This is a direct-connect path between an IPIN and OPIN,
10271027
// which terminated at a SINK.
1028-
//
10291028
// We treat this as a 'special' wire type.
10301029
// When the src_opin_delays data structure is queried and a SINK rr_type
10311030
// is found, the lookahead is not accessed to get the cost entries
10321031
// as this is a special case of direct connections between OPIN and IPIN.
10331032
seg_index = DIRECT_CONNECT_SPECIAL_SEG_TYPE;
10341033
}
10351034

1035+
// Reaching a CHANZ nodes means that we are moving to a different layer than
1036+
// where root node is located. It's assumed that there are only two layers.
10361037
if (curr_rr_type == e_rr_type::CHANZ) {
10371038
curr_layer_num = (root_layer_num + 1) % 2;
10381039
}
@@ -1048,9 +1049,9 @@ static void dijkstra_flood_to_wires(int itile,
10481049
}
10491050

10501051
} else if (curr_rr_type == e_rr_type::SOURCE || curr_rr_type == e_rr_type::OPIN || curr_rr_type == e_rr_type::IPIN || curr_rr_type == e_rr_type::MUX) {
1051-
//We allow expansion through SOURCE/OPIN/IPIN types
1052+
// We allow expansion through SOURCE/OPIN/IPIN types
10521053
RRIndexedDataId cost_index = rr_graph.node_cost_index(curr.node);
1053-
float incr_cong = device_ctx.rr_indexed_data[cost_index].base_cost; //Current nodes congestion cost
1054+
float incr_cong = device_ctx.rr_indexed_data[cost_index].base_cost; // Current nodes congestion cost
10541055

10551056
for (RREdgeId edge : rr_graph.edge_range(curr.node)) {
10561057
int iswitch = rr_graph.rr_nodes().edge_switch(edge);
@@ -1064,8 +1065,8 @@ static void dijkstra_flood_to_wires(int itile,
10641065
}
10651066

10661067
t_pq_entry next;
1067-
next.congestion = curr.congestion + incr_cong; //Of current node
1068-
next.delay = curr.delay + incr_delay; //To reach next node
1068+
next.congestion = curr.congestion + incr_cong; // Of current node
1069+
next.delay = curr.delay + incr_delay; // To reach next node
10691070
next.node = next_node;
10701071

10711072
pq.push(next);

vpr/src/route/rr_graph_generation/rr_graph.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,8 +1541,7 @@ static void alloc_and_load_tile_rr_graph(RRGraphBuilder& rr_graph_builder,
15411541

15421542
void free_rr_graph() {
15431543
// Frees all the routing graph data structures, if they have been allocated.
1544-
// I use rr_mem_chunk_list_head as a flag to indicate whether or not the graph has been allocated -- if it is not NULL,
1545-
// a routing graph exists and can be freed. Hence, you can call this routine even if you're not sure of whether a rr_graph exists or not.
1544+
// You can call this routine even if you're not sure of whether a rr_graph exists or not.
15461545

15471546
// Before adding any more free calls here, be sure the data is NOT chunk allocated, as ALL the chunk allocated data is already free!
15481547
DeviceContext& device_ctx = g_vpr_ctx.mutable_device();
@@ -1560,6 +1559,12 @@ void free_rr_graph() {
15601559

15611560
device_ctx.rr_graph_is_flat = false;
15621561

1562+
device_ctx.rr_chanx_segment_width.clear();
1563+
device_ctx.rr_chany_segment_width.clear();
1564+
device_ctx.rr_chanz_segment_width.clear();
1565+
device_ctx.rr_chanx_width.clear();
1566+
device_ctx.rr_chany_width.clear();
1567+
15631568
invalidate_router_lookahead_cache();
15641569
}
15651570

vpr/src/route/rr_graph_generation/rr_graph_chan_chan_edges.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder,
2929
int wire_to_ipin_switch,
3030
e_directionality directionality);
3131

32+
/**
33+
* @brief Collects the edges fanning-out of the 'from' track which connect to
34+
* the 'to' tracks, according to the switch block pattern.
35+
*
36+
* It returns the number of connections added, and updates edge_list_ptr to
37+
* point at the head of the (extended) linked list giving the nodes to which
38+
* this segment connects and the switch type used to connect to each.
39+
*
40+
* An edge is added from this segment to a y-segment if:
41+
* (1) this segment should have a switch box at that location, or
42+
* (2) the y-segment to which it would connect has a switch box, and the switch
43+
* type of that y-segment is unbuffered (bidirectional pass transistor).
44+
*
45+
* For bidirectional:
46+
* If the switch in each direction is a pass transistor (unbuffered), both
47+
* switches are marked as being of the types of the larger (lower R) pass
48+
* transistor.
49+
*/
3250
static int get_track_to_tracks(RRGraphBuilder& rr_graph_builder,
3351
int layer,
3452
int from_chan,
@@ -345,24 +363,6 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder,
345363
}
346364
}
347365

348-
/*
349-
* Collects the edges fanning-out of the 'from' track which connect to the 'to'
350-
* tracks, according to the switch block pattern.
351-
*
352-
* It returns the number of connections added, and updates edge_list_ptr to
353-
* point at the head of the (extended) linked list giving the nodes to which
354-
* this segment connects and the switch type used to connect to each.
355-
*
356-
* An edge is added from this segment to a y-segment if:
357-
* (1) this segment should have a switch box at that location, or
358-
* (2) the y-segment to which it would connect has a switch box, and the switch
359-
* type of that y-segment is unbuffered (bidirectional pass transistor).
360-
*
361-
* For bidirectional:
362-
* If the switch in each direction is a pass transistor (unbuffered), both
363-
* switches are marked as being of the types of the larger (lower R) pass
364-
* transistor.
365-
*/
366366
static int get_track_to_tracks(RRGraphBuilder& rr_graph_builder,
367367
int layer,
368368
int from_chan,
@@ -400,12 +400,12 @@ static int get_track_to_tracks(RRGraphBuilder& rr_graph_builder,
400400

401401
int from_switch = from_seg_details[from_track].arch_wire_switch();
402402

403-
//The absolute coordinate along the channel where the switch block at the
404-
//beginning of the current wire segment is located
403+
// The absolute coordinate along the channel where the switch block at the
404+
// beginning of the current wire segment is located
405405
int start_sb_seg = from_seg - 1;
406406

407-
//The absolute coordinate along the channel where the switch block at the
408-
//end of the current wire segment is located
407+
// The absolute coordinate along the channel where the switch block at the
408+
// end of the current wire segment is located
409409
int end_sb_seg = get_seg_end(from_seg_details, from_track, from_seg, from_chan, chan_len);
410410

411411
// Figure out the sides of SB the from_wire will use
@@ -430,8 +430,8 @@ static int get_track_to_tracks(RRGraphBuilder& rr_graph_builder,
430430
end = to_seg;
431431
}
432432

433-
//Walk along the 'from' wire segment identifying if a switchblock is located
434-
//at each coordinate and add any related fan-out connections to the 'from' wire segment
433+
// Walk along the 'from' wire segment identifying if a switchblock is located
434+
// at each coordinate and add any related fan-out connections to the 'from' wire segment
435435
int num_conn = 0;
436436
for (int sb_seg = start; sb_seg <= end; ++sb_seg) {
437437
if (sb_seg < start_sb_seg || sb_seg > end_sb_seg) {
@@ -454,7 +454,7 @@ static int get_track_to_tracks(RRGraphBuilder& rr_graph_builder,
454454
// Get the coordinates of the current SB from the perspective of the destination channel.
455455
// i.e. for segments laid in the x-direction, sb_seg corresponds to the x coordinate and from_chan to the y,
456456
// but for segments in the y-direction, from_chan is the x coordinate and sb_seg is the y. So here we reverse
457-
//the coordinates if necessary
457+
// the coordinates if necessary
458458
if (from_type == to_type) {
459459
// Same channel
460460
to_chan = from_chan;
@@ -566,8 +566,8 @@ static int get_track_to_tracks(RRGraphBuilder& rr_graph_builder,
566566
}
567567
if (UNI_DIRECTIONAL == directionality) {
568568
// No fanout if no SB.
569-
/* Also, we are connecting from the bottom or left of SB so it
570-
* makes the most sense to only get there from Direction::INC wires. */
569+
// Also, we are connecting from the bottom or left of SB so it
570+
// makes the most sense to only get there from Direction::INC wires.
571571
if ((from_is_sblock)
572572
&& (Direction::INC == from_seg_details[from_track].direction())) {
573573
num_conn += get_unidir_track_to_chan_seg(rr_graph_builder, layer, from_track, to_chan,

vpr/src/route/rr_graph_generation/rr_graph_sg.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ class RRGraphView;
1111
struct t_bottleneck_link;
1212

1313
/**
14-
* @brief builds the extra length-0 CHANX nodes to handle 3D custom switchblocks edges in the RR graph.
14+
* @brief Builds CHANZ nodes to handle 3D switchblock edges in the RR graph.
1515
* @param rr_graph_builder RRGraphBuilder data structure which allows data modification on a routing resource graph
1616
* @param x_coord switch block x_coordinate
1717
* @param y_coord switch block y-coordinate
18+
* @param interdie_3d_links 3D wires and their connectivity specification for the given location.
1819
* @param const_index_offset index to the correct node type for RR node cost initialization
1920
*/
2021
void build_inter_die_3d_rr_chan(RRGraphBuilder& rr_graph_builder,

0 commit comments

Comments
 (0)