Skip to content

Commit fe59bdb

Browse files
author
MohamedElgammal
committed
Revert "Use the pre-built atom lookup instead of rebuilding it multiple times"
This reverts commit 5368305.
1 parent 2f08e3e commit fe59bdb

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

vpr/src/base/vpr_constraints_writer.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <fstream>
1919
#include "vpr_constraints_writer.h"
2020
#include "region.h"
21-
#include "re_cluster_util.h"
2221

2322
void write_vpr_floorplan_constraints(const char* file_name, int expand, bool subtile, int horizontal_partitions, int vertical_partitions) {
2423
VprConstraints constraints;
@@ -47,6 +46,7 @@ void write_vpr_floorplan_constraints(const char* file_name, int expand, bool sub
4746
void setup_vpr_floorplan_constraints_one_loc(VprConstraints& constraints, int expand, bool subtile) {
4847
auto& cluster_ctx = g_vpr_ctx.clustering();
4948
auto& place_ctx = g_vpr_ctx.placement();
49+
ClusterAtomsLookup atoms_lookup;
5050

5151
int part_id = 0;
5252
/*
@@ -77,9 +77,9 @@ void setup_vpr_floorplan_constraints_one_loc(VprConstraints& constraints, int ex
7777
part.set_part_region(pr);
7878
constraints.add_partition(part);
7979

80-
std::unordered_set<AtomBlockId>* atoms = cluster_to_atoms(blk_id);
80+
std::vector<AtomBlockId> atoms = atoms_lookup.atoms_in_cluster(blk_id);
8181

82-
for (auto atom_id : *atoms) {
82+
for (auto atom_id : atoms) {
8383
constraints.add_constrained_atom(atom_id, partid);
8484
}
8585
part_id++;
@@ -90,6 +90,7 @@ void setup_vpr_floorplan_constraints_cutpoints(VprConstraints& constraints, int
9090
auto& cluster_ctx = g_vpr_ctx.clustering();
9191
auto& place_ctx = g_vpr_ctx.placement();
9292
auto& device_ctx = g_vpr_ctx.device();
93+
ClusterAtomsLookup atoms_lookup;
9394

9495
//calculate the cutpoint values according to the grid size
9596
//load two arrays - one for horizontal cutpoints and one for vertical
@@ -150,7 +151,7 @@ void setup_vpr_floorplan_constraints_cutpoints(VprConstraints& constraints, int
150151
* appropriate region accordingly
151152
*/
152153
for (auto blk_id : cluster_ctx.clb_nlist.blocks()) {
153-
std::unordered_set<AtomBlockId>* atoms = cluster_to_atoms(blk_id);
154+
std::vector<AtomBlockId> atoms = atoms_lookup.atoms_in_cluster(blk_id);
154155
int x = place_ctx.block_locs[blk_id].loc.x;
155156
int y = place_ctx.block_locs[blk_id].loc.y;
156157
int width = device_ctx.grid.width();
@@ -182,7 +183,7 @@ void setup_vpr_floorplan_constraints_cutpoints(VprConstraints& constraints, int
182183

183184
VTR_ASSERT(got != region_atoms.end());
184185

185-
for (auto atom_id : *atoms) {
186+
for (auto atom_id : atoms) {
186187
got->second.push_back(atom_id);
187188
}
188189
}

vpr/src/pack/cluster_util.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3677,6 +3677,7 @@ t_pb* get_top_level_pb(t_pb* pb) {
36773677
return top_level_pb;
36783678
}
36793679

3680+
36803681
void init_clb_atoms_lookup(vtr::vector<ClusterBlockId, std::unordered_set<AtomBlockId>>& atoms_lookup) {
36813682
auto& atom_ctx = g_vpr_ctx.atom();
36823683
auto& cluster_ctx = g_vpr_ctx.clustering();

vpr/src/place/place_constraints.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "globals.h"
1212
#include "place_constraints.h"
1313
#include "place_util.h"
14-
#include "re_cluster_util.h"
1514

1615
/*checks that each block's location is compatible with its floorplanning constraints if it has any*/
1716
int check_placement_floorplanning() {
@@ -229,17 +228,18 @@ bool cluster_floorplanning_legal(ClusterBlockId blk_id, const t_pl_loc& loc) {
229228
void load_cluster_constraints() {
230229
auto& floorplanning_ctx = g_vpr_ctx.mutable_floorplanning();
231230
auto& cluster_ctx = g_vpr_ctx.clustering();
231+
ClusterAtomsLookup atoms_lookup;
232232

233233
floorplanning_ctx.cluster_constraints.resize(cluster_ctx.clb_nlist.blocks().size());
234234

235235
for (auto cluster_id : cluster_ctx.clb_nlist.blocks()) {
236-
std::unordered_set<AtomBlockId>* atoms = cluster_to_atoms(cluster_id);
236+
std::vector<AtomBlockId> atoms = atoms_lookup.atoms_in_cluster(cluster_id);
237237
PartitionRegion empty_pr;
238238
floorplanning_ctx.cluster_constraints[cluster_id] = empty_pr;
239239

240240
//if there are any constrainted atoms in the cluster,
241241
//we update the cluster's PartitionRegion
242-
for (auto atom : *atoms) {
242+
for (auto atom : atoms) {
243243
PartitionId partid = floorplanning_ctx.constraints.get_atom_partition(atom);
244244

245245
if (partid != PartitionId::INVALID()) {

0 commit comments

Comments
 (0)