Skip to content

Commit d906ea8

Browse files
author
Nathan Shreve
committed
Merge branch 'master' into improve_binary_heap
2 parents 51cd8d4 + 62d1243 commit d906ea8

17 files changed

+608
-303
lines changed

doc/src/api/vprinternals/router_heap.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ HeapInterface
1414
:project: vpr
1515
:members:
1616

17+
HeapStorage
18+
----------
19+
.. doxygenclass:: HeapStorage
20+
:project: vpr
21+
:members:
22+
1723
KAryHeap
1824
----------
1925
.. doxygenclass:: KAryHeap

vpr/src/base/vpr_constraints_writer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ void setup_vpr_floorplan_constraints_one_loc(VprConstraints& constraints, int ex
8080
part.set_part_region(pr);
8181
constraints.mutable_place_constraints().add_partition(part);
8282

83-
std::unordered_set<AtomBlockId>* atoms = cluster_to_atoms(blk_id);
83+
const std::unordered_set<AtomBlockId>& atoms = cluster_to_atoms(blk_id);
8484

85-
for (auto atom_id : *atoms) {
85+
for (AtomBlockId atom_id : atoms) {
8686
constraints.mutable_place_constraints().add_constrained_atom(atom_id, partid);
8787
}
8888
part_id++;
@@ -156,7 +156,7 @@ void setup_vpr_floorplan_constraints_cutpoints(VprConstraints& constraints, int
156156
* appropriate region accordingly
157157
*/
158158
for (auto blk_id : cluster_ctx.clb_nlist.blocks()) {
159-
std::unordered_set<AtomBlockId>* atoms = cluster_to_atoms(blk_id);
159+
const std::unordered_set<AtomBlockId>& atoms = cluster_to_atoms(blk_id);
160160
int x = place_ctx.block_locs[blk_id].loc.x;
161161
int y = place_ctx.block_locs[blk_id].loc.y;
162162
int width = device_ctx.grid.width();
@@ -189,7 +189,7 @@ void setup_vpr_floorplan_constraints_cutpoints(VprConstraints& constraints, int
189189

190190
VTR_ASSERT(got != region_atoms.end());
191191

192-
for (auto atom_id : *atoms) {
192+
for (AtomBlockId atom_id : atoms) {
193193
got->second.push_back(atom_id);
194194
}
195195
}

vpr/src/base/vpr_context.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,17 @@ struct FloorplanningContext : public Context {
520520
*/
521521
vtr::vector<ClusterBlockId, PartitionRegion> cluster_constraints;
522522

523+
/**
524+
* @brief Floorplanning constraints in the compressed grid coordinate system.
525+
*
526+
* Each clustered block has a logical type with a corresponding compressed grid.
527+
* Compressed floorplanning constraints are calculated by translating the grid locations
528+
* of floorplanning regions to compressed grid locations. To ensure regions do not enlarge:
529+
* - The bottom left corner is rounded up to the nearest compressed location.
530+
* - The top right corner is rounded down to the nearest compressed location.
531+
*/
532+
vtr::vector<ClusterBlockId, PartitionRegion> compressed_cluster_constraints;
533+
523534
std::vector<Region> overfull_regions;
524535
};
525536

vpr/src/pack/re_cluster.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ bool move_mol_to_new_cluster(t_pack_molecule* molecule,
3737
}
3838

3939
//remove the molecule from its current cluster
40-
std::unordered_set<AtomBlockId>* old_clb_atoms = cluster_to_atoms(old_clb);
41-
if (old_clb_atoms->size() == 1) {
40+
std::unordered_set<AtomBlockId>& old_clb_atoms = cluster_to_mutable_atoms(old_clb);
41+
if (old_clb_atoms.size() == 1) {
4242
VTR_LOGV(verbosity > 4, "Atom: %zu move failed. This is the last atom in its cluster.\n");
4343
return false;
4444
}
@@ -101,17 +101,17 @@ bool move_mol_to_existing_cluster(t_pack_molecule* molecule,
101101
AtomBlockId root_atom_id = molecule->atom_block_ids[molecule->root];
102102
int molecule_size = get_array_size_of_molecule(molecule);
103103
t_lb_router_data* old_router_data = nullptr;
104-
std::unordered_set<AtomBlockId>* new_clb_atoms = cluster_to_atoms(new_clb);
104+
std::unordered_set<AtomBlockId>& new_clb_atoms = cluster_to_mutable_atoms(new_clb);
105105
ClusterBlockId old_clb = atom_to_cluster(root_atom_id);
106106

107-
//check old and new clusters compitability
108-
bool is_compitable = check_type_and_mode_compitability(old_clb, new_clb, verbosity);
109-
if (!is_compitable)
107+
//check old and new clusters compatibility
108+
bool is_compatible = check_type_and_mode_compatibility(old_clb, new_clb, verbosity);
109+
if (!is_compatible)
110110
return false;
111111

112112
//remove the molecule from its current cluster
113-
std::unordered_set<AtomBlockId>* old_clb_atoms = cluster_to_atoms(old_clb);
114-
if (old_clb_atoms->size() == 1) {
113+
std::unordered_set<AtomBlockId>& old_clb_atoms = cluster_to_mutable_atoms(old_clb);
114+
if (old_clb_atoms.size() == 1) {
115115
VTR_LOGV(verbosity > 4, "Atom: %zu move failed. This is the last atom in its cluster.\n");
116116
return false;
117117
}
@@ -181,19 +181,21 @@ bool swap_two_molecules(t_pack_molecule* molecule_1,
181181
return false;
182182
}
183183
//Check that the old and new clusters are of the same type
184-
bool is_compitable = check_type_and_mode_compitability(clb_1, clb_2, verbosity);
184+
bool is_compitable = check_type_and_mode_compatibility(clb_1, clb_2, verbosity);
185185
if (!is_compitable)
186186
return false;
187187

188188
t_lb_router_data* old_1_router_data = nullptr;
189189
t_lb_router_data* old_2_router_data = nullptr;
190190

191191
//save the atoms of the 2 clusters
192-
std::unordered_set<AtomBlockId>* clb_1_atoms = cluster_to_atoms(clb_1);
193-
std::unordered_set<AtomBlockId>* clb_2_atoms = cluster_to_atoms(clb_2);
192+
std::unordered_set<AtomBlockId>& clb_1_atoms = cluster_to_mutable_atoms(clb_1);
193+
std::unordered_set<AtomBlockId>& clb_2_atoms = cluster_to_mutable_atoms(clb_2);
194194

195-
if (clb_1_atoms->size() == 1 || clb_2_atoms->size() == 1) {
196-
VTR_LOGV(verbosity > 4, "Atom: %zu, %zu swap failed. This is the last atom in its cluster.\n", molecule_1->atom_block_ids[molecule_1->root], molecule_2->atom_block_ids[molecule_2->root]);
195+
if (clb_1_atoms.size() == 1 || clb_2_atoms.size() == 1) {
196+
VTR_LOGV(verbosity > 4, "Atom: %zu, %zu swap failed. This is the last atom in its cluster.\n",
197+
molecule_1->atom_block_ids[molecule_1->root],
198+
molecule_2->atom_block_ids[molecule_2->root]);
197199
return false;
198200
}
199201

0 commit comments

Comments
 (0)