Skip to content

Commit a76313e

Browse files
[AP] Full Legalizer Implementation
1 parent a4ef540 commit a76313e

File tree

9 files changed

+469
-31
lines changed

9 files changed

+469
-31
lines changed

vpr/src/base/vpr_api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ bool vpr_flow(t_vpr_setup& vpr_setup, t_arch& arch) {
407407
{ //Analytical Place
408408
if (vpr_setup.PlacerOpts.doAnalyticalPlacement == STAGE_DO) {
409409
// TODO: Make this return a bool if the placement was successful or not.
410-
run_analytical_placement_flow();
410+
run_analytical_placement_flow(vpr_setup);
411411
}
412412
}
413413

vpr/src/place/analytical_placement/PlacementLegalizer.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -754,9 +754,3 @@ void FlowBasedLegalizer::legalize(PartialPlacement &p_placement) {
754754
arch_model.export_node_locations(p_placement, netlist);
755755
}
756756

757-
void FullLegalizer::legalize(PartialPlacement& p_placement) {
758-
(void)p_placement;
759-
VTR_LOG("Running Full Legalizer\n");
760-
VTR_ASSERT(false && "Full legalizer not implemented yet.");
761-
}
762-

vpr/src/place/analytical_placement/PlacementLegalizer.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55

66
class APNetlist;
77

8-
// TODO: Split this into two classes: PartialLegalizer and FullLegalizer
9-
// Partial legalizer takes a partial placement and returns a partial
10-
// placement.
11-
// Full legalizer takes a partial placement and returns a clustered
12-
// placement which can be fed into the Simulated Annealer.
138
class PlacementLegalizer {
149
public:
1510
PlacementLegalizer(const APNetlist& inetlist) : netlist(inetlist) {}
@@ -25,9 +20,3 @@ class FlowBasedLegalizer : public PlacementLegalizer {
2520
void legalize(PartialPlacement &p_placement) final;
2621
};
2722

28-
class FullLegalizer : public PlacementLegalizer {
29-
using PlacementLegalizer::PlacementLegalizer;
30-
public:
31-
void legalize(PartialPlacement &p_placement) final;
32-
};
33-

vpr/src/place/analytical_placement/analytical_placement_flow.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
#include "AnalyticalSolver.h"
88
#include "PlacementLegalizer.h"
99
#include "atom_netlist.h"
10+
#include "full_legalizer.h"
1011
#include "globals.h"
1112
#include "prepack.h"
1213
#include "read_atom_netlist.h"
1314
#include "user_place_constraints.h"
1415
#include "vpr_context.h"
16+
#include "vpr_types.h"
1517
#include "vtr_assert.h"
1618
#include "vtr_time.h"
1719

18-
void run_analytical_placement_flow() {
20+
void run_analytical_placement_flow(t_vpr_setup& vpr_setup) {
1921
vtr::ScopedStartFinishTimer timer("Analytical Placement Flow");
2022

2123
// The global state used/modified by this flow.
@@ -62,6 +64,17 @@ void run_analytical_placement_flow() {
6264
export_to_flat_placement_file(p_placement, ap_netlist, mutable_atom_ctx.nlist, "flat_placement_file.txt");
6365

6466
// Run the full legalizer
65-
FullLegalizer(ap_netlist).legalize(p_placement);
67+
FullLegalizer full_legalizer(ap_netlist,
68+
vpr_setup,
69+
g_vpr_ctx.device().grid,
70+
g_vpr_ctx.device().arch,
71+
g_vpr_ctx.atom().nlist,
72+
prepacker,
73+
g_vpr_ctx.device().logical_block_types,
74+
vpr_setup.PackerRRGraph,
75+
g_vpr_ctx.device().arch->models,
76+
g_vpr_ctx.device().arch->model_library,
77+
vpr_setup.PackerOpts);
78+
full_legalizer.legalize(p_placement);
6679
}
6780

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
#pragma once
33

4-
void run_analytical_placement_flow();
4+
struct t_vpr_setup;
5+
6+
void run_analytical_placement_flow(t_vpr_setup& vpr_setup);
57

68

0 commit comments

Comments
 (0)