diff --git a/include/sta/Search.hh b/include/sta/Search.hh index 3f4331ec..72d00664 100644 --- a/include/sta/Search.hh +++ b/include/sta/Search.hh @@ -19,7 +19,7 @@ #include #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 ClkInfoSet; -typedef HashSet TagHashSet; -typedef HashSet TagGroupSet; +typedef UnorderedSet TagSet; +typedef UnorderedSet TagGroupSet; typedef Map VertexSlackMap; typedef Vector VertexSlackMapSeq; typedef Vector 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_; diff --git a/include/sta/UnorderedSet.hh b/include/sta/UnorderedSet.hh index b7860693..4138c1e6 100644 --- a/include/sta/UnorderedSet.hh +++ b/include/sta/UnorderedSet.hh @@ -31,6 +31,11 @@ public: { } + explicit UnorderedSet(size_t size) : + std::unordered_set(size) + { + } + explicit UnorderedSet(size_t size, const HASH &hash, const EQUAL &equal) : diff --git a/search/Search.cc b/search/Search.cc index 6f3fbd75..21bc85e6 100644 --- a/search/Search.cc +++ b/search/Search.cc @@ -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); } diff --git a/search/Tag.cc b/search/Tag.cc index 61a4ff91..9835d5dd 100644 --- a/search/Tag.cc +++ b/search/Tag.cc @@ -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); } diff --git a/search/Tag.hh b/search/Tag.hh index 8b1fdbe1..c9c9564c 100644 --- a/search/Tag.hh +++ b/search/Tag.hh @@ -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