Skip to content

Commit afcd8e2

Browse files
committed
remove global traceback (won't compile)
1 parent 50a4e67 commit afcd8e2

33 files changed

+363
-912
lines changed

vpr/src/base/place_and_route.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,9 @@ t_chan_width init_chan(int cfactor, t_chan_width_dist chan_width_dist, t_graph_t
497497
}
498498

499499
/**
500-
* @brief Computes the channel width and adjusts it to be an an even number if unidirectional
500+
* @brief Computes the channel width and adjusts it to be an an even number if unidirectional
501501
* since unidirectional graphs need to have paired wires.
502-
*
502+
*
503503
* @param cfactor Channel width factor: multiplier on the channel width distribution (usually the number of tracks in the widest channel).
504504
* @param chan_dist Channel width distribution.
505505
* @param x The distance (between 0 and 1) we are across the chip.

vpr/src/base/read_route.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
#include "read_route.h"
4747
#include "binary_heap.h"
4848

49+
#include "route_tree_timing.h"
50+
#include "t_trace.h"
51+
4952
/*************Functions local to this module*************/
5053
static void process_route(std::ifstream& fp, const char* filename, int& lineno);
5154
static void process_nodes(std::ifstream& fp, ClusterNetId inet, const char* filename, int& lineno);
@@ -214,7 +217,7 @@ static void process_nets(std::ifstream& fp, ClusterNetId inet, std::string name,
214217
return;
215218
}
216219

217-
static void process_nodes(std::ifstream& fp, ClusterNetId inet, const char* filename, int& lineno) {
220+
static void process_nodes(std::ifstream& fp, ClusterNetId inet, const char* filename, int& lineno) { // T_TRACE_USER
218221
/* Not a global net. Goes through every node and add it into trace.head*/
219222

220223
auto& cluster_ctx = g_vpr_ctx.mutable_clustering();
@@ -223,7 +226,8 @@ static void process_nodes(std::ifstream& fp, ClusterNetId inet, const char* file
223226
auto& route_ctx = g_vpr_ctx.mutable_routing();
224227
auto& place_ctx = g_vpr_ctx.placement();
225228

226-
t_trace* tptr = route_ctx.trace[(const ParentNetId&)inet].head;
229+
t_trace* head_ptr = alloc_trace_data();
230+
t_trace* tptr = alloc_trace_data();
227231

228232
/*remember the position of the last line in order to go back*/
229233
std::streampos oldpos = fp.tellg();
@@ -376,12 +380,12 @@ static void process_nodes(std::ifstream& fp, ClusterNetId inet, const char* file
376380

377381
/* Allocate and load correct values to trace.head*/
378382
if (node_count == 0) {
379-
route_ctx.trace[(const ParentNetId&)inet].head = alloc_trace_data();
380-
route_ctx.trace[(const ParentNetId&)inet].head->index = inode;
381-
route_ctx.trace[(const ParentNetId&)inet].head->net_pin_index = net_pin_index;
382-
route_ctx.trace[(const ParentNetId&)inet].head->iswitch = switch_id;
383-
route_ctx.trace[(const ParentNetId&)inet].head->next = nullptr;
384-
tptr = route_ctx.trace[(const ParentNetId&)inet].head;
383+
head_ptr = alloc_trace_data();
384+
head_ptr->index = inode;
385+
head_ptr->net_pin_index = net_pin_index;
386+
head_ptr->iswitch = switch_id;
387+
head_ptr->next = nullptr;
388+
tptr = head_ptr;
385389
node_count++;
386390
} else {
387391
tptr->next = alloc_trace_data();
@@ -396,6 +400,9 @@ static void process_nodes(std::ifstream& fp, ClusterNetId inet, const char* file
396400
/*stores last line so can easily go back to read*/
397401
oldpos = fp.tellg();
398402
}
403+
404+
/* Convert to route_tree after reading */
405+
route_ctx.current_rt[inet] = traceback_to_route_tree(head_ptr);
399406
}
400407

401408
/**

vpr/src/base/stats.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
#include "timing_util.h"
2828
#include "tatum/TimingReporter.hpp"
2929

30+
#include "route_tree_timing.h"
31+
#include "t_trace.h"
32+
3033
/********************** Subroutines local to this module *********************/
3134

3235
static void load_channel_occupancies(const Netlist<>& net_list,
@@ -261,7 +264,7 @@ static void load_channel_occupancies(const Netlist<>& net_list,
261264
if (net_list.net_is_ignored(net_id) && net_list.net_sinks(net_id).size() != 0)
262265
continue;
263266

264-
tptr = route_ctx.trace[net_id].head;
267+
tptr = traceback_from_route_tree_recurr(NULL, NULL, route_ctx.current_rt[net_id]).first;
265268
while (tptr != nullptr) {
266269
inode = tptr->index;
267270
rr_type = rr_graph.node_type(RRNodeId(inode));
@@ -309,7 +312,7 @@ void get_num_bends_and_length(ParentNetId inet, int* bends_ptr, int* len_ptr, in
309312
length = 0;
310313
segments = 0;
311314

312-
prevptr = route_ctx.trace[inet].head; /* Should always be SOURCE. */
315+
prevptr = traceback_from_route_tree_recurr(NULL, NULL, route_ctx.current_rt[inet]).first; /* Should always be SOURCE. */
313316
if (prevptr == nullptr) {
314317
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
315318
"in get_num_bends_and_length: net #%lu has no traceback.\n", size_t(inet));

vpr/src/base/t_trace.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#pragma once
2+
3+
/**
4+
* @brief Basic element used to store the traceback (routing) of each net.
5+
*
6+
* @param index Array index (ID) of this routing resource node.
7+
* @param net_pin_index: Net pin index associated with the node. This value
8+
* ranges from 1 to fanout [1..num_pins-1]. For cases when
9+
* different speed paths are taken to the same SINK for
10+
* different pins, node index cannot uniquely identify
11+
* each SINK, so the net pin index guarantees an unique
12+
* identification for each SINK node. For non-SINK nodes
13+
* and for SINK nodes with no associated net pin index
14+
* (i.e. special SINKs like the source of a clock tree
15+
* which do not correspond to an actual netlist connection),
16+
* the value for this member should be set to OPEN (-1).
17+
* @param iswitch Index of the switch type used to go from this rr_node to
18+
* the next one in the routing. OPEN if there is no next node
19+
* (i.e. this node is the last one (a SINK) in a branch of the
20+
* net's routing).
21+
* @param next Pointer to the next traceback element in this route.
22+
*/
23+
struct t_trace {
24+
t_trace* next;
25+
int index;
26+
int net_pin_index = -1;
27+
//int net_pin_index = OPEN;
28+
short iswitch;
29+
};

vpr/src/base/vpr_api.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
#include "iostream"
9797

9898
#ifdef VPR_USE_TBB
99+
#define TBB_PREVIEW_GLOBAL_CONTROL 1
99100
# include <tbb/task_arena.h>
100101
# include <tbb/global_control.h>
101102
#endif
@@ -1182,7 +1183,7 @@ static void free_placement() {
11821183

11831184
static void free_routing() {
11841185
auto& routing_ctx = g_vpr_ctx.mutable_routing();
1185-
routing_ctx.trace.clear();
1186+
routing_ctx.current_rt.clear();
11861187
routing_ctx.trace_nodes.clear();
11871188
routing_ctx.net_rr_terminals.clear();
11881189
routing_ctx.rr_blk_source.clear();
@@ -1219,7 +1220,6 @@ void vpr_free_all(const Netlist<>& net_list,
12191220
if (vpr_setup.RouterOpts.doRouting) {
12201221
free_route_structs();
12211222
}
1222-
free_trace_structs(net_list);
12231223
vpr_free_vpr_data_structures(Arch, vpr_setup);
12241224
}
12251225

@@ -1375,7 +1375,7 @@ void vpr_analysis(const Netlist<>& net_list,
13751375

13761376
//Check the first index to see if a pointer exists
13771377
//TODO: Implement a better error check
1378-
if (route_ctx.trace.empty()) {
1378+
if (route_ctx.current_rt.empty()) {
13791379
VPR_FATAL_ERROR(VPR_ERROR_ANALYSIS, "No routing loaded -- can not perform post-routing analysis");
13801380
}
13811381

vpr/src/base/vpr_context.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "device_grid.h"
2323
#include "clock_network_builders.h"
2424
#include "clock_connection_builders.h"
25-
#include "route_traceback.h"
25+
#include "route_tree_type.h"
2626
#include "router_lookahead.h"
2727
#include "place_macro.h"
2828
#include "compressed_grid.h"
@@ -61,7 +61,7 @@ struct AtomContext : public Context {
6161
********************************************************************/
6262
/**
6363
* @brief constructor
64-
*
64+
*
6565
* In the constructor initialize the list of pack molecules to nullptr and defines a custom deletor for it
6666
*/
6767
AtomContext()
@@ -75,15 +75,15 @@ struct AtomContext : public Context {
7575

7676
/**
7777
* @brief The molecules associated with each atom block.
78-
*
78+
*
7979
* This map is loaded in the pre-packing stage and freed at the very end of vpr flow run.
8080
* The pointers in this multimap is shared with list_of_pack_molecules.
8181
*/
8282
std::multimap<AtomBlockId, t_pack_molecule*> atom_molecules;
8383

8484
/**
8585
* @brief A linked list of all the packing molecules that are loaded in pre-packing stage.
86-
*
86+
*
8787
* Is is useful in freeing the pack molecules at the destructor of the Atom context using free_pack_molecules.
8888
*/
8989
std::unique_ptr<t_pack_molecule, decltype(&free_pack_molecules)> list_of_pack_molecules;
@@ -188,12 +188,12 @@ struct DeviceContext : public Context {
188188
///@brief Reverse look-up from RR node to non-configurably connected node set (index into rr_nonconf_node_sets)
189189
std::unordered_map<int, int> rr_node_to_non_config_node_set;
190190

191-
/* A writeable view of routing resource graph to be the ONLY database
191+
/* A writeable view of routing resource graph to be the ONLY database
192192
* for routing resource graph builder functions.
193193
*/
194194
RRGraphBuilder rr_graph_builder{};
195195

196-
/* A read-only view of routing resource graph to be the ONLY database
196+
/* A read-only view of routing resource graph to be the ONLY database
197197
* for client functions: GUI, placer, router, timing analyzer etc.
198198
*/
199199
RRGraphView rr_graph{rr_graph_builder.rr_nodes(), rr_graph_builder.node_lookup(), rr_graph_builder.rr_node_metadata(), rr_graph_builder.rr_edge_metadata(), rr_indexed_data, rr_rc_data, rr_graph_builder.rr_segments(), rr_graph_builder.rr_switch()};
@@ -302,7 +302,7 @@ struct ClusteringContext : public Context {
302302

303303
/**
304304
* @brief State relating to helper data structure using in the clustering stage
305-
*
305+
*
306306
* This should contain helper data structures that are useful in the clustering/packing stage.
307307
* They are encapsulated here as they are useful in clustering and reclustering algorithms that may be used
308308
* in packing or placement stages.
@@ -393,7 +393,7 @@ struct PlacementContext : public Context {
393393
*/
394394
struct RoutingContext : public Context {
395395
/* [0..num_nets-1] of linked list start pointers. Defines the routing. */
396-
vtr::vector<ParentNetId, t_traceback> trace;
396+
vtr::vector<ParentNetId, t_rt_node*> current_rt;
397397

398398
vtr::vector<ParentNetId, std::unordered_set<int>> trace_nodes;
399399

@@ -487,33 +487,33 @@ struct FloorplanningContext : public Context {
487487
*/
488488
struct NocContext : public Context {
489489
/**
490-
* @brief A model of the NoC
490+
* @brief A model of the NoC
491491
*
492492
* Contains all the routers and links that make up the NoC. The routers contain
493493
* information regarding the physical tile positions they represent. The links
494494
* define the connections between every router (topology) and also metrics that describe its
495-
* "usage".
496-
*
495+
* "usage".
497496
*
498-
* The NoC model is created once from the architecture file description.
497+
*
498+
* The NoC model is created once from the architecture file description.
499499
*/
500500
NocStorage noc_model;
501501

502502
/**
503-
* @brief Stores all the communication happening between routers in the NoC
503+
* @brief Stores all the communication happening between routers in the NoC
504+
*
505+
* Contains all of the traffic flows that ddescribe which pairs of logical routers are communicating and also some metrics and constraints on the data transfer between the two routers.
504506
*
505-
* Contains all of the traffic flows that ddescribe which pairs of logical routers are communicating and also some metrics and constraints on the data transfer between the two routers.
506-
*
507507
*
508508
* This is created from a user supplied .flows file.
509509
*/
510510
NocTrafficFlows noc_traffic_flows_storage;
511511

512512
/**
513513
* @brief Contains the packet routing algorithm used by the NoC.
514-
*
514+
*
515515
* This should be used to route traffic flows within the NoC.
516-
*
516+
*
517517
* This is created from a user supplied command line option "--noc_routing_algorithm"
518518
*/
519519
NocRouting* noc_flows_router;

vpr/src/base/vpr_types.h

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,17 +1425,17 @@ struct t_det_routing_arch {
14251425
* Note that this index will store the index of the segment
14261426
* relative to its **parallel** segment types, not all segments
14271427
* as stored in device_ctx. Look in rr_graph.cpp: build_rr_graph
1428-
* for details but here is an example: say our segment_inf_vec in
1428+
* for details but here is an example: say our segment_inf_vec in
14291429
* device_ctx is as follows: [seg_a_x, seg_b_x, seg_a_y, seg_b_y]
1430-
* when building the rr_graph, static segment_inf_vectors will be
1431-
* created for each direction, thus you will have the following
1432-
* 2 vectors: X_vec =[seg_a_x,seg_b_x] and Y_vec = [seg_a_y,seg_b_y].
1433-
* As a result, e.g. seg_b_y::index == 1 (index in Y_vec)
1430+
* when building the rr_graph, static segment_inf_vectors will be
1431+
* created for each direction, thus you will have the following
1432+
* 2 vectors: X_vec =[seg_a_x,seg_b_x] and Y_vec = [seg_a_y,seg_b_y].
1433+
* As a result, e.g. seg_b_y::index == 1 (index in Y_vec)
14341434
* and != 3 (index in device_ctx segment_inf_vec).
1435-
* @param abs_index index is relative to the segment_inf vec as stored in device_ctx.
1436-
* Note that the above vector is **unifies** both x-parallel and
1437-
* y-parallel segments and is loaded up originally in read_xml_arch_file.cpp
1438-
*
1435+
* @param abs_index index is relative to the segment_inf vec as stored in device_ctx.
1436+
* Note that the above vector is **unifies** both x-parallel and
1437+
* y-parallel segments and is loaded up originally in read_xml_arch_file.cpp
1438+
*
14391439
* @param type_name_ptr pointer to name of the segment type this track belongs
14401440
* to. points to the appropriate name in s_segment_inf
14411441
*/
@@ -1519,7 +1519,7 @@ class t_chan_seg_details {
15191519
const t_seg_details* seg_detail_ = nullptr;
15201520
};
15211521

1522-
/* Defines a 3-D array of t_chan_seg_details data structures (one per-each horizontal and vertical channel)
1522+
/* Defines a 3-D array of t_chan_seg_details data structures (one per-each horizontal and vertical channel)
15231523
* once allocated in rr_graph2.cpp, is can be accessed like: [0..grid.width()][0..grid.height()][0..num_tracks-1]
15241524
*/
15251525
typedef vtr::NdMatrix<t_chan_seg_details, 3> t_chan_details;
@@ -1538,33 +1538,6 @@ constexpr bool is_pin(e_rr_type type) { return (type == IPIN || type == OPIN); }
15381538
constexpr bool is_chan(e_rr_type type) { return (type == CHANX || type == CHANY); }
15391539
constexpr bool is_src_sink(e_rr_type type) { return (type == SOURCE || type == SINK); }
15401540

1541-
/**
1542-
* @brief Basic element used to store the traceback (routing) of each net.
1543-
*
1544-
* @param index Array index (ID) of this routing resource node.
1545-
* @param net_pin_index: Net pin index associated with the node. This value
1546-
* ranges from 1 to fanout [1..num_pins-1]. For cases when
1547-
* different speed paths are taken to the same SINK for
1548-
* different pins, node index cannot uniquely identify
1549-
* each SINK, so the net pin index guarantees an unique
1550-
* identification for each SINK node. For non-SINK nodes
1551-
* and for SINK nodes with no associated net pin index
1552-
* (i.e. special SINKs like the source of a clock tree
1553-
* which do not correspond to an actual netlist connection),
1554-
* the value for this member should be set to OPEN (-1).
1555-
* @param iswitch Index of the switch type used to go from this rr_node to
1556-
* the next one in the routing. OPEN if there is no next node
1557-
* (i.e. this node is the last one (a SINK) in a branch of the
1558-
* net's routing).
1559-
* @param next Pointer to the next traceback element in this route.
1560-
*/
1561-
struct t_trace {
1562-
t_trace* next;
1563-
int index;
1564-
int net_pin_index = OPEN;
1565-
short iswitch;
1566-
};
1567-
15681541
/**
15691542
* @brief Extra information about each rr_node needed only during routing
15701543
* (i.e. during the maze expansion).
@@ -1708,12 +1681,12 @@ struct t_power_opts {
17081681
};
17091682

17101683
/** @brief Channel width data
1711-
* @param max= Maximum channel width between x_max and y_max.
1712-
* @param x_min= Minimum channel width of horizontal channels. Initialized when init_chan() is invoked in rr_graph2.cpp
1713-
* @param y_min= Same as above but for vertical channels.
1714-
* @param x_max= Maximum channel width of horiozntal channels. Initialized when init_chan() is invoked in rr_graph2.cpp
1715-
* @param y_max= Same as above but for vertical channels.
1716-
* @param x_list= Stores the channel width of all horizontal channels and thus goes from [0..grid.height()]
1684+
* @param max= Maximum channel width between x_max and y_max.
1685+
* @param x_min= Minimum channel width of horizontal channels. Initialized when init_chan() is invoked in rr_graph2.cpp
1686+
* @param y_min= Same as above but for vertical channels.
1687+
* @param x_max= Maximum channel width of horiozntal channels. Initialized when init_chan() is invoked in rr_graph2.cpp
1688+
* @param y_max= Same as above but for vertical channels.
1689+
* @param x_list= Stores the channel width of all horizontal channels and thus goes from [0..grid.height()]
17171690
* (imagine a 2D Cartesian grid with horizontal lines starting at every grid point on a line parallel to the y-axis)
17181691
* @param y_list= Stores the channel width of all verical channels and thus goes from [0..grid.width()]
17191692
* (imagine a 2D Cartesian grid with vertical lines starting at every grid point on a line parallel to the x-axis)

0 commit comments

Comments
 (0)