Skip to content

Commit 500368c

Browse files
[AP] Full Legalizer
The Full Legalizer in the AP flow takes a partial placement (of any legality) and returns a fully legal placement. A legal placement is a set of legal clusterers of atoms and legal places for those clusters to be placed. To fully test the AP flow, made a temporary Global Placer which will just place the APBlocks at the center of the device. This will be fixed later. Also includes basic tests to ensure the AP flow does not regress.
1 parent 3e53a93 commit 500368c

27 files changed

+2192
-16
lines changed

vpr/src/analytical_place/analytical_placement_flow.cpp

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,21 @@
88
#include "analytical_placement_flow.h"
99
#include "ap_netlist.h"
1010
#include "atom_netlist.h"
11+
#include "full_legalizer.h"
1112
#include "gen_ap_netlist_from_atoms.h"
1213
#include "globals.h"
14+
#include "partial_placement.h"
1315
#include "prepack.h"
1416
#include "user_place_constraints.h"
1517
#include "vpr_context.h"
16-
#include "vpr_error.h"
1718
#include "vpr_types.h"
19+
#include "vtr_assert.h"
1820
#include "vtr_time.h"
1921

2022
void run_analytical_placement_flow(t_vpr_setup& vpr_setup) {
2123
(void)vpr_setup;
2224
// Start an overall timer for the Analytical Placement flow.
23-
vtr::ScopedStartFinishTimer timer("Analytical Placement Flow");
25+
vtr::ScopedStartFinishTimer timer("Analytical Placement");
2426

2527
// The global state used/modified by this flow.
2628
const AtomNetlist& atom_nlist = g_vpr_ctx.atom().nlist;
@@ -37,9 +39,38 @@ void run_analytical_placement_flow(t_vpr_setup& vpr_setup) {
3739
prepacker,
3840
constraints);
3941

40-
// AP is currently under-construction. Fail gracefully just in case this
41-
// is somehow being called.
42-
VPR_FATAL_ERROR(VPR_ERROR_AP,
43-
"Analytical Placement flow not implemented yet");
42+
// Run the Global Placer
43+
// For now, just put all the moveable blocks at the center of the device
44+
// grid. This will be replaced later. This is just for testing.
45+
PartialPlacement p_placement(ap_netlist);
46+
const size_t device_width = device_ctx.grid.width();
47+
const size_t device_height = device_ctx.grid.height();
48+
double device_center_x = static_cast<double>(device_width) / 2.0;
49+
double device_center_y = static_cast<double>(device_height) / 2.0;
50+
for (APBlockId ap_blk_id : ap_netlist.blocks()) {
51+
if (ap_netlist.block_mobility(ap_blk_id) != APBlockMobility::MOVEABLE)
52+
continue;
53+
// If the APBlock is moveable, put it on the center for the device.
54+
p_placement.block_x_locs[ap_blk_id] = device_center_x;
55+
p_placement.block_y_locs[ap_blk_id] = device_center_y;
56+
}
57+
VTR_ASSERT(p_placement.verify(ap_netlist,
58+
device_width,
59+
device_height,
60+
device_ctx.grid.get_num_layers()));
61+
62+
// Run the Full Legalizer.
63+
FullLegalizer full_legalizer(ap_netlist,
64+
vpr_setup,
65+
device_ctx.grid,
66+
device_ctx.arch,
67+
atom_nlist,
68+
prepacker,
69+
device_ctx.logical_block_types,
70+
vpr_setup.PackerRRGraph,
71+
device_ctx.arch->models,
72+
device_ctx.arch->model_library,
73+
vpr_setup.PackerOpts);
74+
full_legalizer.legalize(p_placement);
4475
}
4576

0 commit comments

Comments
 (0)