Skip to content

Add check route option #1288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion vpr/src/base/SetupVPR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,15 @@ static void SetupRouterOpts(const t_options& Options, t_router_opts* RouterOpts)
RouterOpts->initial_timing = Options.router_initial_timing;
RouterOpts->update_lower_bound_delays = Options.router_update_lower_bound_delays;
RouterOpts->first_iteration_timing_report_file = Options.router_first_iteration_timing_report_file;

RouterOpts->strict_checks = Options.strict_checks;

RouterOpts->write_router_lookahead = Options.write_router_lookahead;
RouterOpts->read_router_lookahead = Options.read_router_lookahead;

RouterOpts->router_heap = Options.router_heap;
RouterOpts->exit_after_first_routing_iteration = Options.exit_after_first_routing_iteration;

RouterOpts->check_route = Options.check_route;
}

static void SetupAnnealSched(const t_options& Options,
Expand Down
44 changes: 44 additions & 0 deletions vpr/src/base/read_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,41 @@ struct ParseRouterHeap {
}
};

struct ParseCheckRoute {
ConvertedValue<e_check_route_option> from_str(std::string str) {
ConvertedValue<e_check_route_option> conv_value;
if (str == "off")
conv_value.set_value(e_check_route_option::OFF);
else if (str == "quick")
conv_value.set_value(e_check_route_option::QUICK);
else if (str == "full")
conv_value.set_value(e_check_route_option::FULL);
else {
std::stringstream msg;
msg << "Invalid conversion from '" << str << "' to e_check_route_option (expected one of: " << argparse::join(default_choices(), ", ") << ")";
conv_value.set_error(msg.str());
}
return conv_value;
}

ConvertedValue<std::string> to_str(e_check_route_option val) {
ConvertedValue<std::string> conv_value;
if (val == e_check_route_option::OFF)
conv_value.set_value("off");
else if (val == e_check_route_option::QUICK)
conv_value.set_value("quick");
else {
VTR_ASSERT(val == e_check_route_option::FULL);
conv_value.set_value("full");
}
return conv_value;
}

std::vector<std::string> default_choices() {
return {"off", "quick", "full"};
}
};

struct ParsePlaceEfforScaling {
ConvertedValue<e_place_effort_scaling> from_str(std::string str) {
ConvertedValue<e_place_effort_scaling> conv_value;
Expand Down Expand Up @@ -1887,6 +1922,15 @@ argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& arg
.default_value("off")
.show_in(argparse::ShowIn::HELP_ONLY);

route_timing_grp.add_argument<e_check_route_option, ParseCheckRoute>(args.check_route, "--check_route")
.help(
"Options to run check route in three different modes.\n"
" * off : check route is completely disabled.\n"
" * quick : runs check route with slow checks disabled.\n"
" * full : runs the full check route step.\n")
.default_value("quick")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd lean towards keeping the default for this option as full. That ensures we do the most thorough checking by default (which is what we want, for example in regular VTR). Particularly if #1289 narrows the run-time difference between quick and full.

If someone (e.g. symbiflow) want to use quick, I feel that should be an end-user/flow override.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, moved the option default back to full

.show_in(argparse::ShowIn::HELP_ONLY);

route_timing_grp.add_argument(args.router_debug_net, "--router_debug_net")
.help(
"Controls when router debugging is enabled for nets.\n"
Expand Down
1 change: 1 addition & 0 deletions vpr/src/base/read_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ struct t_options {
argparse::ArgValue<int> min_incremental_reroute_fanout;
argparse::ArgValue<bool> read_rr_edge_metadata;
argparse::ArgValue<bool> exit_after_first_routing_iteration;
argparse::ArgValue<e_check_route_option> check_route;

/* Timing-driven router options only */
argparse::ArgValue<float> astar_fac;
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/base/vpr_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ RouteStatus vpr_route_flow(t_vpr_setup& vpr_setup, const t_arch& arch) {
std::string graphics_msg;
if (route_status.success()) {
//Sanity check the routing
check_route(router_opts.route_type);
check_route(router_opts.route_type, router_opts.check_route);
get_serial_num();

//Update status
Expand Down
8 changes: 8 additions & 0 deletions vpr/src/base/vpr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ enum class e_balance_block_type_util {
AUTO
};

enum class e_check_route_option {
OFF,
QUICK,
FULL
};

/* Selection algorithm for selecting next seed */
enum class e_cluster_seed {
TIMING,
Expand Down Expand Up @@ -999,6 +1005,8 @@ struct t_router_opts {

e_heap_type router_heap;
bool exit_after_first_routing_iteration;

e_check_route_option check_route;
};

struct t_analysis_opts {
Expand Down
31 changes: 26 additions & 5 deletions vpr/src/route/check_route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "vtr_assert.h"
#include "vtr_log.h"
#include "vtr_memory.h"
#include "vtr_time.h"

#include "vpr_types.h"
#include "vpr_error.h"
Expand All @@ -27,18 +28,24 @@ static void reset_flags(ClusterNetId inet, bool* connected_to_route);
static void check_locally_used_clb_opins(const t_clb_opins_used& clb_opins_used_locally,
enum e_route_type route_type);

static void check_all_non_configurable_edges();
static bool check_non_configurable_edges(ClusterNetId net, const t_non_configurable_rr_sets& non_configurable_rr_sets);
static void check_net_for_stubs(ClusterNetId net);

/************************ Subroutine definitions ****************************/

void check_route(enum e_route_type route_type) {
void check_route(enum e_route_type route_type, e_check_route_option check_route_option) {
/* This routine checks that a routing: (1) Describes a properly *
* connected path for each net, (2) this path connects all the *
* pins spanned by that net, and (3) that no routing resources are *
* oversubscribed (the occupancy of everything is recomputed from *
* scratch). */

if (check_route_option == e_check_route_option::OFF) {
VTR_LOG_WARN("The user disabled the check route step.");
return;
}

int max_pins, inode, prev_node;
unsigned int ipin;
bool valid, connects;
Expand Down Expand Up @@ -66,8 +73,6 @@ void check_route(enum e_route_type route_type) {

check_locally_used_clb_opins(route_ctx.clb_opins_used_locally, route_type);

auto non_configurable_rr_sets = identify_non_configurable_rr_sets();

auto connected_to_route = std::make_unique<bool[]>(device_ctx.rr_nodes.size());
std::fill_n(connected_to_route.get(), device_ctx.rr_nodes.size(), false);

Expand Down Expand Up @@ -154,14 +159,18 @@ void check_route(enum e_route_type route_type) {
}
}

check_non_configurable_edges(net_id, non_configurable_rr_sets);

check_net_for_stubs(net_id);

reset_flags(net_id, connected_to_route.get());

} /* End for each net */

if (check_route_option == e_check_route_option::FULL) {
check_all_non_configurable_edges();
} else {
VTR_ASSERT(check_route_option == e_check_route_option::QUICK);
}

VTR_LOG("Completed routing consistency check successfully.\n");
VTR_LOG("\n");
}
Expand Down Expand Up @@ -622,6 +631,18 @@ static void check_node_and_range(int inode, enum e_route_type route_type) {
check_rr_node(inode, route_type, device_ctx);
}

//Checks that all non-configurable edges are in a legal configuration
//This check is slow, so it has been moved out of check_route()
static void check_all_non_configurable_edges() {
vtr::ScopedStartFinishTimer timer("Checking to ensure non-configurable edges are legal");
auto non_configurable_rr_sets = identify_non_configurable_rr_sets();
auto& cluster_ctx = g_vpr_ctx.clustering();

for (auto net_id : cluster_ctx.clb_nlist.nets()) {
check_non_configurable_edges(net_id, non_configurable_rr_sets);
}
}

//Checks that the specified routing is legal with respect to non-configurable edges
//
//For routing to be legal if *any* non-configurable edge is used, so must *all*
Expand Down
3 changes: 2 additions & 1 deletion vpr/src/route/check_route.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef VPR_CHECK_ROUTE_H
#define VPR_CHECK_ROUTE_H
#include "physical_types.h"
#include "vpr_types.h"
#include "route_common.h"

void check_route(enum e_route_type route_type);
void check_route(enum e_route_type route_type, e_check_route_option check_route_option);

void recompute_occupancy_from_scratch();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
##############################################
# Configuration file for running experiments
##############################################

# Path to directory of circuits to use
circuits_dir=benchmarks/microbenchmarks

# Path to directory of architectures to use
archs_dir=arch/sub_tiles

# Add circuits to list to sweep
circuit_list_add=sub_tiles.blif

# Add architectures to list to sweep
arch_list_add=sub_tiles.xml

# Parse info and how to parse
parse_file=vpr_standard.txt

# How to parse QoR info
qor_parse_file=qor_standard.txt

# Pass requirements
pass_requirements_file=pass_requirements.txt

# Script parameters
script_params_common = -starting_stage vpr
script_params_list_add = --check_route full
script_params_list_add = --check_route quick
script_params_list_add = --check_route off
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
arch circuit script_params vtr_flow_elapsed_time error odin_synth_time max_odin_mem abc_depth abc_synth_time abc_cec_time abc_sec_time max_abc_mem ace_time max_ace_mem num_clb num_io num_memories num_mult vpr_status vpr_revision vpr_build_info vpr_compiler vpr_compiled hostname rundir max_vpr_mem num_primary_inputs num_primary_outputs num_pre_packed_nets num_pre_packed_blocks num_netlist_clocks num_post_packed_nets num_post_packed_blocks device_width device_height device_grid_tiles device_limiting_resources device_name pack_time placed_wirelength_est place_time placed_CPD_est placed_setup_TNS_est placed_setup_WNS_est min_chan_width routed_wirelength min_chan_width_route_success_iteration logic_block_area_total logic_block_area_used min_chan_width_routing_area_total min_chan_width_routing_area_per_tile min_chan_width_route_time crit_path_routed_wirelength crit_path_route_success_iteration crit_path_total_nets_routed crit_path_total_connections_routed crit_path_total_heap_pushes crit_path_total_heap_pops critical_path_delay geomean_nonvirtual_intradomain_critical_path_delay setup_TNS setup_WNS hold_TNS hold_WNS crit_path_routing_area_total crit_path_routing_area_per_tile crit_path_route_time
sub_tiles.xml sub_tiles.blif common_--check_route_full 2.51 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 -1 -1 success v8.0.0-rc2-1742-g99cedb888-dirty release IPO VTR_ASSERT_LEVEL=3 GNU 9.2.1 on Linux-4.15.0-88-generic x86_64 2020-04-29T17:35:35 acomodi /data/vtr-symbiflow/vtr_flow/tasks/regression_tests/vtr_reg_strong/strong_check_route_options/run007/sub_tiles.xml/sub_tiles.blif/common_--check_route_full 38548 6 7 19 26 0 19 26 3 3 9 -1 auto 0.00 38 1.71 3.85145 -26.9601 -3.85145 6 19 4 14813.4 192574 -1 -1 0.44 19 4 37 40 4389 2349 3.85145 -1 -26.9601 -3.85145 0 0 -1 -1 0.00
sub_tiles.xml sub_tiles.blif common_--check_route_quick 2.40 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 -1 -1 success v8.0.0-rc2-1742-g99cedb888-dirty release IPO VTR_ASSERT_LEVEL=3 GNU 9.2.1 on Linux-4.15.0-88-generic x86_64 2020-04-29T17:35:35 acomodi /data/vtr-symbiflow/vtr_flow/tasks/regression_tests/vtr_reg_strong/strong_check_route_options/run007/sub_tiles.xml/sub_tiles.blif/common_--check_route_quick 38768 6 7 19 26 0 19 26 3 3 9 -1 auto 0.00 38 1.61 3.85145 -26.9601 -3.85145 6 19 4 14813.4 192574 -1 -1 0.47 19 4 37 40 4389 2349 3.85145 -1 -26.9601 -3.85145 0 0 -1 -1 0.00
sub_tiles.xml sub_tiles.blif common_--check_route_off 2.39 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 -1 -1 success v8.0.0-rc2-1742-g99cedb888-dirty release IPO VTR_ASSERT_LEVEL=3 GNU 9.2.1 on Linux-4.15.0-88-generic x86_64 2020-04-29T17:35:35 acomodi /data/vtr-symbiflow/vtr_flow/tasks/regression_tests/vtr_reg_strong/strong_check_route_options/run007/sub_tiles.xml/sub_tiles.blif/common_--check_route_off 38556 6 7 19 26 0 19 26 3 3 9 -1 auto 0.00 38 1.62 3.85145 -26.9601 -3.85145 6 19 4 14813.4 192574 -1 -1 0.48 19 4 37 40 4389 2349 3.85145 -1 -26.9601 -3.85145 0 0 -1 -1 0.00
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ regression_tests/vtr_reg_strong/strong_graphics_commands
regression_tests/vtr_reg_strong/strong_clock_pll
regression_tests/vtr_reg_strong/strong_place_effort_scaling
regression_tests/vtr_reg_strong/strong_sub_tiles
regression_tests/vtr_reg_strong/strong_check_route_options