Skip to content

Commit e425616

Browse files
Merge pull request #3137 from verilog-to-routing/ap_high_fanout_net_thresholding
High Fanout Net Thresholding in AP to Speed Up Solver
2 parents 6b099ad + 5d5ccb9 commit e425616

File tree

10 files changed

+50
-8
lines changed

10 files changed

+50
-8
lines changed

doc/src/vpr/command_line_usage.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,14 @@ Analytical Placement is generally split into three stages:
13241324

13251325
**Default:** ``auto``
13261326

1327+
.. option:: --ap_high_fanout_threshold <int>
1328+
1329+
Defines the threshold for high fanout nets within AP flow.
1330+
1331+
Ignores the nets that have higher fanouts than the threshold for the analytical solver.
1332+
1333+
**Default:** ``256``
1334+
13271335
.. option:: --ap_verbosity <int>
13281336

13291337
Controls the verbosity of the AP flow output.

vpr/src/analytical_place/analytical_placement_flow.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ void run_analytical_placement_flow(t_vpr_setup& vpr_setup) {
170170
const AtomNetlist& atom_nlist = g_vpr_ctx.atom().netlist();
171171
const DeviceContext& device_ctx = g_vpr_ctx.device();
172172
const UserPlaceConstraints& constraints = g_vpr_ctx.floorplanning().constraints;
173+
const t_ap_opts& ap_opts = vpr_setup.APOpts;
173174

174175
// Run the prepacker
175176
const Prepacker prepacker(atom_nlist, device_ctx.arch->models, device_ctx.logical_block_types);
@@ -178,7 +179,8 @@ void run_analytical_placement_flow(t_vpr_setup& vpr_setup) {
178179
// prepacker.
179180
APNetlist ap_netlist = gen_ap_netlist_from_atoms(atom_nlist,
180181
prepacker,
181-
constraints);
182+
constraints,
183+
ap_opts.ap_high_fanout_threshold);
182184
print_ap_netlist_stats(ap_netlist);
183185

184186
// Pre-compute the pre-clustering timing delays. This object will be passed
@@ -208,7 +210,6 @@ void run_analytical_placement_flow(t_vpr_setup& vpr_setup) {
208210
}
209211

210212
// Run the Global Placer.
211-
const t_ap_opts& ap_opts = vpr_setup.APOpts;
212213
PartialPlacement p_placement = run_global_placer(ap_opts,
213214
atom_nlist,
214215
ap_netlist,

vpr/src/analytical_place/gen_ap_netlist_from_atoms.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
APNetlist gen_ap_netlist_from_atoms(const AtomNetlist& atom_netlist,
2626
const Prepacker& prepacker,
27-
const UserPlaceConstraints& constraints) {
27+
const UserPlaceConstraints& constraints,
28+
int high_fanout_threshold) {
2829
// Create a scoped timer for reading the atom netlist.
2930
vtr::ScopedStartFinishTimer timer("Read Atom Netlist to AP Netlist");
3031

@@ -115,6 +116,7 @@ APNetlist gen_ap_netlist_from_atoms(const AtomNetlist& atom_netlist,
115116
// - a global net
116117
// - connected to 1 or fewer unique blocks
117118
// - connected to only fixed blocks
119+
// - having fanout higher than threshold
118120
for (APNetId ap_net_id : ap_netlist.nets()) {
119121
// Is the net ignored for placement, if so mark as ignored for AP.
120122
const std::string& net_name = ap_netlist.net_name(ap_net_id);
@@ -153,6 +155,13 @@ APNetlist gen_ap_netlist_from_atoms(const AtomNetlist& atom_netlist,
153155
ap_netlist.set_net_is_ignored(ap_net_id, true);
154156
continue;
155157
}
158+
// If fanout number of the net is higher than the threshold, mark as ignored for AP.
159+
size_t num_pins = ap_netlist.net_pins(ap_net_id).size();
160+
VTR_ASSERT_DEBUG(num_pins > 1);
161+
if (num_pins - 1 > static_cast<size_t>(high_fanout_threshold)) {
162+
ap_netlist.set_net_is_ignored(ap_net_id, true);
163+
continue;
164+
}
156165
}
157166
ap_netlist.compress();
158167

vpr/src/analytical_place/gen_ap_netlist_from_atoms.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ class UserPlaceConstraints;
1616
/**
1717
* @brief Use the results from prepacking the atom netlist to generate an APNetlist.
1818
*
19-
* @param atom_netlist The atom netlist for the input design.
20-
* @param prepacker The prepacker, initialized on the provided atom netlist.
21-
* @param constraints The placement constraints on the Atom blocks, provided
22-
* by the user.
19+
* @param atom_netlist The atom netlist for the input design.
20+
* @param prepacker The prepacker, initialized on the provided atom netlist.
21+
* @param constraints The placement constraints on the Atom blocks, provided
22+
* by the user.
23+
* @param high_fanout_threshold The threshold above which nets with higher fanout will
24+
* be ignored.
2325
*
2426
* @return An APNetlist object, generated from the prepacker results.
2527
*/
2628
APNetlist gen_ap_netlist_from_atoms(const AtomNetlist& atom_netlist,
2729
const Prepacker& prepacker,
28-
const UserPlaceConstraints& constraints);
30+
const UserPlaceConstraints& constraints,
31+
int high_fanout_threshold);

vpr/src/base/CheckSetup.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ void CheckSetup(const t_packer_opts& packer_opts,
8888
"ap_timing_tradeoff expects a value between 0.0 and 1.0");
8989
}
9090

91+
// Make sure that the high fanout threshold for solver is valid.
92+
if (ap_opts.ap_high_fanout_threshold <= 1) {
93+
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
94+
"ap_high_fanout_threshold should be greater than 1");
95+
}
96+
9197
// TODO: Should we enforce that the size of the device is fixed. This
9298
// goes with ensuring that some blocks are fixed.
9399
}

vpr/src/base/SetupVPR.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ void SetupAPOpts(const t_options& options,
558558
apOpts.full_legalizer_type = options.ap_full_legalizer.value();
559559
apOpts.detailed_placer_type = options.ap_detailed_placer.value();
560560
apOpts.ap_timing_tradeoff = options.ap_timing_tradeoff.value();
561+
apOpts.ap_high_fanout_threshold = options.ap_high_fanout_threshold.value();
561562
apOpts.appack_max_dist_th = options.appack_max_dist_th.value();
562563
apOpts.num_threads = options.num_workers.value();
563564
apOpts.log_verbosity = options.ap_verbosity.value();

vpr/src/base/ShowSetup.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ static void ShowAnalyticalPlacerOpts(const t_ap_opts& APOpts) {
656656
}
657657

658658
VTR_LOG("AnalyticalPlacerOpts.ap_timing_tradeoff: %f\n", APOpts.ap_timing_tradeoff);
659+
VTR_LOG("AnalyticalPlacerOpts.ap_high_fanout_threshold: %d\n", APOpts.ap_high_fanout_threshold);
659660
VTR_LOG("AnalyticalPlacerOpts.log_verbosity: %d\n", APOpts.log_verbosity);
660661
}
661662

vpr/src/base/read_options.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,6 +1950,13 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
19501950
.default_value("0.5")
19511951
.show_in(argparse::ShowIn::HELP_ONLY);
19521952

1953+
ap_grp.add_argument<int>(args.ap_high_fanout_threshold, "--ap_high_fanout_threshold")
1954+
.help(
1955+
"Defines the threshold for high fanout nets within AP flow.\n"
1956+
"Ignores the nets that have higher fanouts than the threshold for the analytical solver.")
1957+
.default_value("256")
1958+
.show_in(argparse::ShowIn::HELP_ONLY);
1959+
19531960
ap_grp.add_argument(args.appack_max_dist_th, "--appack_max_dist_th")
19541961
.help(
19551962
"Sets the maximum candidate distance thresholds for the logical block types"

vpr/src/base/read_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ struct t_options {
106106
argparse::ArgValue<std::vector<std::string>> appack_max_dist_th;
107107
argparse::ArgValue<int> ap_verbosity;
108108
argparse::ArgValue<float> ap_timing_tradeoff;
109+
argparse::ArgValue<int> ap_high_fanout_threshold;
109110
argparse::ArgValue<bool> ap_generate_mass_report;
110111

111112
/* Clustering options */

vpr/src/base/vpr_types.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,9 @@ struct t_placer_opts {
11021102
* @param ap_timing_tradeoff
11031103
* A trade-off parameter used to decide how focused the AP flow
11041104
* should be on optimizing timing over wirelength.
1105+
* @param ap_high_fanout_threshold;
1106+
* The threshold to ignore nets with higher fanout than that
1107+
* value while constructing the solver.
11051108
* @param appack_max_dist_th
11061109
* Array of string passed by the user to configure the max candidate
11071110
* distance thresholds.
@@ -1126,6 +1129,8 @@ struct t_ap_opts {
11261129

11271130
float ap_timing_tradeoff;
11281131

1132+
int ap_high_fanout_threshold;
1133+
11291134
std::vector<std::string> appack_max_dist_th;
11301135

11311136
unsigned num_threads;

0 commit comments

Comments
 (0)