Skip to content

Commit c5bc07b

Browse files
Merge pull request #713 from os-fpga/partitioner_clean
Valgrind fixes
2 parents b2d9a33 + 3ef5dd4 commit c5bc07b

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

include/packer_fix/nl_Par.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ using std::endl;
1818

1919
uint Par::countMolecules(t_pack_molecule* molecule_head) {
2020
uint cnt = 0;
21-
AtomNetlist myNetlist = g_vpr_ctx.atom().nlist;
2221
for (auto cur_mol = molecule_head; cur_mol; cur_mol = cur_mol->next) {
2322
cnt++;
2423
}
@@ -31,7 +30,7 @@ bool Par::init(t_pack_molecule* molecule_head) {
3130
set_ltrace(3);
3231
auto tr = ltrace();
3332

34-
AtomNetlist myNetlist = g_vpr_ctx.atom().nlist;
33+
const AtomNetlist& myNetlist = g_vpr_ctx.atom().nlist;
3534
for (auto cur_mol = molecule_head; cur_mol; cur_mol = cur_mol->next) {
3635
molecules_.push_back(cur_mol);
3736
numMolecules_++;
@@ -68,11 +67,13 @@ bool Par::init(t_pack_molecule* molecule_head) {
6867
for (auto molecule : molecules_) {
6968
string name_block = "";
7069
for (auto abid : molecule->atom_block_ids) {
71-
name_block += myNetlist.block_name(abid);
72-
uint bid = size_t(abid);
73-
if (bid >= numAtoms_) continue;
74-
VTR_ASSERT(atomBlockIdToMolId_[bid] == -1);
75-
atomBlockIdToMolId_[bid] = i;
70+
if (abid.is_valid()) {
71+
name_block += myNetlist.block_name(abid);
72+
uint bid = size_t(abid);
73+
if (bid >= numAtoms_) continue;
74+
VTR_ASSERT(atomBlockIdToMolId_[bid] == -1);
75+
atomBlockIdToMolId_[bid] = i;
76+
}
7677
}
7778
molIdToName_[i] = name_block;
7879
i++;
@@ -163,7 +164,7 @@ bool Par::Bi_Partion(uint partition_index) {
163164
MoleculesToIntermediate.push_back(-1);
164165
}
165166
}
166-
AtomNetlist myNetlist = g_vpr_ctx.atom().nlist;
167+
const AtomNetlist& myNetlist = g_vpr_ctx.atom().nlist;
167168
vector<string> uniqueLines;
168169
vector<int> lineCounts;
169170

@@ -323,7 +324,7 @@ struct partition_position {
323324
}
324325

325326
bool Par::recursive_partitioning(int molecule_per_partition) {
326-
AtomNetlist myNetlist = g_vpr_ctx.atom().nlist;
327+
const AtomNetlist& myNetlist = g_vpr_ctx.atom().nlist;
327328
//// auto& device_ctx = g_vpr_ctx.device();
328329
//// auto& grid = device_ctx.grid;
329330
vector<int> partion_size;

0 commit comments

Comments
 (0)