Skip to content

Commit 6f3ee69

Browse files
committed
2 parents 66ef6c6 + e5af061 commit 6f3ee69

File tree

5 files changed

+59
-54
lines changed

5 files changed

+59
-54
lines changed

doc/src/vpr/command_line_usage.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ Use the options below to override this default naming behaviour.
350350

351351
.. option:: --read_rr_graph <file>
352352

353-
Reads in the routing resource graph named <file> loads it for use during the placement and routing stages. Expects a file extension of either ``.xml`` and ``.bin``.
353+
Reads in the routing resource graph named <file> loads it for use during the placement and routing stages. Expects a file extension of either ``.xml`` or ``.bin``.
354354

355355
The routing resource graph overthrows all the architecture definitions regarding switches, nodes, and edges. Other information such as grid information, block types, and segment information are matched with the architecture file to ensure accuracy.
356356

@@ -368,22 +368,22 @@ Use the options below to override this default naming behaviour.
368368

369369
.. option:: --read_router_lookahead <file>
370370

371-
Reads the lookahead data from the specified file instead of computing it.
371+
Reads the lookahead data from the specified file instead of computing it. Expects a file extension of either ``.capnp`` or ``.bin``.
372372

373373
.. option:: --write_router_lookahead <file>
374374

375-
Writes the lookahead data to the specified file.
375+
Writes the lookahead data to the specified file. Accepted file extensions are ``.capnp``, ``.bin``, and ``.csv``.
376376

377377
.. option:: --read_placement_delay_lookup <file>
378378

379-
Reads the placement delay lookup from the specified file instead of computing it.
379+
Reads the placement delay lookup from the specified file instead of computing it. Expects a file extension of either ``.capnp`` or ``.bin``.
380380

381381
.. option:: --write_placement_delay_lookup <file>
382382

383-
Writes the placement delay lookup to the specified file.
383+
Writes the placement delay lookup to the specified file. Expects a file extension of either ``.capnp`` or ``.bin``.
384384
.. option:: --write_initial_place_file <file>
385385

386-
Writes out the the placement chosen by the initial placement algorithm to the specified file
386+
Writes out the the placement chosen by the initial placement algorithm to the specified file.
387387

388388
.. option:: --outfile_prefix <string>
389389

vpr/src/route/route_common.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,28 @@ void pathfinder_update_acc_cost_and_overuse_info(float acc_fac, OveruseInfo& ove
190190
auto& device_ctx = g_vpr_ctx.device();
191191
const auto& rr_graph = device_ctx.rr_graph;
192192
auto& route_ctx = g_vpr_ctx.mutable_routing();
193+
194+
#ifdef VPR_USE_TBB
195+
tbb::combinable<size_t> overused_nodes(0), total_overuse(0), worst_overuse(0);
196+
tbb::parallel_for_each(rr_graph.nodes().begin(), rr_graph.nodes().end(), [&](RRNodeId rr_id) {
197+
int overuse = route_ctx.rr_node_route_inf[rr_id].occ() - rr_graph.node_capacity(rr_id);
198+
199+
// If overused, update the acc_cost and add this node to the overuse info
200+
// If not, do nothing
201+
if (overuse > 0) {
202+
route_ctx.rr_node_route_inf[rr_id].acc_cost += overuse * acc_fac;
203+
204+
++overused_nodes.local();
205+
total_overuse.local() += overuse;
206+
worst_overuse.local() = std::max(worst_overuse.local(), size_t(overuse));
207+
}
208+
});
209+
210+
// Update overuse info
211+
overuse_info.overused_nodes = overused_nodes.combine(std::plus<size_t>());
212+
overuse_info.total_overuse = total_overuse.combine(std::plus<size_t>());
213+
overuse_info.worst_overuse = worst_overuse.combine([](size_t a, size_t b) { return std::max(a, b); });
214+
#else
193215
size_t overused_nodes = 0, total_overuse = 0, worst_overuse = 0;
194216

195217
for (const RRNodeId& rr_id : rr_graph.nodes()) {
@@ -210,6 +232,7 @@ void pathfinder_update_acc_cost_and_overuse_info(float acc_fac, OveruseInfo& ove
210232
overuse_info.overused_nodes = overused_nodes;
211233
overuse_info.total_overuse = total_overuse;
212234
overuse_info.worst_overuse = worst_overuse;
235+
#endif
213236
}
214237

215238
/** Update pathfinder cost of all nodes rooted at rt_node, including rt_node itself */

vpr/src/route/route_net.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,23 @@ WirelengthInfo calculate_wirelength_info(const Netlist<>& net_list, size_t avail
251251

252252
auto& route_ctx = g_vpr_ctx.routing();
253253

254+
#ifdef VPR_USE_TBB
255+
tbb::combinable<size_t> thread_used_wirelength(0);
256+
257+
tbb::parallel_for_each(net_list.nets().begin(), net_list.nets().end(), [&](ParentNetId net_id) {
258+
if (!net_list.net_is_ignored(net_id)
259+
&& net_list.net_sinks(net_id).size() != 0 /* Globals don't count. */
260+
&& route_ctx.route_trees[net_id]) {
261+
int bends, wirelength, segments;
262+
bool is_absorbed;
263+
get_num_bends_and_length(net_id, &bends, &wirelength, &segments, &is_absorbed);
264+
265+
thread_used_wirelength.local() += wirelength;
266+
}
267+
});
268+
269+
used_wirelength = thread_used_wirelength.combine(std::plus<size_t>());
270+
#else
254271
for (auto net_id : net_list.nets()) {
255272
if (!net_list.net_is_ignored(net_id)
256273
&& net_list.net_sinks(net_id).size() != 0 /* Globals don't count. */
@@ -262,6 +279,7 @@ WirelengthInfo calculate_wirelength_info(const Netlist<>& net_list, size_t avail
262279
used_wirelength += wirelength;
263280
}
264281
}
282+
#endif
265283

266284
return WirelengthInfo(available_wirelength, used_wirelength);
267285
}

vpr/src/route/router_lookahead_map.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ void MapLookahead::write(const std::string& file_name) const {
463463
}
464464
dump_readable_router_lookahead_map(file_name, wire_cost_map_size, get_wire_cost_entry);
465465
} else {
466-
VTR_ASSERT(vtr::check_file_name_extension(file_name, ".capnp"));
466+
VTR_ASSERT(vtr::check_file_name_extension(file_name, ".capnp") || vtr::check_file_name_extension(file_name, ".bin"));
467467
write_router_lookahead(file_name);
468468
}
469469
}

vpr/src/route/router_lookahead_map_utils.cpp

Lines changed: 11 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static void dijkstra_flood_to_ipins(RRNodeId node, util::t_chan_ipins_delays& ch
2626
* @param itile
2727
* @return Return the maximum ptc number of the SOURCE/OPINs of a tile type
2828
*/
29-
static int get_tile_src_opin_max_ptc_from_rr_graph(int itile);
29+
static int get_tile_src_opin_max_ptc(int itile);
3030

3131
static t_physical_tile_loc pick_sample_tile(int layer_num, t_physical_tile_type_ptr tile_type, t_physical_tile_loc prev);
3232

@@ -338,7 +338,7 @@ t_src_opin_delays compute_router_src_opin_lookahead(bool is_flat) {
338338

339339
// Get the maximum OPIN ptc for each tile type to reserve src_opin_delays
340340
for (int itile = 0; itile < (int)device_ctx.physical_tile_types.size(); itile++) {
341-
tile_max_ptc[itile] = get_tile_src_opin_max_ptc_from_rr_graph(itile);
341+
tile_max_ptc[itile] = get_tile_src_opin_max_ptc(itile);
342342
}
343343

344344
// Resize src_opin_delays to accomodate enough ptc and layer
@@ -1114,55 +1114,19 @@ static void dijkstra_flood_to_ipins(RRNodeId node, util::t_chan_ipins_delays& ch
11141114
}
11151115
}
11161116

1117-
static int get_tile_src_opin_max_ptc_from_rr_graph(int itile) {
1117+
static int get_tile_src_opin_max_ptc(int itile) {
11181118
const auto& device_ctx = g_vpr_ctx.device();
11191119
const auto& physical_tile = device_ctx.physical_tile_types[itile];
1120-
const auto& rr_graph = device_ctx.rr_graph;
1121-
const int num_layers = device_ctx.grid.get_num_layers();
1122-
int max_ptc = OPEN;
1120+
int max_ptc = 0;
11231121

1124-
// Find a layer that has instances of the tile type
1125-
int tile_layer_num = OPEN;
1126-
for (int layer_num = 0; layer_num < num_layers; layer_num++) {
1127-
if (device_ctx.grid.num_instances(&physical_tile, layer_num) > 0) {
1128-
tile_layer_num = layer_num;
1129-
break;
1122+
// Output pin
1123+
for (const auto& class_inf: physical_tile.class_inf) {
1124+
if (class_inf.type != e_pin_type::DRIVER) {
1125+
continue;
11301126
}
1131-
}
1132-
1133-
if (tile_layer_num == OPEN) {
1134-
VTR_LOG_WARN("Found no sample locations for %s\n",
1135-
physical_tile.name);
1136-
max_ptc = OPEN;
1137-
} else {
1138-
for (e_rr_type rr_type : {SOURCE, OPIN}) {
1139-
t_physical_tile_loc sample_loc(OPEN, OPEN, OPEN);
1140-
sample_loc = pick_sample_tile(tile_layer_num, &physical_tile, sample_loc);
1141-
1142-
if (sample_loc.x == OPEN && sample_loc.y == OPEN && sample_loc.layer_num == OPEN) {
1143-
//No untried instances of the current tile type left
1144-
VTR_LOG_WARN("Found no sample locations for %s in %s\n",
1145-
rr_node_typename[rr_type],
1146-
physical_tile.name);
1147-
return OPEN;
1148-
}
1149-
1150-
const std::vector<RRNodeId>& rr_nodes_at_loc = device_ctx.rr_graph.node_lookup().find_grid_nodes_at_all_sides(sample_loc.layer_num,
1151-
sample_loc.x,
1152-
sample_loc.y,
1153-
rr_type);
1154-
for (RRNodeId node_id : rr_nodes_at_loc) {
1155-
int ptc = rr_graph.node_ptc_num(node_id);
1156-
// For the time being, we decide to not let the lookahead explore the node inside the clusters
1157-
if (!is_inter_cluster_node(&physical_tile,
1158-
rr_type,
1159-
ptc)) {
1160-
continue;
1161-
}
1162-
1163-
if (ptc >= max_ptc) {
1164-
max_ptc = ptc;
1165-
}
1127+
for (const auto& pin_ptc : class_inf.pinlist) {
1128+
if (pin_ptc > max_ptc) {
1129+
max_ptc = pin_ptc;
11661130
}
11671131
}
11681132
}

0 commit comments

Comments
 (0)