diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bd50074..43b627b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -562,8 +562,8 @@ set(CXX_FLAGS -Wall -Wextra -pedantic -Wcast-qual -Wredundant-decls -Wformat-sec if(USE_SANITIZE) message(STATUS "Sanitize: ${USE_SANITIZE}") - set(CXX_FLAGS "${CXX_FLAGS};-fsanitize=address;-fno-omit-frame-pointer;-fno-common") - set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=address") + set(CXX_FLAGS "${CXX_FLAGS};-fsanitize=thread") + set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=thread") endif() target_compile_options(OpenSTA diff --git a/include/sta/Search.hh b/include/sta/Search.hh index 5828f7ba..86f43c1e 100644 --- a/include/sta/Search.hh +++ b/include/sta/Search.hh @@ -583,12 +583,14 @@ protected: // Entries in tags_ may be missing where previous filter tags were deleted. TagIndex tag_capacity_; Tag **tags_; + Tag **tags_prev_; TagIndex tag_next_; // Holes in tags_ left by deleting filter tags. std::vector tag_free_indices_; std::mutex tag_lock_; TagGroupSet *tag_group_set_; TagGroup **tag_groups_; + TagGroup **tag_groups_prev_; TagGroupIndex tag_group_next_; // Holes in tag_groups_ left by deleting filter tag groups. std::vector tag_group_free_indices_; diff --git a/parasitics/ConcreteParasitics.cc b/parasitics/ConcreteParasitics.cc index d636ea05..5a78c154 100644 --- a/parasitics/ConcreteParasitics.cc +++ b/parasitics/ConcreteParasitics.cc @@ -946,9 +946,9 @@ ConcreteParasitics::findPiElmore(const Pin *drvr_pin, const RiseFall *rf, const ParasiticAnalysisPt *ap) const { + LockGuard lock(lock_); if (!drvr_parasitic_map_.empty()) { int ap_rf_index = parasiticAnalysisPtIndex(ap, rf); - LockGuard lock(lock_); ConcreteParasitic **parasitics = drvr_parasitic_map_.findKey(drvr_pin); if (parasitics) { ConcreteParasitic *parasitic = parasitics[ap_rf_index]; diff --git a/search/PathGroup.cc b/search/PathGroup.cc index 0b61358e..c9a3cb21 100644 --- a/search/PathGroup.cc +++ b/search/PathGroup.cc @@ -95,17 +95,22 @@ PathGroup::~PathGroup() bool PathGroup::savable(PathEnd *path_end) { + float threshold; + { + LockGuard lock(lock_); + threshold = threshold_; + } bool savable = false; if (compare_slack_) { // Crpr increases the slack, so check the slack // without crpr first because it is expensive to find. Slack slack = path_end->slackNoCrpr(sta_); if (!delayIsInitValue(slack, min_max_) - && delayLessEqual(slack, threshold_, sta_) + && delayLessEqual(slack, threshold, sta_) && delayLessEqual(slack, slack_max_, sta_)) { // Now check with crpr. slack = path_end->slack(sta_); - savable = delayLessEqual(slack, threshold_, sta_) + savable = delayLessEqual(slack, threshold, sta_) && delayLessEqual(slack, slack_max_, sta_) && delayGreaterEqual(slack, slack_min_, sta_); } @@ -113,7 +118,7 @@ PathGroup::savable(PathEnd *path_end) else { const Arrival &arrival = path_end->dataArrivalTime(sta_); savable = !delayIsInitValue(arrival, min_max_) - && delayGreaterEqual(arrival, threshold_, min_max_, sta_); + && delayGreaterEqual(arrival, threshold, min_max_, sta_); } return savable; } diff --git a/search/Search.cc b/search/Search.cc index 1a358e54..3f1b7bb9 100644 --- a/search/Search.cc +++ b/search/Search.cc @@ -237,8 +237,10 @@ Search::init(StaState *sta) clk_info_set_ = new ClkInfoSet(ClkInfoLess(sta)); tag_next_ = 0; tags_ = new Tag*[tag_capacity_]; + tags_prev_ = nullptr; tag_group_capacity_ = 127; tag_groups_ = new TagGroup*[tag_group_capacity_]; + tag_groups_prev_ = nullptr; tag_group_next_ = 0; tag_group_set_ = new TagGroupSet(tag_group_capacity_); pending_latch_outputs_ = new VertexSet(graph_); @@ -270,7 +272,9 @@ Search::~Search() delete tag_set_; delete clk_info_set_; delete [] tags_; + delete [] tags_prev_; delete [] tag_groups_; + delete [] tag_groups_prev_; delete tag_group_set_; delete search_adj_; delete eval_pred_; @@ -2647,15 +2651,15 @@ Search::findTagGroup(TagGroupBldr *tag_bldr) // std::vector doesn't seem to follow this protocol so multi-thread // search fails occasionally if a vector is used for tag_groups_. if (tag_group_next_ == tag_group_capacity_) { - TagGroupIndex new_capacity = nextMersenne(tag_group_capacity_); - TagGroup **new_tag_groups = new TagGroup*[new_capacity]; - memcpy(new_tag_groups, tag_groups_, + TagGroupIndex tag_capacity = tag_group_capacity_ * 2; + TagGroup **tag_groups = new TagGroup*[tag_capacity]; + memcpy(tag_groups, tag_groups_, tag_group_capacity_ * sizeof(TagGroup*)); - TagGroup **old_tag_groups = tag_groups_; - tag_groups_ = new_tag_groups; - tag_group_capacity_ = new_capacity; - delete [] old_tag_groups; - tag_group_set_->reserve(new_capacity); + delete [] tag_groups_prev_; + tag_groups_prev_ = tag_groups_; + tag_groups_ = tag_groups; + tag_group_capacity_ = tag_capacity; + tag_group_set_->reserve(tag_capacity); } if (tag_group_next_ > tag_group_index_max) report_->critical(1510, "max tag group index exceeded"); @@ -2888,14 +2892,14 @@ Search::findTag(const RiseFall *rf, // std::vector doesn't seem to follow this protocol so multi-thread // search fails occasionally if a vector is used for tags_. if (tag_next_ == tag_capacity_) { - TagIndex new_capacity = nextMersenne(tag_capacity_); - Tag **new_tags = new Tag*[new_capacity]; - memcpy(new_tags, tags_, tag_capacity_ * sizeof(Tag*)); - Tag **old_tags = tags_; - tags_ = new_tags; - delete [] old_tags; - tag_capacity_ = new_capacity; - tag_set_->reserve(new_capacity); + TagIndex tag_capacity = tag_capacity_ * 2; + Tag **tags = new Tag*[tag_capacity]; + memcpy(tags, tags_, tag_capacity_ * sizeof(Tag*)); + delete [] tags_prev_; + tags_prev_ = tags_; + tags_ = tags; + tag_capacity_ = tag_capacity; + tag_set_->reserve(tag_capacity); } if (tag_next_ == tag_index_max) report_->critical(1511, "max tag index exceeded");