Skip to content

Commit 5eb7a07

Browse files
clean modified cluster_constraints elements
1 parent d5a98a4 commit 5eb7a07

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

vpr/src/pack/pack.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ static void update_noc_reachability_partitions(const std::vector<AtomBlockId>& n
6666
const auto& atom_ctx = g_vpr_ctx.atom();
6767
auto& constraints = g_vpr_ctx.mutable_floorplanning().constraints;
6868
const auto& high_fanout_thresholds = g_vpr_ctx.cl_helper().high_fanout_thresholds;
69-
const auto& device_ctx = g_vpr_ctx.device();
7069

7170
const size_t high_fanout_threshold = high_fanout_thresholds.get_threshold("");
7271

@@ -79,9 +78,9 @@ static void update_noc_reachability_partitions(const std::vector<AtomBlockId>& n
7978

8079
RegionRectCoord unconstrained_rect{0,
8180
0,
82-
(int)device_ctx.grid.width() - 1,
83-
(int)device_ctx.grid.height() - 1,
84-
-1};
81+
std::numeric_limits<int>::max(),
82+
std::numeric_limits<int>::max(),
83+
0};
8584
Region unconstrained_region;
8685
unconstrained_region.set_region_rect(unconstrained_rect);
8786

@@ -128,7 +127,6 @@ static void update_noc_reachability_partitions(const std::vector<AtomBlockId>& n
128127
} else {
129128
auto& atom_partition = constraints.get_mutable_partition(atom_partition_id);
130129
auto& atom_partition_region = atom_partition.get_mutable_part_region();
131-
// std::cout << "ss" << atom_partition_region.get_exclusivity_index() << std::endl;
132130
VTR_ASSERT(atom_partition_region.get_exclusivity_index() < 0 || current_atom == noc_atom_id);
133131
atom_partition_region.set_exclusivity_index(exclusivity_cnt);
134132
}
@@ -253,6 +251,7 @@ bool try_pack(t_packer_opts* packer_opts,
253251
int pack_iteration = 1;
254252
bool floorplan_regions_overfull = false;
255253

254+
auto constraints_backup = g_vpr_ctx.floorplanning().constraints;
256255
// find all NoC router atoms
257256
auto noc_atoms = find_noc_router_atoms();
258257
update_noc_reachability_partitions(noc_atoms);
@@ -398,6 +397,21 @@ bool try_pack(t_packer_opts* packer_opts,
398397
//check clustering and output it
399398
check_and_output_clustering(*packer_opts, is_clock, arch, helper_ctx.total_clb_num, clustering_data.intra_lb_routing);
400399

400+
401+
g_vpr_ctx.mutable_floorplanning().constraints = constraints_backup;
402+
const int max_y = (int)g_vpr_ctx.device().grid.height();
403+
const int max_x = (int)g_vpr_ctx.device().grid.width();
404+
for (auto& cluster_partition_region : g_vpr_ctx.mutable_floorplanning().cluster_constraints) {
405+
const auto& regions = cluster_partition_region.get_regions();
406+
if (regions.size() == 1) {
407+
const auto rect = regions[0].get_region_rect();
408+
409+
if (rect.xmin <= 0 && rect.ymin <= 0 && rect.xmax >= max_x && rect.ymax >= max_y) {
410+
cluster_partition_region = PartitionRegion();
411+
}
412+
}
413+
}
414+
401415
// Free Data Structures
402416
free_clustering_data(*packer_opts, clustering_data);
403417

vpr/src/place/place_constraints.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ int check_placement_floorplanning() {
3333
/*returns true if cluster has floorplanning constraints, false if it doesn't*/
3434
bool is_cluster_constrained(ClusterBlockId blk_id) {
3535
auto& floorplanning_ctx = g_vpr_ctx.floorplanning();
36-
PartitionRegion pr;
37-
pr = floorplanning_ctx.cluster_constraints[blk_id];
36+
const PartitionRegion& pr = floorplanning_ctx.cluster_constraints[blk_id];
3837
return (!pr.empty());
3938
}
4039

@@ -250,7 +249,7 @@ void load_cluster_constraints() {
250249
PartitionRegion empty_pr;
251250
floorplanning_ctx.cluster_constraints[cluster_id] = empty_pr;
252251

253-
//if there are any constrainted atoms in the cluster,
252+
//if there are any constrained atoms in the cluster,
254253
//we update the cluster's PartitionRegion
255254
for (auto atom : *atoms) {
256255
PartitionId partid = floorplanning_ctx.constraints.get_atom_partition(atom);

0 commit comments

Comments
 (0)