diff --git a/vpr/src/base/SetupVPR.cpp b/vpr/src/base/SetupVPR.cpp index b1bbacafbaf..5f1d9df7d5d 100644 --- a/vpr/src/base/SetupVPR.cpp +++ b/vpr/src/base/SetupVPR.cpp @@ -373,7 +373,6 @@ 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; @@ -381,6 +380,8 @@ static void SetupRouterOpts(const t_options& Options, t_router_opts* RouterOpts) 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, diff --git a/vpr/src/base/read_options.cpp b/vpr/src/base/read_options.cpp index eb62ecaee1b..aae745a0cc6 100644 --- a/vpr/src/base/read_options.cpp +++ b/vpr/src/base/read_options.cpp @@ -858,6 +858,41 @@ struct ParseRouterHeap { } }; +struct ParseCheckRoute { + ConvertedValue from_str(std::string str) { + ConvertedValue 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 to_str(e_check_route_option val) { + ConvertedValue 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 default_choices() { + return {"off", "quick", "full"}; + } +}; + struct ParsePlaceEfforScaling { ConvertedValue from_str(std::string str) { ConvertedValue conv_value; @@ -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(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("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" diff --git a/vpr/src/base/read_options.h b/vpr/src/base/read_options.h index 30fadf465fa..ea94d5ce592 100644 --- a/vpr/src/base/read_options.h +++ b/vpr/src/base/read_options.h @@ -140,6 +140,7 @@ struct t_options { argparse::ArgValue min_incremental_reroute_fanout; argparse::ArgValue read_rr_edge_metadata; argparse::ArgValue exit_after_first_routing_iteration; + argparse::ArgValue check_route; /* Timing-driven router options only */ argparse::ArgValue astar_fac; diff --git a/vpr/src/base/vpr_api.cpp b/vpr/src/base/vpr_api.cpp index 13e3903cbe6..8038d5e1da4 100644 --- a/vpr/src/base/vpr_api.cpp +++ b/vpr/src/base/vpr_api.cpp @@ -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 diff --git a/vpr/src/base/vpr_types.h b/vpr/src/base/vpr_types.h index a7756c16787..00b460d34d3 100644 --- a/vpr/src/base/vpr_types.h +++ b/vpr/src/base/vpr_types.h @@ -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, @@ -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 { diff --git a/vpr/src/route/check_route.cpp b/vpr/src/route/check_route.cpp index bb3db2321ac..bc244c3b519 100644 --- a/vpr/src/route/check_route.cpp +++ b/vpr/src/route/check_route.cpp @@ -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" @@ -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; @@ -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(device_ctx.rr_nodes.size()); std::fill_n(connected_to_route.get(), device_ctx.rr_nodes.size(), false); @@ -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"); } @@ -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* diff --git a/vpr/src/route/check_route.h b/vpr/src/route/check_route.h index 4ad6075ec4e..bf4b467612d 100644 --- a/vpr/src/route/check_route.h +++ b/vpr/src/route/check_route.h @@ -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(); diff --git a/vtr_flow/tasks/regression_tests/vtr_reg_strong/strong_check_route_options/config/config.txt b/vtr_flow/tasks/regression_tests/vtr_reg_strong/strong_check_route_options/config/config.txt new file mode 100644 index 00000000000..dfbd1c5dcae --- /dev/null +++ b/vtr_flow/tasks/regression_tests/vtr_reg_strong/strong_check_route_options/config/config.txt @@ -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 diff --git a/vtr_flow/tasks/regression_tests/vtr_reg_strong/strong_check_route_options/config/golden_results.txt b/vtr_flow/tasks/regression_tests/vtr_reg_strong/strong_check_route_options/config/golden_results.txt new file mode 100644 index 00000000000..b55eef1110e --- /dev/null +++ b/vtr_flow/tasks/regression_tests/vtr_reg_strong/strong_check_route_options/config/golden_results.txt @@ -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 diff --git a/vtr_flow/tasks/regression_tests/vtr_reg_strong/task_list.txt b/vtr_flow/tasks/regression_tests/vtr_reg_strong/task_list.txt index b92c0927931..2bb7bcb1636 100644 --- a/vtr_flow/tasks/regression_tests/vtr_reg_strong/task_list.txt +++ b/vtr_flow/tasks/regression_tests/vtr_reg_strong/task_list.txt @@ -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