Skip to content

Commit 14723f5

Browse files
vpr: Changed transitive_fanout_candidates to unordered_set
1 parent f8c9afc commit 14723f5

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

vpr/src/pack/cluster.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static void mark_and_update_partial_gain(const AtomNetId inet, enum e_gain_updat
222222
static void update_total_gain(float alpha, float beta, bool timing_driven,
223223
bool connection_driven, t_pb *pb);
224224

225-
static void update_cluster_stats( const t_pack_molecule *molecule,
225+
static void update_cluster_stats(t_pack_molecule *molecule,
226226
const ClusterBlockId clb_index,
227227
const std::unordered_set<AtomNetId>& is_clock,
228228
const std::unordered_set<AtomNetId>& is_global,
@@ -413,8 +413,7 @@ std::map<t_type_ptr,size_t> do_clustering(const t_packer_opts& packer_opts, cons
413413
}
414414

415415
if (packer_opts.hill_climbing_flag) {
416-
hill_climbing_inputs_avail = (int *) vtr::calloc(max_cluster_size + 1,
417-
sizeof(int));
416+
hill_climbing_inputs_avail = (int *) vtr::calloc(max_cluster_size + 1, sizeof(int));
418417
} else {
419418
hill_climbing_inputs_avail = nullptr; /* if used, die hard */
420419
}
@@ -1691,7 +1690,7 @@ static void update_total_gain(float alpha, float beta, bool timing_driven,
16911690
}
16921691

16931692
/*****************************************/
1694-
static void update_cluster_stats( const t_pack_molecule *molecule,
1693+
static void update_cluster_stats(t_pack_molecule *molecule,
16951694
const ClusterBlockId clb_index,
16961695
const std::unordered_set<AtomNetId>& is_clock,
16971696
const std::unordered_set<AtomNetId>& is_global,
@@ -1793,7 +1792,7 @@ static void update_cluster_stats( const t_pack_molecule *molecule,
17931792
}
17941793

17951794
// if this molecule came from the transitive fanout candidates remove it
1796-
cb->pb_stats->transitive_fanout_candidates.erase(molecule->atom_block_ids[molecule->root]);
1795+
cb->pb_stats->transitive_fanout_candidates.erase(molecule);
17971796
cb->pb_stats->explore_transitive_fanout = true;
17981797
}
17991798

@@ -2106,7 +2105,7 @@ void add_cluster_molecule_candidates_by_transitive_connectivity(t_pb* cur_pb,
21062105
clb_inter_blk_nets);
21072106
/* Only consider candidates that pass a very simple legality check */
21082107
for(const auto& transitive_candidate : cur_pb->pb_stats->transitive_fanout_candidates) {
2109-
t_pack_molecule* molecule = transitive_candidate.second;
2108+
t_pack_molecule* molecule = transitive_candidate;
21102109
if (molecule->valid) {
21112110
bool success = true;
21122111
for (int j = 0; j < get_array_size_of_molecule(molecule); j++) {
@@ -3036,7 +3035,6 @@ static void load_transitive_fanout_candidates(ClusterBlockId clb_index,
30363035
auto blk_id = atom_ctx.nlist.pin_block(tpin);
30373036
// This transitive atom is not packed, score and add
30383037
if(atom_ctx.lookup.atom_clb(blk_id) == ClusterBlockId::INVALID()) {
3039-
auto& transitive_fanout_candidates = pb_stats->transitive_fanout_candidates;
30403038

30413039
if(pb_stats->gain.count(blk_id) == 0) {
30423040
pb_stats->gain[blk_id] = 0.001;
@@ -3047,7 +3045,7 @@ static void load_transitive_fanout_candidates(ClusterBlockId clb_index,
30473045
for(const auto& kv : vtr::make_range(rng.first, rng.second)) {
30483046
t_pack_molecule* molecule = kv.second;
30493047
if (molecule->valid) {
3050-
transitive_fanout_candidates.insert({molecule->atom_block_ids[molecule->root], molecule});
3048+
pb_stats->transitive_fanout_candidates.insert(molecule);
30513049
}
30523050
}
30533051
}

vpr/src/pack/cluster_placement.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@ static void flush_intermediate_queues(
689689
/* Determine max index + 1 of molecule */
690690
int get_array_size_of_molecule(const t_pack_molecule *molecule) {
691691
if (molecule->type == MOLECULE_FORCED_PACK) {
692+
VTR_ASSERT(molecule->pack_pattern->num_blocks == molecule->num_blocks);
692693
return molecule->pack_pattern->num_blocks;
693694
} else {
694695
return molecule->num_blocks;

vpr/src/pack/pack_types.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
*
77
* Defines core data structures used in packing
88
*/
9-
#include <map>
10-
#include <unordered_map>
11-
#include <vector>
12-
139
#include "arch_types.h"
1410
#include "atom_netlist_fwd.h"
1511

@@ -59,7 +55,7 @@ struct t_pb_stats {
5955
this high fanout net to determine the
6056
next candidate atom */
6157
bool explore_transitive_fanout; /* If no marked candidate molecules and no high fanout nets to determine next candidate molecule then explore molecules on transitive fanout */
62-
std::unordered_map<AtomBlockId, t_pack_molecule *> transitive_fanout_candidates; // Holding trasitive fanout candidates key: root block id of the molecule, value: pointer to the molecule
58+
std::unordered_set<t_pack_molecule *> transitive_fanout_candidates; // Holding trasitive fanout candidates key: root block id of the molecule, value: pointer to the molecule
6359

6460
/* How many pins of each atom net are contained in the *
6561
* currently open pb? */

0 commit comments

Comments
 (0)