Skip to content

Commit 9f3bbd3

Browse files
Revert "vpr: Changed transitive_fanout_candidates to unordered_set"
This reverts commit 14723f5. Go back to unordered_map to avoid the non-deterministic behaviour of hashing pointers.
1 parent 2349f3e commit 9f3bbd3

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

vpr/src/pack/cluster.cpp

Lines changed: 8 additions & 6 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(t_pack_molecule *molecule,
225+
static void update_cluster_stats( const 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,7 +413,8 @@ 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, sizeof(int));
416+
hill_climbing_inputs_avail = (int *) vtr::calloc(max_cluster_size + 1,
417+
sizeof(int));
417418
} else {
418419
hill_climbing_inputs_avail = nullptr; /* if used, die hard */
419420
}
@@ -1690,7 +1691,7 @@ static void update_total_gain(float alpha, float beta, bool timing_driven,
16901691
}
16911692

16921693
/*****************************************/
1693-
static void update_cluster_stats(t_pack_molecule *molecule,
1694+
static void update_cluster_stats( const t_pack_molecule *molecule,
16941695
const ClusterBlockId clb_index,
16951696
const std::unordered_set<AtomNetId>& is_clock,
16961697
const std::unordered_set<AtomNetId>& is_global,
@@ -1793,7 +1794,7 @@ static void update_cluster_stats(t_pack_molecule *molecule,
17931794

17941795
// if this molecule came from the transitive fanout candidates remove it
17951796
if (cb) {
1796-
cb->pb_stats->transitive_fanout_candidates.erase(molecule);
1797+
cb->pb_stats->transitive_fanout_candidates.erase(molecule->atom_block_ids[molecule->root]);
17971798
cb->pb_stats->explore_transitive_fanout = true;
17981799
}
17991800
}
@@ -2108,7 +2109,7 @@ void add_cluster_molecule_candidates_by_transitive_connectivity(t_pb* cur_pb,
21082109
clb_inter_blk_nets);
21092110
/* Only consider candidates that pass a very simple legality check */
21102111
for(const auto& transitive_candidate : cur_pb->pb_stats->transitive_fanout_candidates) {
2111-
t_pack_molecule* molecule = transitive_candidate;
2112+
t_pack_molecule* molecule = transitive_candidate.second;
21122113
if (molecule->valid) {
21132114
bool success = true;
21142115
for (int j = 0; j < get_array_size_of_molecule(molecule); j++) {
@@ -3038,6 +3039,7 @@ static void load_transitive_fanout_candidates(ClusterBlockId clb_index,
30383039
auto blk_id = atom_ctx.nlist.pin_block(tpin);
30393040
// This transitive atom is not packed, score and add
30403041
if(atom_ctx.lookup.atom_clb(blk_id) == ClusterBlockId::INVALID()) {
3042+
auto& transitive_fanout_candidates = pb_stats->transitive_fanout_candidates;
30413043

30423044
if(pb_stats->gain.count(blk_id) == 0) {
30433045
pb_stats->gain[blk_id] = 0.001;
@@ -3048,7 +3050,7 @@ static void load_transitive_fanout_candidates(ClusterBlockId clb_index,
30483050
for(const auto& kv : vtr::make_range(rng.first, rng.second)) {
30493051
t_pack_molecule* molecule = kv.second;
30503052
if (molecule->valid) {
3051-
pb_stats->transitive_fanout_candidates.insert(molecule);
3053+
transitive_fanout_candidates.insert({molecule->atom_block_ids[molecule->root], molecule});
30523054
}
30533055
}
30543056
}

vpr/src/pack/cluster_placement.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,6 @@ static void flush_intermediate_queues(
691691
/* Determine max index + 1 of molecule */
692692
int get_array_size_of_molecule(const t_pack_molecule *molecule) {
693693
if (molecule->type == MOLECULE_FORCED_PACK) {
694-
VTR_ASSERT(molecule->pack_pattern->num_blocks == molecule->num_blocks);
695694
return molecule->pack_pattern->num_blocks;
696695
} else {
697696
return molecule->num_blocks;

vpr/src/pack/pack_types.h

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

@@ -55,7 +59,7 @@ struct t_pb_stats {
5559
this high fanout net to determine the
5660
next candidate atom */
5761
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 */
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
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
5963

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

0 commit comments

Comments
 (0)