Skip to content

Commit 0b40272

Browse files
authored
Merge branch 'master' into rr_graphview_doxygen
2 parents 138ce4a + 13f37a6 commit 0b40272

17 files changed

+187
-11
lines changed

doc/src/arch/reference.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ The valid tags within the ``<layout>`` tag are:
158158

159159
.. note:: At most one ``<auto_layout>`` can be specified.
160160

161+
.. _fixed_arch_grid_layout:
162+
161163
.. arch:tag:: <fixed_layout name="string" width="int" height="int">
162164
163165
:req_param name:

doc/src/vpr/command_line_usage.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,23 @@ VPR runs all stages of (pack, place, route, and analysis) if none of :option:`--
8282

8383
**Default:** ``off``
8484

85+
.. option:: --analytical_place
86+
87+
Run the analytical placement flow.
88+
This flows uses an integrated packing and placement algorithm which uses information from the primitive level to improve clustering and placement;
89+
as such, the :option:`--pack` and :option:`--place` options should not be set when this option is set.
90+
This flow requires that the device has a fixed size and some of the primitive blocks are fixed somewhere on the device grid.
91+
92+
.. seealso:: See :ref:`Fixed FPGA Grid Layout <fixed_arch_grid_layout>` and :option:`--device` for how to fix the device size.
93+
94+
.. seealso:: See :ref:`VPR Placement Constraints <placement_constraints>` for how to fix primitive blocks in a design to the device grid.
95+
96+
.. warning::
97+
98+
This analytical placement flow is experimental and under active development.
99+
100+
**Default:** ``off``
101+
85102
.. option:: --route
86103

87104
Run routing stage

libs/libvtrutil/src/vpr_error.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ enum e_vpr_error {
1414
VPR_ERROR_ARCH,
1515
VPR_ERROR_PACK,
1616
VPR_ERROR_PLACE,
17+
VPR_ERROR_AP,
1718
VPR_ERROR_ROUTE,
1819
VPR_ERROR_TIMING,
1920
VPR_ERROR_POWER,
2021
VPR_ERROR_SDC,
2122

2223
// File parsing errors
2324
VPR_ERROR_NET_F, // Error while parsing the packed netlist file
24-
VPR_ERROR_PLACE_F, // Error while parsning the placement file
25+
VPR_ERROR_PLACE_F, // Error while parsing the placement file
2526
VPR_ERROR_BLIF_F, // Error while parsing the blif file
2627
VPR_ERROR_IC_NETLIST_F, // Error while parsing the interchange netlist file
2728

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.APOpts.doAP = 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
@@ -315,11 +315,12 @@ TEST_CASE("fasm_integration_test", "[fasm]") {
315315
vpr_init(sizeof(argv)/sizeof(argv[0]), argv,
316316
&options, &vpr_setup, &arch);
317317

318-
vpr_setup.PackerOpts.doPacking = STAGE_LOAD;
319-
vpr_setup.PlacerOpts.doPlacement = STAGE_LOAD;
320-
vpr_setup.RouterOpts.doRouting = STAGE_LOAD;
318+
vpr_setup.PackerOpts.doPacking = STAGE_LOAD;
319+
vpr_setup.PlacerOpts.doPlacement = STAGE_LOAD;
320+
vpr_setup.APOpts.doAP = STAGE_SKIP;
321+
vpr_setup.RouterOpts.doRouting = STAGE_LOAD;
321322
vpr_setup.RouterOpts.read_rr_edge_metadata = true;
322-
vpr_setup.AnalysisOpts.doAnalysis = STAGE_SKIP;
323+
vpr_setup.AnalysisOpts.doAnalysis = STAGE_SKIP;
323324

324325
bool flow_succeeded = vpr_flow(vpr_setup, arch);
325326
REQUIRE(flow_succeeded == true);
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @file
3+
* @author Alex Singer
4+
* @date September 2024
5+
* @brief Implementation of the Analytical Placement flow.
6+
*/
7+
8+
#include "analytical_placement_flow.h"
9+
#include "atom_netlist.h"
10+
#include "globals.h"
11+
#include "prepack.h"
12+
#include "vpr_context.h"
13+
#include "vpr_error.h"
14+
#include "vpr_types.h"
15+
#include "vtr_time.h"
16+
17+
void run_analytical_placement_flow(t_vpr_setup& vpr_setup) {
18+
(void)vpr_setup;
19+
// Start an overall timer for the Analytical Placement flow.
20+
vtr::ScopedStartFinishTimer timer("Analytical Placement Flow");
21+
22+
// The global state used/modified by this flow.
23+
const AtomNetlist& atom_nlist = g_vpr_ctx.atom().nlist;
24+
const DeviceContext& device_ctx = g_vpr_ctx.device();
25+
26+
// Run the prepacker
27+
Prepacker prepacker;
28+
prepacker.init(atom_nlist, device_ctx.logical_block_types);
29+
30+
// AP is currently under-construction. Fail gracefully just in case this
31+
// is somehow being called.
32+
VPR_FATAL_ERROR(VPR_ERROR_AP,
33+
"Analytical Placement flow not implemented yet");
34+
}
35+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @file
3+
* @author Alex Singer
4+
* @date September 2024
5+
* @brief Methods for running the Analytical Placement flow.
6+
*/
7+
8+
#pragma once
9+
10+
// Forward declarations
11+
struct t_vpr_setup;
12+
13+
/**
14+
* @brief Run the Analaytical Placement flow.
15+
*
16+
* @param vpr_setup The setup options provided by the user.
17+
*/
18+
void run_analytical_placement_flow(t_vpr_setup& vpr_setup);
19+

vpr/src/base/CheckSetup.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
void CheckSetup(const t_packer_opts& PackerOpts,
1111
const t_placer_opts& PlacerOpts,
12+
const t_ap_opts& APOpts,
1213
const t_router_opts& RouterOpts,
1314
const t_server_opts& ServerOpts,
1415
const t_det_routing_arch& RoutingArch,
@@ -72,6 +73,28 @@ void CheckSetup(const t_packer_opts& PackerOpts,
7273
NUM_PL_MOVE_TYPES);
7374
}
7475

76+
// Rules for doing Analytical Placement
77+
if (APOpts.doAP) {
78+
// Make sure that the --place option was not set.
79+
if (PlacerOpts.doPlacement) {
80+
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
81+
"Cannot perform both analytical and non-analytical placement.\n");
82+
}
83+
// Make sure that the --pack option was not set.
84+
if (PackerOpts.doPacking) {
85+
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
86+
"Analytical placement should skip packing.\n");
87+
}
88+
89+
// TODO: Should check that read_vpr_constraint_file is non-empty or
90+
// check within analytical placement that the floorplanning has
91+
// some fixed blocks somewhere. Maybe we can live without fixed
92+
// blocks.
93+
94+
// TODO: Should we enforce that the size of the device is fixed. This
95+
// goes with ensuring that some blocks are fixed.
96+
}
97+
7598
if (RouterOpts.doRouting) {
7699
if (!Timing.timing_analysis_enabled
77100
&& (DEMAND_ONLY != RouterOpts.base_cost_type && DEMAND_ONLY_NORMALIZED_LENGTH != RouterOpts.base_cost_type)) {

vpr/src/base/CheckSetup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const int DYNAMIC_PORT_RANGE_MAX = 65535;
77

88
void CheckSetup(const t_packer_opts& PackerOpts,
99
const t_placer_opts& PlacerOpts,
10+
const t_ap_opts& APOpts,
1011
const t_router_opts& RouterOpts,
1112
const t_server_opts& ServerOpts,
1213
const t_det_routing_arch& RoutingArch,

vpr/src/base/SetupVPR.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ void SetupVPR(const t_options* Options,
9797
t_netlist_opts* NetlistOpts,
9898
t_packer_opts* PackerOpts,
9999
t_placer_opts* PlacerOpts,
100+
t_ap_opts* APOpts,
100101
t_annealing_sched* AnnealSched,
101102
t_router_opts* RouterOpts,
102103
t_analysis_opts* AnalysisOpts,
@@ -244,11 +245,13 @@ void SetupVPR(const t_options* Options,
244245
if (!Options->do_packing
245246
&& !Options->do_legalize
246247
&& !Options->do_placement
248+
&& !Options->do_analytical_placement
247249
&& !Options->do_routing
248250
&& !Options->do_analysis) {
249251
//run all stages if none specified
250252
PackerOpts->doPacking = STAGE_DO;
251253
PlacerOpts->doPlacement = STAGE_DO;
254+
APOpts->doAP = STAGE_SKIP; // AP not default.
252255
RouterOpts->doRouting = STAGE_DO;
253256
AnalysisOpts->doAnalysis = STAGE_AUTO; //Deferred until implementation status known
254257
} else {
@@ -276,6 +279,14 @@ void SetupVPR(const t_options* Options,
276279
PlacerOpts->doPlacement = STAGE_DO;
277280
}
278281

282+
if (Options->do_analytical_placement) {
283+
// In the Analytical Placement flow, packing and placement are
284+
// integrated. Thus, these stages are skipped.
285+
PackerOpts->doPacking = STAGE_SKIP;
286+
PlacerOpts->doPlacement = STAGE_SKIP;
287+
APOpts->doAP = STAGE_DO;
288+
}
289+
279290
if (Options->do_packing) {
280291
PackerOpts->doPacking = STAGE_DO;
281292
}

vpr/src/base/SetupVPR.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ void SetupVPR(const t_options* Options,
1616
t_netlist_opts* NetlistOpts,
1717
t_packer_opts* PackerOpts,
1818
t_placer_opts* PlacerOpts,
19+
t_ap_opts* APOpts,
1920
t_annealing_sched* AnnealSched,
2021
t_router_opts* RouterOpts,
2122
t_analysis_opts* AnalysisOpts,

vpr/src/base/ShowSetup.cpp

Lines changed: 11 additions & 0 deletions
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_ap_opts& APOpts);
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);
@@ -41,6 +43,7 @@ void ShowSetup(const t_vpr_setup& vpr_setup) {
4143

4244
VTR_LOG("Packer: %s\n", (vpr_setup.PackerOpts.doPacking ? "ENABLED" : "DISABLED"));
4345
VTR_LOG("Placer: %s\n", (vpr_setup.PlacerOpts.doPlacement ? "ENABLED" : "DISABLED"));
46+
VTR_LOG("Analytical Placer: %s\n", (vpr_setup.APOpts.doAP ? "ENABLED" : "DISABLED"));
4447
VTR_LOG("Router: %s\n", (vpr_setup.RouterOpts.doRouting ? "ENABLED" : "DISABLED"));
4548
VTR_LOG("Analysis: %s\n", (vpr_setup.AnalysisOpts.doAnalysis ? "ENABLED" : "DISABLED"));
4649
VTR_LOG("\n");
@@ -55,6 +58,9 @@ void ShowSetup(const t_vpr_setup& vpr_setup) {
5558
if (vpr_setup.PlacerOpts.doPlacement) {
5659
ShowPlacerOpts(vpr_setup.PlacerOpts, vpr_setup.AnnealSched);
5760
}
61+
if (vpr_setup.APOpts.doAP) {
62+
ShowAnalyticalPlacerOpts(vpr_setup.APOpts);
63+
}
5864
if (vpr_setup.RouterOpts.doRouting) {
5965
ShowRouterOpts(vpr_setup.RouterOpts);
6066
}
@@ -608,6 +614,11 @@ static void ShowPlacerOpts(const t_placer_opts& PlacerOpts,
608614
VTR_LOG("\n");
609615
}
610616

617+
static void ShowAnalyticalPlacerOpts(const t_ap_opts& APOpts) {
618+
(void)APOpts;
619+
// Currently nothing to show, but will happen eventually.
620+
}
621+
611622
static void ShowNetlistOpts(const t_netlist_opts& NetlistOpts) {
612623
VTR_LOG("NetlistOpts.absorb_buffer_luts : %s\n", (NetlistOpts.absorb_buffer_luts) ? "true" : "false");
613624
VTR_LOG("NetlistOpts.sweep_dangling_primary_ios : %s\n", (NetlistOpts.sweep_dangling_primary_ios) ? "true" : "false");

vpr/src/base/read_options.cpp

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

1327+
stage_grp.add_argument<bool, ParseOnOff>(args.do_analytical_placement, "--analytical_place")
1328+
.help("Run analytical placement. Analytical Placement uses an integrated packing and placement algorithm, using information from the primitive level to improve clustering and placement.")
1329+
.action(argparse::Action::STORE_TRUE)
1330+
.default_value("off");
1331+
13271332
stage_grp.add_argument<bool, ParseOnOff>(args.do_routing, "--route")
13281333
.help("Run routing")
13291334
.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
@@ -50,6 +50,7 @@ struct t_options {
5050
argparse::ArgValue<bool> do_packing;
5151
argparse::ArgValue<bool> do_legalize;
5252
argparse::ArgValue<bool> do_placement;
53+
argparse::ArgValue<bool> do_analytical_placement;
5354
argparse::ArgValue<bool> do_routing;
5455
argparse::ArgValue<bool> do_analysis;
5556
argparse::ArgValue<bool> do_power;

vpr/src/base/vpr_api.cpp

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
#include "place_constraints.h"
7070
#include "place_util.h"
7171
#include "timing_fail_error.h"
72+
#include "analytical_placement_flow.h"
7273

7374
#include "vpr_constraints_writer.h"
7475

@@ -285,6 +286,7 @@ void vpr_init_with_options(const t_options* options, t_vpr_setup* vpr_setup, t_a
285286
&vpr_setup->NetlistOpts,
286287
&vpr_setup->PackerOpts,
287288
&vpr_setup->PlacerOpts,
289+
&vpr_setup->APOpts,
288290
&vpr_setup->AnnealSched,
289291
&vpr_setup->RouterOpts,
290292
&vpr_setup->AnalysisOpts,
@@ -307,6 +309,7 @@ void vpr_init_with_options(const t_options* options, t_vpr_setup* vpr_setup, t_a
307309
/* Verify settings don't conflict or otherwise not make sense */
308310
CheckSetup(vpr_setup->PackerOpts,
309311
vpr_setup->PlacerOpts,
312+
vpr_setup->APOpts,
310313
vpr_setup->RouterOpts,
311314
vpr_setup->ServerOpts,
312315
vpr_setup->RoutingArch, vpr_setup->Segments, vpr_setup->Timing, arch->Chans);
@@ -402,6 +405,14 @@ bool vpr_flow(t_vpr_setup& vpr_setup, t_arch& arch) {
402405
return false; //Unimplementable
403406
}
404407
}
408+
409+
{ // Analytical Place
410+
if (vpr_setup.APOpts.doAP == STAGE_DO) {
411+
// TODO: Make this return a bool if the placement was successful or not.
412+
run_analytical_placement_flow(vpr_setup);
413+
}
414+
}
415+
405416
bool is_flat = vpr_setup.RouterOpts.flat_routing;
406417
const Netlist<>& router_net_list = is_flat ? (const Netlist<>&)g_vpr_ctx.atom().nlist : (const Netlist<>&)g_vpr_ctx.clustering().clb_nlist;
407418
RouteStatus route_status;
@@ -1354,6 +1365,7 @@ void vpr_setup_vpr(t_options* Options,
13541365
t_netlist_opts* NetlistOpts,
13551366
t_packer_opts* PackerOpts,
13561367
t_placer_opts* PlacerOpts,
1368+
t_ap_opts* APOpts,
13571369
t_annealing_sched* AnnealSched,
13581370
t_router_opts* RouterOpts,
13591371
t_analysis_opts* AnalysisOpts,
@@ -1379,6 +1391,7 @@ void vpr_setup_vpr(t_options* Options,
13791391
NetlistOpts,
13801392
PackerOpts,
13811393
PlacerOpts,
1394+
APOpts,
13821395
AnnealSched,
13831396
RouterOpts,
13841397
AnalysisOpts,
@@ -1403,14 +1416,22 @@ void vpr_check_arch(const t_arch& Arch) {
14031416
///@brief Verify settings don't conflict or otherwise not make sense
14041417
void vpr_check_setup(const t_packer_opts& PackerOpts,
14051418
const t_placer_opts& PlacerOpts,
1419+
const t_ap_opts& APOpts,
14061420
const t_router_opts& RouterOpts,
14071421
const t_server_opts& ServerOpts,
14081422
const t_det_routing_arch& RoutingArch,
14091423
const std::vector<t_segment_inf>& Segments,
14101424
const t_timing_inf& Timing,
14111425
const t_chan_width_dist& Chans) {
1412-
CheckSetup(PackerOpts, PlacerOpts, RouterOpts, ServerOpts, RoutingArch,
1413-
Segments, Timing, Chans);
1426+
CheckSetup(PackerOpts,
1427+
PlacerOpts,
1428+
APOpts,
1429+
RouterOpts,
1430+
ServerOpts,
1431+
RoutingArch,
1432+
Segments,
1433+
Timing,
1434+
Chans);
14141435
}
14151436

14161437
///@brief Show current setup
@@ -1634,6 +1655,9 @@ void vpr_print_error(const VprError& vpr_error) {
16341655
case VPR_ERROR_PLACE:
16351656
error_type = "Placement";
16361657
break;
1658+
case VPR_ERROR_AP:
1659+
error_type = "Analytical Placement";
1660+
break;
16371661
case VPR_ERROR_ROUTE:
16381662
error_type = "Routing";
16391663
break;

vpr/src/base/vpr_api.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ void vpr_setup_vpr(t_options* Options,
178178
t_netlist_opts* NetlistOpts,
179179
t_packer_opts* PackerOpts,
180180
t_placer_opts* PlacerOpts,
181+
t_ap_opts* APOpts,
181182
t_annealing_sched* AnnealSched,
182183
t_router_opts* RouterOpts,
183184
t_analysis_opts* AnalysisOpts,
@@ -200,6 +201,7 @@ void vpr_check_arch(const t_arch& Arch);
200201
///@brief Verify settings don't conflict or otherwise not make sense
201202
void vpr_check_setup(const t_packer_opts& PackerOpts,
202203
const t_placer_opts& PlacerOpts,
204+
const t_ap_opts& APOpts,
203205
const t_router_opts& RouterOpts,
204206
const t_server_opts& ServerOpts,
205207
const t_det_routing_arch& RoutingArch,

0 commit comments

Comments
 (0)