Skip to content

Commit 72b4146

Browse files
pass block ids by value instead of reference
1 parent 976813b commit 72b4146

File tree

3 files changed

+34
-35
lines changed

3 files changed

+34
-35
lines changed

vpr/src/pack/re_cluster.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ bool move_mol_to_existing_cluster(t_pack_molecule* molecule,
112112
std::unordered_set<AtomBlockId>& new_clb_atoms = cluster_to_mutable_atoms(new_clb);
113113
ClusterBlockId old_clb = atom_to_cluster(root_atom_id);
114114

115-
//check old and new clusters compitability
116-
bool is_compitable = check_type_and_mode_compitability(old_clb, new_clb, verbosity);
117-
if (!is_compitable)
115+
//check old and new clusters compatibility
116+
bool is_compatible = check_type_and_mode_compatibility(old_clb, new_clb, verbosity);
117+
if (!is_compatible)
118118
return false;
119119

120120
//remove the molecule from its current cluster
@@ -189,7 +189,7 @@ bool swap_two_molecules(t_pack_molecule* molecule_1,
189189
return false;
190190
}
191191
//Check that the old and new clusters are of the same type
192-
bool is_compitable = check_type_and_mode_compitability(clb_1, clb_2, verbosity);
192+
bool is_compitable = check_type_and_mode_compatibility(clb_1, clb_2, verbosity);
193193
if (!is_compitable)
194194
return false;
195195

vpr/src/pack/re_cluster_util.cpp

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ static void fix_cluster_port_after_moving(const ClusterBlockId clb_index);
3030

3131
static void fix_cluster_net_after_moving(const t_pack_molecule* molecule,
3232
int molecule_size,
33-
const ClusterBlockId& old_clb,
34-
const ClusterBlockId& new_clb);
33+
ClusterBlockId old_clb,
34+
ClusterBlockId new_clb);
3535

36-
static void rebuild_cluster_placement_stats(const ClusterBlockId& clb_index,
36+
static void rebuild_cluster_placement_stats(ClusterBlockId clb_index,
3737
const std::unordered_set<AtomBlockId>& clb_atoms);
3838

3939
static void update_cluster_pb_stats(const t_pack_molecule* molecule,
@@ -42,7 +42,7 @@ static void update_cluster_pb_stats(const t_pack_molecule* molecule,
4242
bool is_added);
4343

4444
/***************** API functions ***********************/
45-
ClusterBlockId atom_to_cluster(const AtomBlockId& atom) {
45+
ClusterBlockId atom_to_cluster(AtomBlockId atom) {
4646
auto& atom_ctx = g_vpr_ctx.atom();
4747
return (atom_ctx.lookup.atom_clb(atom));
4848
}
@@ -76,8 +76,8 @@ void remove_mol_from_cluster(const t_pack_molecule* molecule,
7676
update_cluster_pb_stats(molecule, molecule_size, old_clb, false);
7777
}
7878

79-
void commit_mol_move(const ClusterBlockId& old_clb,
80-
const ClusterBlockId& new_clb,
79+
void commit_mol_move(ClusterBlockId old_clb,
80+
ClusterBlockId new_clb,
8181
bool during_packing,
8282
bool new_clb_created) {
8383
auto& device_ctx = g_vpr_ctx.device();
@@ -93,7 +93,7 @@ void commit_mol_move(const ClusterBlockId& old_clb,
9393
}
9494

9595
t_lb_router_data* lb_load_router_data(std::vector<t_lb_type_rr_node>* lb_type_rr_graphs,
96-
const ClusterBlockId& clb_index,
96+
ClusterBlockId clb_index,
9797
const std::unordered_set<AtomBlockId>& clb_atoms) {
9898
//build data structures used by intra-logic block router
9999
auto& cluster_ctx = g_vpr_ctx.clustering();
@@ -202,7 +202,7 @@ bool start_new_cluster_for_mol(t_pack_molecule* molecule,
202202

203203
bool pack_mol_in_existing_cluster(t_pack_molecule* molecule,
204204
int molecule_size,
205-
const ClusterBlockId& new_clb,
205+
ClusterBlockId new_clb,
206206
std::unordered_set<AtomBlockId>& new_clb_atoms,
207207
bool during_packing,
208208
t_clustering_data& clustering_data,
@@ -271,13 +271,13 @@ bool pack_mol_in_existing_cluster(t_pack_molecule* molecule,
271271

272272
void fix_clustered_netlist(t_pack_molecule* molecule,
273273
int molecule_size,
274-
const ClusterBlockId& old_clb,
275-
const ClusterBlockId& new_clb) {
274+
ClusterBlockId old_clb,
275+
ClusterBlockId new_clb) {
276276
fix_cluster_port_after_moving(new_clb);
277277
fix_cluster_net_after_moving(molecule, molecule_size, old_clb, new_clb);
278278
}
279279

280-
void revert_mol_move(const ClusterBlockId& old_clb,
280+
void revert_mol_move(ClusterBlockId old_clb,
281281
t_pack_molecule* molecule,
282282
t_lb_router_data*& old_router_data,
283283
bool during_packing,
@@ -323,8 +323,8 @@ void revert_mol_move(const ClusterBlockId& old_clb,
323323

324324
static void fix_cluster_net_after_moving(const t_pack_molecule* molecule,
325325
int molecule_size,
326-
const ClusterBlockId& old_clb,
327-
const ClusterBlockId& new_clb) {
326+
ClusterBlockId old_clb,
327+
ClusterBlockId new_clb) {
328328
auto& cluster_ctx = g_vpr_ctx.mutable_clustering();
329329
auto& atom_ctx = g_vpr_ctx.mutable_atom();
330330

@@ -634,7 +634,7 @@ static bool count_children_pbs(const t_pb* pb) {
634634
}
635635
#endif
636636

637-
static void rebuild_cluster_placement_stats(const ClusterBlockId& clb_index,
637+
static void rebuild_cluster_placement_stats(ClusterBlockId clb_index,
638638
const std::unordered_set<AtomBlockId>& clb_atoms) {
639639
auto& helper_ctx = g_vpr_ctx.mutable_cl_helper();
640640
auto& cluster_ctx = g_vpr_ctx.clustering();
@@ -656,7 +656,7 @@ bool is_cluster_legal(t_lb_router_data*& router_data) {
656656

657657
void commit_mol_removal(const t_pack_molecule* molecule,
658658
const int& molecule_size,
659-
const ClusterBlockId& old_clb,
659+
ClusterBlockId old_clb,
660660
bool during_packing,
661661
t_lb_router_data*& router_data,
662662
t_clustering_data& clustering_data) {
@@ -677,12 +677,13 @@ void commit_mol_removal(const t_pack_molecule* molecule,
677677
router_data->saved_lb_nets = nullptr;
678678
} else {
679679
cluster_ctx.clb_nlist.block_pb(old_clb)->pb_route.clear();
680-
cluster_ctx.clb_nlist.block_pb(old_clb)->pb_route = alloc_and_load_pb_route(router_data->saved_lb_nets, cluster_ctx.clb_nlist.block_pb(old_clb)->pb_graph_node);
680+
cluster_ctx.clb_nlist.block_pb(old_clb)->pb_route = alloc_and_load_pb_route(router_data->saved_lb_nets,
681+
cluster_ctx.clb_nlist.block_pb(old_clb)->pb_graph_node);
681682
}
682683
}
683684

684-
bool check_type_and_mode_compitability(const ClusterBlockId& old_clb,
685-
const ClusterBlockId& new_clb,
685+
bool check_type_and_mode_compatibility(ClusterBlockId old_clb,
686+
ClusterBlockId new_clb,
686687
int verbosity) {
687688
auto& cluster_ctx = g_vpr_ctx.clustering();
688689

vpr/src/pack/re_cluster_util.h

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* @brief A function that returns the block ID in the clustered netlist
2424
* from its ID in the atom netlist.
2525
*/
26-
ClusterBlockId atom_to_cluster(const AtomBlockId& atom);
26+
ClusterBlockId atom_to_cluster(AtomBlockId atom);
2727

2828
/**
2929
* @brief A function that return a list of atoms in a cluster
@@ -45,7 +45,7 @@ std::unordered_set<AtomBlockId>& cluster_to_mutable_atoms(ClusterBlockId cluster
4545
* @brief A function that loads the intra-cluster router data of one cluster
4646
*/
4747
t_lb_router_data* lb_load_router_data(std::vector<t_lb_type_rr_node>* lb_type_rr_graphs,
48-
const ClusterBlockId& clb_index,
48+
ClusterBlockId clb_index,
4949
const std::unordered_set<AtomBlockId>& clb_atoms);
5050

5151
/**
@@ -113,7 +113,7 @@ bool start_new_cluster_for_mol(t_pack_molecule* molecule,
113113
*/
114114
bool pack_mol_in_existing_cluster(t_pack_molecule* molecule,
115115
int molecule_size,
116-
const ClusterBlockId& new_clb,
116+
ClusterBlockId new_clb,
117117
std::unordered_set<AtomBlockId>& new_clb_atoms,
118118
bool during_packing,
119119
t_clustering_data& clustering_data,
@@ -129,17 +129,17 @@ bool pack_mol_in_existing_cluster(t_pack_molecule* molecule,
129129
*/
130130
void fix_clustered_netlist(t_pack_molecule* molecule,
131131
int molecule_size,
132-
const ClusterBlockId& old_clb,
133-
const ClusterBlockId& new_clb);
132+
ClusterBlockId old_clb,
133+
ClusterBlockId new_clb);
134134

135135
/**
136136
* @brief A function that commits the molecule move if it is legal
137137
*
138138
* @params during_packing: true if this function is called during packing, false if it is called during placement
139139
* @params new_clb_created: true if the move is creating a new cluster (e.g. move_mol_to_new_cluster)
140140
*/
141-
void commit_mol_move(const ClusterBlockId& old_clb,
142-
const ClusterBlockId& new_clb,
141+
void commit_mol_move(ClusterBlockId old_clb,
142+
ClusterBlockId new_clb,
143143
bool during_packing,
144144
bool new_clb_created);
145145

@@ -150,7 +150,7 @@ void commit_mol_move(const ClusterBlockId& old_clb,
150150
* @params new_clb_created: true if the move is creating a new cluster (e.g. move_mol_to_new_cluster)
151151
* @params
152152
*/
153-
void revert_mol_move(const ClusterBlockId& old_clb,
153+
void revert_mol_move(ClusterBlockId old_clb,
154154
t_pack_molecule* molecule,
155155
t_lb_router_data*& old_router_data,
156156
bool during_packing,
@@ -170,18 +170,16 @@ bool is_cluster_legal(t_lb_router_data*& router_data);
170170
*/
171171
void commit_mol_removal(const t_pack_molecule* molecule,
172172
const int& molecule_size,
173-
const ClusterBlockId& old_clb,
173+
ClusterBlockId old_clb,
174174
bool during_packing,
175175
t_lb_router_data*& router_data,
176176
t_clustering_data& clustering_data);
177177

178178
/**
179-
*
180179
* @brief A function that check that two clusters are of the same type and in the same mode of operation
181-
*
182180
*/
183-
bool check_type_and_mode_compitability(const ClusterBlockId& old_clb,
184-
const ClusterBlockId& new_clb,
181+
bool check_type_and_mode_compatibility(ClusterBlockId old_clb,
182+
ClusterBlockId new_clb,
185183
int verbosity);
186184

187185
#endif

0 commit comments

Comments
 (0)