Skip to content

Commit 1a0f388

Browse files
authored
Merge branch 'master' into packer-feasible-candidates-list-to-priority-queue
2 parents 8de3926 + 6da8915 commit 1a0f388

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+4097
-1752
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
==========
2+
Connection Router
3+
==========
4+
5+
ConnectionRouter
6+
---------
7+
.. doxygenfile:: connection_router.h
8+
:project: vpr
9+
10+
SerialConnectionRouter
11+
----------
12+
.. doxygenclass:: SerialConnectionRouter
13+
:project: vpr
14+
15+
ParallelConnectionRouter
16+
----------
17+
.. doxygenclass:: ParallelConnectionRouter
18+
:project: vpr

doc/src/api/vprinternals/vpr_router.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ VPR Router
99

1010
router_heap
1111
router_lookahead
12+
router_connection_router

doc/src/vpr/command_line_usage.rst

Lines changed: 152 additions & 32 deletions
Large diffs are not rendered by default.

utils/route_diag/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static void do_one_route(const Netlist<>& net_list,
9797
segment_inf,
9898
is_flat);
9999

100-
ConnectionRouter<FourAryHeap> router(
100+
SerialConnectionRouter<FourAryHeap> router(
101101
device_ctx.grid,
102102
*router_lookahead,
103103
device_ctx.rr_graph.rr_nodes(),

vpr/src/analytical_place/full_legalizer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ void APPack::legalize(const PartialPlacement& p_placement) {
520520
// Run the Packer stage with the flat placement as a hint.
521521
try_pack(vpr_setup_.PackerOpts,
522522
vpr_setup_.AnalysisOpts,
523+
vpr_setup_.APOpts,
523524
arch_,
524525
vpr_setup_.PackerRRGraph,
525526
prepacker_,

vpr/src/base/SetupVPR.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,12 @@ static void SetupRouterOpts(const t_options& Options, t_router_opts* RouterOpts)
431431
RouterOpts->astar_fac = Options.astar_fac;
432432
RouterOpts->astar_offset = Options.astar_offset;
433433
RouterOpts->router_profiler_astar_fac = Options.router_profiler_astar_fac;
434+
RouterOpts->enable_parallel_connection_router = Options.enable_parallel_connection_router;
435+
RouterOpts->post_target_prune_fac = Options.post_target_prune_fac;
436+
RouterOpts->post_target_prune_offset = Options.post_target_prune_offset;
437+
RouterOpts->multi_queue_num_threads = Options.multi_queue_num_threads;
438+
RouterOpts->multi_queue_num_queues = Options.multi_queue_num_queues;
439+
RouterOpts->multi_queue_direct_draining = Options.multi_queue_direct_draining;
434440
RouterOpts->bb_factor = Options.bb_factor;
435441
RouterOpts->criticality_exp = Options.criticality_exp;
436442
RouterOpts->max_criticality = Options.max_criticality;
@@ -550,6 +556,7 @@ void SetupAPOpts(const t_options& options,
550556
apOpts.full_legalizer_type = options.ap_full_legalizer.value();
551557
apOpts.detailed_placer_type = options.ap_detailed_placer.value();
552558
apOpts.ap_timing_tradeoff = options.ap_timing_tradeoff.value();
559+
apOpts.appack_max_dist_th = options.appack_max_dist_th.value();
553560
apOpts.log_verbosity = options.ap_verbosity.value();
554561
}
555562

@@ -570,15 +577,12 @@ void SetupPackerOpts(const t_options& Options,
570577
PackerOpts->doPacking = STAGE_DO;
571578
}
572579

573-
//TODO: document?
574-
PackerOpts->global_clocks = true; /* DEFAULT */
575-
576580
PackerOpts->allow_unrelated_clustering = Options.allow_unrelated_clustering;
577581
PackerOpts->connection_driven = Options.connection_driven_clustering;
578582
PackerOpts->timing_driven = Options.timing_driven_clustering;
579583
PackerOpts->cluster_seed_type = Options.cluster_seed_type;
580-
PackerOpts->alpha = Options.alpha_clustering;
581-
PackerOpts->beta = Options.beta_clustering;
584+
PackerOpts->timing_gain_weight = Options.timing_gain_weight;
585+
PackerOpts->connection_gain_weight = Options.connection_gain_weight;
582586
PackerOpts->pack_verbosity = Options.pack_verbosity;
583587
PackerOpts->enable_pin_feasibility_filter = Options.enable_clustering_pin_feasibility_filter;
584588
PackerOpts->balance_block_type_utilization = Options.balance_block_type_utilization;
@@ -588,13 +592,10 @@ void SetupPackerOpts(const t_options& Options,
588592
PackerOpts->high_fanout_threshold = Options.pack_high_fanout_threshold;
589593
PackerOpts->transitive_fanout_threshold = Options.pack_transitive_fanout_threshold;
590594
PackerOpts->feasible_block_array_size = Options.pack_feasible_block_array_size;
591-
PackerOpts->use_attraction_groups = Options.use_attraction_groups;
592595

593596
PackerOpts->device_layout = Options.device_layout;
594597

595598
PackerOpts->timing_update_type = Options.timing_update_type;
596-
PackerOpts->pack_num_moves = Options.pack_num_moves;
597-
PackerOpts->pack_move_type = Options.pack_move_type;
598599
}
599600

600601
static void SetupNetlistOpts(const t_options& Options, t_netlist_opts& NetlistOpts) {

vpr/src/base/ShowSetup.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,12 @@ static void ShowRouterOpts(const t_router_opts& RouterOpts) {
379379
VTR_LOG("RouterOpts.astar_fac: %f\n", RouterOpts.astar_fac);
380380
VTR_LOG("RouterOpts.astar_offset: %f\n", RouterOpts.astar_offset);
381381
VTR_LOG("RouterOpts.router_profiler_astar_fac: %f\n", RouterOpts.router_profiler_astar_fac);
382+
VTR_LOG("RouterOpts.enable_parallel_connection_router: %s\n", RouterOpts.enable_parallel_connection_router ? "true" : "false");
383+
VTR_LOG("RouterOpts.post_target_prune_fac: %f\n", RouterOpts.post_target_prune_fac);
384+
VTR_LOG("RouterOpts.post_target_prune_offset: %f\n", RouterOpts.post_target_prune_offset);
385+
VTR_LOG("RouterOpts.multi_queue_num_threads: %d\n", RouterOpts.multi_queue_num_threads);
386+
VTR_LOG("RouterOpts.multi_queue_num_queues: %d\n", RouterOpts.multi_queue_num_queues);
387+
VTR_LOG("RouterOpts.multi_queue_direct_draining: %s\n", RouterOpts.multi_queue_direct_draining ? "true" : "false");
382388
VTR_LOG("RouterOpts.criticality_exp: %f\n", RouterOpts.criticality_exp);
383389
VTR_LOG("RouterOpts.max_criticality: %f\n", RouterOpts.max_criticality);
384390
VTR_LOG("RouterOpts.init_wirelength_abort_threshold: %f\n", RouterOpts.init_wirelength_abort_threshold);
@@ -732,8 +738,8 @@ static void ShowPackerOpts(const t_packer_opts& PackerOpts) {
732738
} else {
733739
VPR_FATAL_ERROR(VPR_ERROR_UNKNOWN, "Unknown packer allow_unrelated_clustering\n");
734740
}
735-
VTR_LOG("PackerOpts.alpha_clustering: %f\n", PackerOpts.alpha);
736-
VTR_LOG("PackerOpts.beta_clustering: %f\n", PackerOpts.beta);
741+
VTR_LOG("PackerOpts.timing_gain_weight: %f\n", PackerOpts.timing_gain_weight);
742+
VTR_LOG("PackerOpts.connection_gain_weight: %f\n", PackerOpts.connection_gain_weight);
737743
VTR_LOG("PackerOpts.cluster_seed_type: ");
738744
switch (PackerOpts.cluster_seed_type) {
739745
case e_cluster_seed::TIMING:
@@ -758,7 +764,6 @@ static void ShowPackerOpts(const t_packer_opts& PackerOpts) {
758764
VPR_FATAL_ERROR(VPR_ERROR_UNKNOWN, "Unknown packer cluster_seed_type\n");
759765
}
760766
VTR_LOG("PackerOpts.connection_driven: %s", (PackerOpts.connection_driven ? "true\n" : "false\n"));
761-
VTR_LOG("PackerOpts.global_clocks: %s", (PackerOpts.global_clocks ? "true\n" : "false\n"));
762767
VTR_LOG("PackerOpts.timing_driven: %s", (PackerOpts.timing_driven ? "true\n" : "false\n"));
763768
VTR_LOG("PackerOpts.target_external_pin_util: %s", vtr::join(PackerOpts.target_external_pin_util, " ").c_str());
764769
VTR_LOG("\n");

vpr/src/base/read_options.cpp

Lines changed: 87 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,6 +1945,31 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
19451945
.default_value("0.5")
19461946
.show_in(argparse::ShowIn::HELP_ONLY);
19471947

1948+
ap_grp.add_argument(args.appack_max_dist_th, "--appack_max_dist_th")
1949+
.help(
1950+
"Sets the maximum candidate distance thresholds for the logical block types"
1951+
"used by APPack. APPack uses the primitive-level placement produced by the"
1952+
"global placer to cluster primitives together. APPack uses the thresholds"
1953+
"here to ignore primitives which are too far away from the cluster being formed."
1954+
"\n"
1955+
"When this option is set to auto, VPR will select good values for these"
1956+
"thresholds based on the primitives contained within each logical block type."
1957+
"\n"
1958+
"Using this option, the user can set the maximum candidate distance threshold"
1959+
"of logical block types to something else. The strings passed in by the user"
1960+
"should be of the form <regex>:<float>,<float> where the regex string is"
1961+
"used to match the name of the logical block type to set, the first float"
1962+
"is a scaling term, and the second float is an offset. The threshold will"
1963+
"be set to max(scale * (W + H), offset), where W and H are the width and height"
1964+
"of the device. This allows the user to specify a threshold based on the"
1965+
"size of the device, while also preventing the number from going below offset"
1966+
"When multiple strings are provided, the thresholds are set from left to right,"
1967+
"and any logical block types which have been unset will be set to their auto"
1968+
"values.")
1969+
.nargs('+')
1970+
.default_value({"auto"})
1971+
.show_in(argparse::ShowIn::HELP_ONLY);
1972+
19481973
ap_grp.add_argument<int>(args.ap_verbosity, "--ap_verbosity")
19491974
.help(
19501975
"Controls how verbose the AP flow's log messages will be. Higher "
@@ -1972,14 +1997,14 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
19721997
.default_value("auto")
19731998
.show_in(argparse::ShowIn::HELP_ONLY);
19741999

1975-
pack_grp.add_argument(args.alpha_clustering, "--alpha_clustering")
2000+
pack_grp.add_argument(args.timing_gain_weight, "--timing_gain_weight")
19762001
.help(
19772002
"Parameter that weights the optimization of timing vs area. 0.0 focuses solely on"
19782003
" area, 1.0 solely on timing.")
19792004
.default_value("0.75")
19802005
.show_in(argparse::ShowIn::HELP_ONLY);
19812006

1982-
pack_grp.add_argument(args.beta_clustering, "--beta_clustering")
2007+
pack_grp.add_argument(args.connection_gain_weight, "--connection_gain_weight")
19832008
.help(
19842009
"Parameter that weights the absorption of small nets vs signal sharing."
19852010
" 0.0 focuses solely on sharing, 1.0 solely on small net absoprtion."
@@ -2101,24 +2126,6 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
21012126
.default_value("2")
21022127
.show_in(argparse::ShowIn::HELP_ONLY);
21032128

2104-
pack_grp.add_argument<bool, ParseOnOff>(args.use_attraction_groups, "--use_attraction_groups")
2105-
.help("Whether attraction groups are used to make it easier to pack primitives in the same floorplan region together.")
2106-
.default_value("on")
2107-
.show_in(argparse::ShowIn::HELP_ONLY);
2108-
2109-
pack_grp.add_argument(args.pack_num_moves, "--pack_num_moves")
2110-
.help(
2111-
"The number of moves that can be tried in packing stage")
2112-
.default_value("100000")
2113-
.show_in(argparse::ShowIn::HELP_ONLY);
2114-
2115-
pack_grp.add_argument(args.pack_move_type, "--pack_move_type")
2116-
.help(
2117-
"The move type used in packing."
2118-
"The available values are: randomSwap, semiDirectedSwap, semiDirectedSameTypeSwap")
2119-
.default_value("semiDirectedSwap")
2120-
.show_in(argparse::ShowIn::HELP_ONLY);
2121-
21222129
auto& place_grp = parser.add_argument_group("placement options");
21232130

21242131
place_grp.add_argument(args.Seed, "--seed")
@@ -2716,6 +2723,66 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
27162723
.default_value("1.2")
27172724
.show_in(argparse::ShowIn::HELP_ONLY);
27182725

2726+
route_timing_grp.add_argument<bool, ParseOnOff>(args.enable_parallel_connection_router, "--enable_parallel_connection_router")
2727+
.help(
2728+
"Controls whether the MultiQueue-based parallel connection router is used during a single connection"
2729+
" routing. When enabled, the parallel connection router accelerates the path search for individual"
2730+
" source-sink connections using multi-threading without altering the net routing order.")
2731+
.default_value("off")
2732+
.show_in(argparse::ShowIn::HELP_ONLY);
2733+
2734+
route_timing_grp.add_argument(args.post_target_prune_fac, "--post_target_prune_fac")
2735+
.help(
2736+
"Controls the post-target pruning heuristic calculation in the parallel connection router."
2737+
" This parameter is used as a multiplicative factor applied to the VPR heuristic"
2738+
" (not guaranteed to be admissible, i.e., might over-predict the cost to the sink)"
2739+
" to calculate the 'stopping heuristic' when pruning nodes after the target has been"
2740+
" reached. The 'stopping heuristic' must be admissible for the path search algorithm"
2741+
" to guarantee optimal paths and be deterministic. Values of this parameter are"
2742+
" architecture-specific and have to be empirically found."
2743+
" This parameter has no effect if --enable_parallel_connection_router is not set.")
2744+
.default_value("1.2")
2745+
.show_in(argparse::ShowIn::HELP_ONLY);
2746+
2747+
route_timing_grp.add_argument(args.post_target_prune_offset, "--post_target_prune_offset")
2748+
.help(
2749+
"Controls the post-target pruning heuristic calculation in the parallel connection router."
2750+
" This parameter is used as a subtractive offset together with --post_target_prune_fac"
2751+
" to apply an affine transformation on the VPR heuristic to calculate the 'stopping"
2752+
" heuristic'. The 'stopping heuristic' must be admissible for the path search"
2753+
" algorithm to guarantee optimal paths and be deterministic. Values of this"
2754+
" parameter are architecture-specific and have to be empirically found."
2755+
" This parameter has no effect if --enable_parallel_connection_router is not set.")
2756+
.default_value("0.0")
2757+
.show_in(argparse::ShowIn::HELP_ONLY);
2758+
2759+
route_timing_grp.add_argument<int>(args.multi_queue_num_threads, "--multi_queue_num_threads")
2760+
.help(
2761+
"Controls the number of threads used by MultiQueue-based parallel connection router."
2762+
" If not explicitly specified, defaults to 1, implying the parallel connection router"
2763+
" works in 'serial' mode using only one main thread to route."
2764+
" This parameter has no effect if --enable_parallel_connection_router is not set.")
2765+
.default_value("1")
2766+
.show_in(argparse::ShowIn::HELP_ONLY);
2767+
2768+
route_timing_grp.add_argument<int>(args.multi_queue_num_queues, "--multi_queue_num_queues")
2769+
.help(
2770+
"Controls the number of queues used by MultiQueue in the parallel connection router."
2771+
" Must be set >= 2. A common configuration for this parameter is the number of threads"
2772+
" used by MultiQueue * 4 (the number of queues per thread)."
2773+
" This parameter has no effect if --enable_parallel_connection_router is not set.")
2774+
.default_value("2")
2775+
.show_in(argparse::ShowIn::HELP_ONLY);
2776+
2777+
route_timing_grp.add_argument<bool, ParseOnOff>(args.multi_queue_direct_draining, "--multi_queue_direct_draining")
2778+
.help(
2779+
"Controls whether to enable queue draining optimization for MultiQueue-based parallel connection"
2780+
" router. When enabled, queues can be emptied quickly by draining all elements if no further"
2781+
" solutions need to be explored in the path search to guarantee optimality or determinism after"
2782+
" reaching the target. This parameter has no effect if --enable_parallel_connection_router is not set.")
2783+
.default_value("off")
2784+
.show_in(argparse::ShowIn::HELP_ONLY);
2785+
27192786
route_timing_grp.add_argument(args.max_criticality, "--max_criticality")
27202787
.help(
27212788
"Sets the maximum fraction of routing cost derived from delay (vs routability) for any net."

vpr/src/base/read_options.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,15 @@ struct t_options {
102102
argparse::ArgValue<e_ap_partial_legalizer> ap_partial_legalizer;
103103
argparse::ArgValue<e_ap_full_legalizer> ap_full_legalizer;
104104
argparse::ArgValue<e_ap_detailed_placer> ap_detailed_placer;
105+
argparse::ArgValue<std::vector<std::string>> appack_max_dist_th;
105106
argparse::ArgValue<int> ap_verbosity;
106107
argparse::ArgValue<float> ap_timing_tradeoff;
107108

108109
/* Clustering options */
109110
argparse::ArgValue<bool> connection_driven_clustering;
110111
argparse::ArgValue<e_unrelated_clustering> allow_unrelated_clustering;
111-
argparse::ArgValue<float> alpha_clustering;
112-
argparse::ArgValue<float> beta_clustering;
112+
argparse::ArgValue<float> timing_gain_weight;
113+
argparse::ArgValue<float> connection_gain_weight;
113114
argparse::ArgValue<bool> timing_driven_clustering;
114115
argparse::ArgValue<e_cluster_seed> cluster_seed_type;
115116
argparse::ArgValue<bool> enable_clustering_pin_feasibility_filter;
@@ -120,9 +121,6 @@ struct t_options {
120121
argparse::ArgValue<int> pack_feasible_block_array_size;
121122
argparse::ArgValue<std::vector<std::string>> pack_high_fanout_threshold;
122123
argparse::ArgValue<int> pack_verbosity;
123-
argparse::ArgValue<bool> use_attraction_groups;
124-
argparse::ArgValue<int> pack_num_moves;
125-
argparse::ArgValue<std::string> pack_move_type;
126124
/* Placement options */
127125
argparse::ArgValue<int> Seed;
128126
argparse::ArgValue<bool> ShowPlaceTiming;
@@ -233,6 +231,12 @@ struct t_options {
233231
argparse::ArgValue<float> astar_fac;
234232
argparse::ArgValue<float> astar_offset;
235233
argparse::ArgValue<float> router_profiler_astar_fac;
234+
argparse::ArgValue<bool> enable_parallel_connection_router;
235+
argparse::ArgValue<float> post_target_prune_fac;
236+
argparse::ArgValue<float> post_target_prune_offset;
237+
argparse::ArgValue<int> multi_queue_num_threads;
238+
argparse::ArgValue<int> multi_queue_num_queues;
239+
argparse::ArgValue<bool> multi_queue_direct_draining;
236240
argparse::ArgValue<float> max_criticality;
237241
argparse::ArgValue<float> criticality_exp;
238242
argparse::ArgValue<float> router_init_wirelength_abort_threshold;

vpr/src/base/vpr_api.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ bool vpr_pack(t_vpr_setup& vpr_setup, const t_arch& arch) {
658658
vpr_setup.PackerOpts.device_layout,
659659
vpr_setup.AnalysisOpts);
660660

661-
return try_pack(vpr_setup.PackerOpts, vpr_setup.AnalysisOpts,
661+
return try_pack(vpr_setup.PackerOpts, vpr_setup.AnalysisOpts, vpr_setup.APOpts,
662662
arch,
663663
vpr_setup.PackerRRGraph,
664664
prepacker,
@@ -1400,8 +1400,7 @@ bool vpr_analysis_flow(const Netlist<>& net_list,
14001400
}
14011401

14021402
std::string post_routing_packing_output_file_name = vpr_setup.PackerOpts.output_file + ".post_routing";
1403-
write_packing_results_to_xml(vpr_setup.PackerOpts.global_clocks,
1404-
Arch.architecture_id,
1403+
write_packing_results_to_xml(Arch.architecture_id,
14051404
post_routing_packing_output_file_name.c_str());
14061405
} else {
14071406
VTR_LOG_WARN("Synchronization between packing and routing results is not applied due to illegal circuit implementation\n");

0 commit comments

Comments
 (0)