Tag, TagGroup use UnorderedSet

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2021-12-09 18:19:26 -07:00
parent d138fc1a15
commit ddefa2a28d
5 changed files with 30 additions and 17 deletions

View File

@ -19,7 +19,7 @@
#include <mutex>
#include "MinMax.hh"
#include "HashSet.hh"
#include "UnorderedSet.hh"
#include "Transition.hh"
#include "LibertyClass.hh"
#include "NetworkClass.hh"
@ -55,8 +55,8 @@ class Genclks;
class Corner;
typedef Set<ClkInfo*, ClkInfoLess> ClkInfoSet;
typedef HashSet<Tag*, TagHash, TagEqual> TagHashSet;
typedef HashSet<TagGroup*, TagGroupHash, TagGroupEqual> TagGroupSet;
typedef UnorderedSet<Tag*, TagHash, TagEqual> TagSet;
typedef UnorderedSet<TagGroup*, TagGroupHash, TagGroupEqual> TagGroupSet;
typedef Map<Vertex*, Slack> VertexSlackMap;
typedef Vector<VertexSlackMap> VertexSlackMapSeq;
typedef Vector<WorstSlacks> WorstSlacksSeq;
@ -568,7 +568,7 @@ protected:
ClkInfoSet *clk_info_set_;
std::mutex clk_info_lock_;
// Use pointer to tag set so Tag.hh does not need to be included.
TagHashSet *tag_set_;
TagSet *tag_set_;
// Entries in tags_ may be missing where previous filter tags were deleted.
TagIndex tag_capacity_;
Tag **tags_;

View File

@ -31,6 +31,11 @@ public:
{
}
explicit UnorderedSet(size_t size) :
std::unordered_set<KEY, HASH, EQUAL>(size)
{
}
explicit UnorderedSet(size_t size,
const HASH &hash,
const EQUAL &equal) :

View File

@ -235,14 +235,14 @@ Search::init(StaState *sta)
arrival_iter_ = new BfsFwdIterator(BfsIndex::arrival, nullptr, sta);
required_iter_ = new BfsBkwdIterator(BfsIndex::required, search_adj_, sta);
tag_capacity_ = 127;
tag_set_ = new TagHashSet(tag_capacity_, false);
tag_set_ = new TagSet(tag_capacity_);
clk_info_set_ = new ClkInfoSet(ClkInfoLess(sta));
tag_next_ = 0;
tags_ = new Tag*[tag_capacity_];
tag_group_capacity_ = 127;
tag_groups_ = new TagGroup*[tag_group_capacity_];
tag_group_next_ = 0;
tag_group_set_ = new TagGroupSet(tag_group_capacity_, false);
tag_group_set_ = new TagGroupSet(tag_group_capacity_);
visit_path_ends_ = new VisitPathEnds(this);
gated_clk_ = new GatedClk(this);
path_groups_ = nullptr;
@ -2793,13 +2793,17 @@ Search::reportTagGroups() const
report_->reportLine("Group %4u hash = %4lu (%4lu)",
i,
tag_group->hash(),
tag_group->hash() % tag_group_set_->capacity());
tag_group->hash() % tag_group_set_->bucket_count());
tag_group->reportArrivalMap(this);
}
}
size_t long_hash = tag_group_set_->longestBucketHash();
report_->reportLine("Longest hash bucket length %d hash=%lu",
tag_group_set_->bucketLength(long_hash),
size_t long_hash = 0;
for (size_t i = 0; i < tag_group_set_->bucket_count(); i++) {
if (tag_group_set_->bucket_size(i) > long_hash)
long_hash = i;
}
report_->reportLine("Longest hash bucket length %zu hash=%zu",
tag_group_set_->bucket_size(long_hash),
long_hash);
}
@ -2903,9 +2907,13 @@ Search::reportTags() const
if (tag)
report_->reportLine("%s", tag->asString(this)) ;
}
size_t long_hash = tag_set_->longestBucketHash();
report_->reportLine("Longest hash bucket length %d hash=%zu",
tag_set_->bucketLength(long_hash),
size_t long_hash = 0;
for (size_t i = 0; i < tag_set_->bucket_count(); i++) {
if (tag_set_->bucket_size(i) > long_hash)
long_hash = i;
}
report_->reportLine("Longest hash bucket length %zu hash=%zu",
tag_set_->bucket_size(long_hash),
long_hash);
}

View File

@ -654,14 +654,14 @@ tagStateEqualCrpr(const Tag *tag1,
////////////////////////////////////////////////////////////////
size_t
TagHash::operator()(const Tag *tag)
TagHash::operator()(const Tag *tag) const
{
return tag->hash();
}
bool
TagEqual::operator()(const Tag *tag1,
const Tag *tag2)
const Tag *tag2) const
{
return tagEqual(tag1, tag2);
}

View File

@ -120,14 +120,14 @@ public:
class TagHash
{
public:
size_t operator()(const Tag *tag);
size_t operator()(const Tag *tag) const;
};
class TagEqual
{
public:
bool operator()(const Tag *tag1,
const Tag *tag2);
const Tag *tag2) const;
};
int