Skip to content

Commit 8ea5f5c

Browse files
Change some internal packer APIs to not use C-style arrays
This commit changes some functions that used C-style arrays to use std::vector instead. Previously we used the .data() method of std::vectors to pass a pointer to these functions.
1 parent 661debe commit 8ea5f5c

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

vpr/src/pack/cluster_legalizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ e_block_pack_status ClusterLegalizer::try_pack_molecule(PackMoleculeId molecule_
12051205
while (block_pack_status != e_block_pack_status::BLK_PASSED) {
12061206
if (!get_next_primitive_list(cluster.placement_stats,
12071207
molecule_id,
1208-
primitives_list.data(),
1208+
primitives_list,
12091209
prepacker_)) {
12101210
VTR_LOGV(log_verbosity_ > 3, "\t\tFAILED No candidate primitives available\n");
12111211
block_pack_status = e_block_pack_status::BLK_FAILED_FEASIBLE;

vpr/src/pack/cluster_placement.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ static void update_primitive_cost_or_status(t_intra_cluster_placement_stats* clu
4646
static float try_place_molecule(t_intra_cluster_placement_stats* cluster_placement_stats,
4747
PackMoleculeId molecule_id,
4848
t_pb_graph_node* root,
49-
t_pb_graph_node** primitives_list,
49+
std::vector<t_pb_graph_node*>& primitives_list,
5050
const Prepacker& prepacker);
5151

5252
static bool expand_forced_pack_molecule_placement(t_intra_cluster_placement_stats* cluster_placement_stats,
5353
PackMoleculeId molecule_id,
5454
const t_pack_pattern_block* pack_pattern_block,
55-
t_pb_graph_node** primitives_list,
55+
std::vector<t_pb_graph_node*>& primitives_list,
5656
const Prepacker& prepacker,
5757
float* cost);
5858

@@ -177,7 +177,7 @@ void free_cluster_placement_stats(t_intra_cluster_placement_stats* cluster_place
177177

178178
bool get_next_primitive_list(t_intra_cluster_placement_stats* cluster_placement_stats,
179179
PackMoleculeId molecule_id,
180-
t_pb_graph_node** primitives_list,
180+
std::vector<t_pb_graph_node*>& primitives_list,
181181
const Prepacker& prepacker,
182182
int force_site) {
183183
std::unordered_multimap<int, t_cluster_placement_primitive*>::iterator best;
@@ -479,7 +479,7 @@ static void update_primitive_cost_or_status(t_intra_cluster_placement_stats* clu
479479
static float try_place_molecule(t_intra_cluster_placement_stats* cluster_placement_stats,
480480
PackMoleculeId molecule_id,
481481
t_pb_graph_node* root,
482-
t_pb_graph_node** primitives_list,
482+
std::vector<t_pb_graph_node*>& primitives_list,
483483
const Prepacker& prepacker) {
484484
float cost = std::numeric_limits<float>::max();
485485
const t_pack_molecule& molecule = prepacker.get_molecule(molecule_id);
@@ -527,7 +527,7 @@ static float try_place_molecule(t_intra_cluster_placement_stats* cluster_placeme
527527
static bool expand_forced_pack_molecule_placement(t_intra_cluster_placement_stats* cluster_placement_stats,
528528
PackMoleculeId molecule_id,
529529
const t_pack_pattern_block* pack_pattern_block,
530-
t_pb_graph_node** primitives_list,
530+
std::vector<t_pb_graph_node*>& primitives_list,
531531
const Prepacker& prepacker,
532532
float* cost) {
533533
t_pb_graph_node* pb_graph_node = primitives_list[pack_pattern_block->block_id];

vpr/src/pack/cluster_placement.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ void free_cluster_placement_stats(t_intra_cluster_placement_stats* cluster_place
163163
bool get_next_primitive_list(
164164
t_intra_cluster_placement_stats* cluster_placement_stats,
165165
PackMoleculeId molecule_id,
166-
t_pb_graph_node** primitives_list,
166+
std::vector<t_pb_graph_node*>& primitives_list,
167167
const Prepacker& prepacker,
168168
int force_site = -1);
169169

vpr/src/pack/prepack.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ static t_pb_graph_edge* find_expansion_edge_of_pattern(const int pattern_index,
5353
const t_pb_graph_node* pb_graph_node);
5454

5555
static void forward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expansion_edge,
56-
t_pack_patterns* list_of_packing_patterns,
56+
std::vector<t_pack_patterns>& list_of_packing_patterns,
5757
const int curr_pattern_index,
5858
int* L_num_blocks,
5959
const bool make_root_of_chain);
6060

6161
static void backward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expansion_edge,
62-
t_pack_patterns* list_of_packing_patterns,
62+
std::vector<t_pack_patterns>& list_of_packing_patterns,
6363
const int curr_pattern_index,
6464
t_pb_graph_pin* destination_pin,
6565
t_pack_pattern_block* destination_block,
@@ -160,7 +160,7 @@ static std::vector<t_pack_patterns> alloc_and_load_pack_patterns(const std::vect
160160
list_of_packing_patterns[i].base_cost = 0;
161161
// use the found expansion edge to build the pack pattern
162162
backward_expand_pack_pattern_from_edge(expansion_edge,
163-
list_of_packing_patterns.data(), i, nullptr, nullptr, &L_num_blocks);
163+
list_of_packing_patterns, i, nullptr, nullptr, &L_num_blocks);
164164
list_of_packing_patterns[i].num_blocks = L_num_blocks;
165165

166166
/* Default settings: A section of a netlist must match all blocks in a pack
@@ -468,7 +468,7 @@ static t_pb_graph_edge* find_expansion_edge_of_pattern(const int pattern_index,
468468
* future multi-fanout support easier) so this function will not update connections
469469
*/
470470
static void forward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expansion_edge,
471-
t_pack_patterns* list_of_packing_patterns,
471+
std::vector<t_pack_patterns>& list_of_packing_patterns,
472472
const int curr_pattern_index,
473473
int* L_num_blocks,
474474
bool make_root_of_chain) {
@@ -610,7 +610,7 @@ static void forward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expansi
610610
* destination blocks
611611
*/
612612
static void backward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expansion_edge,
613-
t_pack_patterns* list_of_packing_patterns,
613+
std::vector<t_pack_patterns>& list_of_packing_patterns,
614614
const int curr_pattern_index,
615615
t_pb_graph_pin* destination_pin,
616616
t_pack_pattern_block* destination_block,

0 commit comments

Comments
 (0)