Skip to content

Commit 027b2c5

Browse files
[AP] Properly Inserted AP into VPR Flow
Instead of just riding off of the old place flow, created a custom argument for Analytical Placement (--analytical_place) which will only run the analytical placement flow (skipping over pack and place). Since the device sizing requires the clustered netlist in order to size the grid, this adds a new requirement where the grid size must now be fixed in the architecture file using tje FPGA Grid Layout.
1 parent f1e79e5 commit 027b2c5

File tree

9 files changed

+71
-16
lines changed

9 files changed

+71
-16
lines changed

utils/fasm/src/main.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@ int main(int argc, const char **argv) {
7272
/* Read options, architecture, and circuit netlist */
7373
vpr_init(argc, argv, &Options, &vpr_setup, &Arch);
7474

75-
vpr_setup.PackerOpts.doPacking = STAGE_LOAD;
76-
vpr_setup.PlacerOpts.doPlacement = STAGE_LOAD;
77-
vpr_setup.RouterOpts.doRouting = STAGE_LOAD;
75+
vpr_setup.PackerOpts.doPacking = STAGE_LOAD;
76+
vpr_setup.PlacerOpts.doPlacement = STAGE_LOAD;
77+
vpr_setup.PlacerOpts.doAnalyticalPlacement = STAGE_SKIP;
78+
vpr_setup.RouterOpts.doRouting = STAGE_LOAD;
7879
vpr_setup.RouterOpts.read_rr_edge_metadata = true;
79-
vpr_setup.AnalysisOpts.doAnalysis = STAGE_SKIP;
80+
vpr_setup.AnalysisOpts.doAnalysis = STAGE_SKIP;
8081

8182
bool flow_succeeded = false;
8283
flow_succeeded = vpr_flow(vpr_setup, Arch);

utils/fasm/test/test_fasm.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,12 @@ TEST_CASE("fasm_integration_test", "[fasm]") {
316316
vpr_init(sizeof(argv)/sizeof(argv[0]), argv,
317317
&options, &vpr_setup, &arch);
318318

319-
vpr_setup.PackerOpts.doPacking = STAGE_LOAD;
320-
vpr_setup.PlacerOpts.doPlacement = STAGE_LOAD;
321-
vpr_setup.RouterOpts.doRouting = STAGE_LOAD;
319+
vpr_setup.PackerOpts.doPacking = STAGE_LOAD;
320+
vpr_setup.PlacerOpts.doPlacement = STAGE_LOAD;
321+
vpr_setup.PlacerOpts.doAnalyticalPlacement = STAGE_SKIP;
322+
vpr_setup.RouterOpts.doRouting = STAGE_LOAD;
322323
vpr_setup.RouterOpts.read_rr_edge_metadata = true;
323-
vpr_setup.AnalysisOpts.doAnalysis = STAGE_SKIP;
324+
vpr_setup.AnalysisOpts.doAnalysis = STAGE_SKIP;
324325

325326
bool flow_succeeded = vpr_flow(vpr_setup, arch);
326327
REQUIRE(flow_succeeded == true);

vpr/src/base/CheckSetup.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,28 @@ void CheckSetup(const t_packer_opts& PackerOpts,
6060
NUM_PL_MOVE_TYPES);
6161
}
6262

63+
// Rules for doing analytical placement.
64+
if (PlacerOpts.doAnalyticalPlacement) {
65+
// Make sure that the --place option was not set.
66+
if (PlacerOpts.doPlacement) {
67+
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
68+
"Cannot perform both analytical and non-analytical placement.\n");
69+
}
70+
// Make sure that the --pack option was not set.
71+
if (PackerOpts.doPacking) {
72+
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
73+
"Analytical placement should skip packing.\n");
74+
}
75+
76+
// TODO: Should check that read_vpr_constraint_file is non-empty or
77+
// check within analytical placement that the floorplanning has
78+
// some fixed blocks somewhere. Maybe we can live without fixed
79+
// blocks.
80+
81+
// FIXME: Should we enforce that the size of the device is fixed? Or is
82+
// that defined in the constraints file?
83+
}
84+
6385
if (RouterOpts.doRouting) {
6486
if (!Timing.timing_analysis_enabled
6587
&& (DEMAND_ONLY != RouterOpts.base_cost_type && DEMAND_ONLY_NORMALIZED_LENGTH != RouterOpts.base_cost_type)) {

vpr/src/base/SetupVPR.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,13 @@ void SetupVPR(const t_options* Options,
240240
//do all
241241
if (!Options->do_packing
242242
&& !Options->do_placement
243+
&& !Options->do_analytical_placement
243244
&& !Options->do_routing
244245
&& !Options->do_analysis) {
245246
//run all stages if none specified
246247
PackerOpts->doPacking = STAGE_DO;
247248
PlacerOpts->doPlacement = STAGE_DO;
249+
PlacerOpts->doAnalyticalPlacement = STAGE_SKIP; // AP not default.
248250
RouterOpts->doRouting = STAGE_DO;
249251
AnalysisOpts->doAnalysis = STAGE_AUTO; //Deferred until implementation status known
250252
} else {
@@ -272,6 +274,12 @@ void SetupVPR(const t_options* Options,
272274
PlacerOpts->doPlacement = STAGE_DO;
273275
}
274276

277+
if (Options->do_analytical_placement) {
278+
PackerOpts->doPacking = STAGE_SKIP;
279+
PlacerOpts->doPlacement = STAGE_SKIP;
280+
PlacerOpts->doAnalyticalPlacement = STAGE_DO;
281+
}
282+
275283
if (Options->do_packing) {
276284
PackerOpts->doPacking = STAGE_DO;
277285
}

vpr/src/base/ShowSetup.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <fstream>
2+
#include <tuple>
23

34
#include "vtr_assert.h"
45
#include "vtr_log.h"
@@ -18,6 +19,7 @@ static void ShowPackerOpts(const t_packer_opts& PackerOpts);
1819
static void ShowNetlistOpts(const t_netlist_opts& NetlistOpts);
1920
static void ShowPlacerOpts(const t_placer_opts& PlacerOpts,
2021
const t_annealing_sched& AnnealSched);
22+
static void ShowAnalyticalPlacerOpts(const t_placer_opts& PlacerOpts);
2123
static void ShowRouterOpts(const t_router_opts& RouterOpts);
2224
static void ShowAnalysisOpts(const t_analysis_opts& AnalysisOpts);
2325
static void ShowNocOpts(const t_noc_opts& NocOpts);
@@ -42,6 +44,7 @@ void ShowSetup(const t_vpr_setup& vpr_setup) {
4244

4345
VTR_LOG("Packer: %s\n", (vpr_setup.PackerOpts.doPacking ? "ENABLED" : "DISABLED"));
4446
VTR_LOG("Placer: %s\n", (vpr_setup.PlacerOpts.doPlacement ? "ENABLED" : "DISABLED"));
47+
VTR_LOG("Analytical Placer: %s\n", (vpr_setup.PlacerOpts.doAnalyticalPlacement ? "ENABLED" : "DISABLED"));
4548
VTR_LOG("Router: %s\n", (vpr_setup.RouterOpts.doRouting ? "ENABLED" : "DISABLED"));
4649
VTR_LOG("Analysis: %s\n", (vpr_setup.AnalysisOpts.doAnalysis ? "ENABLED" : "DISABLED"));
4750
VTR_LOG("\n");
@@ -56,6 +59,9 @@ void ShowSetup(const t_vpr_setup& vpr_setup) {
5659
if (vpr_setup.PlacerOpts.doPlacement) {
5760
ShowPlacerOpts(vpr_setup.PlacerOpts, vpr_setup.AnnealSched);
5861
}
62+
if (vpr_setup.PlacerOpts.doAnalyticalPlacement) {
63+
ShowAnalyticalPlacerOpts(vpr_setup.PlacerOpts);
64+
}
5965
if (vpr_setup.RouterOpts.doRouting) {
6066
ShowRouterOpts(vpr_setup.RouterOpts);
6167
}
@@ -678,6 +684,11 @@ static void ShowPlacerOpts(const t_placer_opts& PlacerOpts,
678684
VTR_LOG("\n");
679685
}
680686

687+
static void ShowAnalyticalPlacerOpts(const t_placer_opts& PlacerOpts) {
688+
std::ignore = PlacerOpts;
689+
// Currently nothing to show, but will happen eventually.
690+
}
691+
681692
static void ShowNetlistOpts(const t_netlist_opts& NetlistOpts) {
682693
VTR_LOG("NetlistOpts.abosrb_buffer_luts : %s\n", (NetlistOpts.absorb_buffer_luts) ? "true" : "false");
683694
VTR_LOG("NetlistOpts.sweep_dangling_primary_ios : %s\n", (NetlistOpts.sweep_dangling_primary_ios) ? "true" : "false");
@@ -802,4 +813,4 @@ static void ShowNocOpts(const t_noc_opts& NocOpts) {
802813
VTR_LOG("NocOpts.noc_swap_percentage: %d%%\n", NocOpts.noc_swap_percentage);
803814
VTR_LOG("NocOpts.noc_routing_algorithm: %s\n", NocOpts.noc_placement_file_name.c_str());
804815
VTR_LOG("\n");
805-
}
816+
}

vpr/src/base/read_options.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,11 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
13151315
.action(argparse::Action::STORE_TRUE)
13161316
.default_value("off");
13171317

1318+
stage_grp.add_argument<bool, ParseOnOff>(args.do_analytical_placement, "--analytical_place")
1319+
.help("Run analytical placement")
1320+
.action(argparse::Action::STORE_TRUE)
1321+
.default_value("off");
1322+
13181323
stage_grp.add_argument<bool, ParseOnOff>(args.do_routing, "--route")
13191324
.help("Run routing")
13201325
.action(argparse::Action::STORE_TRUE)

vpr/src/base/read_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ struct t_options {
4545
/* Stage Options */
4646
argparse::ArgValue<bool> do_packing;
4747
argparse::ArgValue<bool> do_placement;
48+
argparse::ArgValue<bool> do_analytical_placement;
4849
argparse::ArgValue<bool> do_routing;
4950
argparse::ArgValue<bool> do_analysis;
5051
argparse::ArgValue<bool> do_power;

vpr/src/base/vpr_api.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
#include "place_constraints.h"
7676
#include "place_util.h"
7777
#include "timing_fail_error.h"
78+
#include "analytical_placement_flow.h"
7879

7980
#include "vpr_constraints_writer.h"
8081

@@ -107,10 +108,6 @@
107108
#include "serverupdate.h"
108109
#endif /* NO_SERVER */
109110

110-
// FIXME: TESTING ONLY
111-
#include "analytical_initial_placer.h"
112-
#include "analytical_placement_flow.h"
113-
114111
/* Local subroutines */
115112
static void free_complex_block_types();
116113

@@ -410,9 +407,13 @@ bool vpr_flow(t_vpr_setup& vpr_setup, t_arch& arch) {
410407
return false; //Unimplementable
411408
}
412409
}
413-
// Placed here for now; however, ideally this should come before pack and place since we do not want these to be performed.
414-
// analytical_placement::initial_place();
415-
run_analytical_placement_flow();
410+
411+
{ //Analytical Place
412+
if (vpr_setup.PlacerOpts.doAnalyticalPlacement == STAGE_DO) {
413+
// TODO: Make this return a bool if the placement was successful or not.
414+
run_analytical_placement_flow();
415+
}
416+
}
416417

417418
bool is_flat = vpr_setup.RouterOpts.flat_routing;
418419
const Netlist<>& router_net_list = is_flat ? (const Netlist<>&)g_vpr_ctx.atom().nlist : (const Netlist<>&)g_vpr_ctx.clustering().clb_nlist;

vpr/src/base/vpr_types.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,10 @@ enum class e_move_type;
12041204
* @param doPlacement
12051205
* True if placement is supposed to be done in the CAD flow.
12061206
* False if otherwise.
1207+
* @param doAnalyticalPlacement
1208+
* True if analytical placement is supposed to be done in the CAD
1209+
* flow.
1210+
* False if otherwise.
12071211
* @param place_constraint_expand
12081212
* Integer value that specifies how far to expand the floorplan
12091213
* region when printing out floorplan constraints based on
@@ -1231,6 +1235,7 @@ struct t_placer_opts {
12311235
int seed;
12321236
float td_place_exp_last;
12331237
e_stage_action doPlacement;
1238+
e_stage_action doAnalyticalPlacement;
12341239
float rlim_escape_fraction;
12351240
std::string move_stats_file;
12361241
int placement_saves_per_temperature;

0 commit comments

Comments
 (0)