Skip to content

Commit

Permalink
Merge pull request #2492 from verilog-to-routing/router_lookahead_fil…
Browse files Browse the repository at this point in the history
…e_extension

Router lookahead file extension
  • Loading branch information
vaughnbetz authored Feb 23, 2024
2 parents 109c5ad + 375ce09 commit e5af061
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 54 deletions.
12 changes: 6 additions & 6 deletions doc/src/vpr/command_line_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ Use the options below to override this default naming behaviour.

.. option:: --read_rr_graph <file>

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``.
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``.

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.

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

.. option:: --read_router_lookahead <file>

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

.. option:: --write_router_lookahead <file>

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

.. option:: --read_placement_delay_lookup <file>

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

.. option:: --write_placement_delay_lookup <file>

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

Writes out the the placement chosen by the initial placement algorithm to the specified file
Writes out the the placement chosen by the initial placement algorithm to the specified file.

.. option:: --outfile_prefix <string>

Expand Down
2 changes: 1 addition & 1 deletion vpr/src/route/router_lookahead_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ void MapLookahead::write(const std::string& file_name) const {
}
dump_readable_router_lookahead_map(file_name, wire_cost_map_size, get_wire_cost_entry);
} else {
VTR_ASSERT(vtr::check_file_name_extension(file_name, ".capnp"));
VTR_ASSERT(vtr::check_file_name_extension(file_name, ".capnp") || vtr::check_file_name_extension(file_name, ".bin"));
write_router_lookahead(file_name);
}
}
Expand Down
58 changes: 11 additions & 47 deletions vpr/src/route/router_lookahead_map_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static void dijkstra_flood_to_ipins(RRNodeId node, util::t_chan_ipins_delays& ch
* @param itile
* @return Return the maximum ptc number of the SOURCE/OPINs of a tile type
*/
static int get_tile_src_opin_max_ptc_from_rr_graph(int itile);
static int get_tile_src_opin_max_ptc(int itile);

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

Expand Down Expand Up @@ -338,7 +338,7 @@ t_src_opin_delays compute_router_src_opin_lookahead(bool is_flat) {

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

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

static int get_tile_src_opin_max_ptc_from_rr_graph(int itile) {
static int get_tile_src_opin_max_ptc(int itile) {
const auto& device_ctx = g_vpr_ctx.device();
const auto& physical_tile = device_ctx.physical_tile_types[itile];
const auto& rr_graph = device_ctx.rr_graph;
const int num_layers = device_ctx.grid.get_num_layers();
int max_ptc = OPEN;
int max_ptc = 0;

// Find a layer that has instances of the tile type
int tile_layer_num = OPEN;
for (int layer_num = 0; layer_num < num_layers; layer_num++) {
if (device_ctx.grid.num_instances(&physical_tile, layer_num) > 0) {
tile_layer_num = layer_num;
break;
// Output pin
for (const auto& class_inf: physical_tile.class_inf) {
if (class_inf.type != e_pin_type::DRIVER) {
continue;
}
}

if (tile_layer_num == OPEN) {
VTR_LOG_WARN("Found no sample locations for %s\n",
physical_tile.name);
max_ptc = OPEN;
} else {
for (e_rr_type rr_type : {SOURCE, OPIN}) {
t_physical_tile_loc sample_loc(OPEN, OPEN, OPEN);
sample_loc = pick_sample_tile(tile_layer_num, &physical_tile, sample_loc);

if (sample_loc.x == OPEN && sample_loc.y == OPEN && sample_loc.layer_num == OPEN) {
//No untried instances of the current tile type left
VTR_LOG_WARN("Found no sample locations for %s in %s\n",
rr_node_typename[rr_type],
physical_tile.name);
return OPEN;
}

const std::vector<RRNodeId>& rr_nodes_at_loc = device_ctx.rr_graph.node_lookup().find_grid_nodes_at_all_sides(sample_loc.layer_num,
sample_loc.x,
sample_loc.y,
rr_type);
for (RRNodeId node_id : rr_nodes_at_loc) {
int ptc = rr_graph.node_ptc_num(node_id);
// For the time being, we decide to not let the lookahead explore the node inside the clusters
if (!is_inter_cluster_node(&physical_tile,
rr_type,
ptc)) {
continue;
}

if (ptc >= max_ptc) {
max_ptc = ptc;
}
for (const auto& pin_ptc : class_inf.pinlist) {
if (pin_ptc > max_ptc) {
max_ptc = pin_ptc;
}
}
}
Expand Down

0 comments on commit e5af061

Please sign in to comment.