Merge remote-tracking branch 'parallax/master'

This commit is contained in:
Matt Liberty 2025-09-12 15:55:28 +00:00
commit 3b2961ebd2
8 changed files with 46 additions and 36 deletions

View File

@ -613,6 +613,6 @@ add_custom_target(sta_tags
add_custom_command( add_custom_command(
TARGET OpenSTA TARGET OpenSTA
POST_BUILD POST_BUILD
COMMAND ${CMAKE_SOURCE_DIR}/etc/FindMessages.tcl > ${CMAKE_SOURCE_DIR}/doc/messages.txt || true COMMAND ${STA_HOME}/etc/FindMessages.tcl > ${STA_HOME}/doc/messages.txt || true
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${STA_HOME}
) )

View File

@ -332,6 +332,7 @@ protected:
// These fields are written by multiple threads, so they // These fields are written by multiple threads, so they
// cannot share the same word as the following bit fields. // cannot share the same word as the following bit fields.
uint32_t tag_group_index_; uint32_t tag_group_index_;
uint32_t object_idx_;
// Each bit corresponds to a different BFS queue. // Each bit corresponds to a different BFS queue.
std::atomic<uint8_t> bfs_in_queue_; // 8 std::atomic<uint8_t> bfs_in_queue_; // 8
@ -343,7 +344,6 @@ protected:
// This flag distinguishes the driver and load vertices. // This flag distinguishes the driver and load vertices.
bool is_bidirect_drvr_:1; bool is_bidirect_drvr_:1;
unsigned object_idx_:VertexTable::idx_bits; // 7
bool is_reg_clk_:1; bool is_reg_clk_:1;
bool is_disabled_constraint_:1; bool is_disabled_constraint_:1;
bool is_gated_clk_enable_:1; bool is_gated_clk_enable_:1;

View File

@ -421,6 +421,7 @@ protected:
DcalcAnalysisPt *dcalc_ap_max); DcalcAnalysisPt *dcalc_ap_max);
void deleteTags(); void deleteTags();
void deleteTagsPrev(); void deleteTagsPrev();
void deleteUnusedTagGroups();
void seedInvalidArrivals(); void seedInvalidArrivals();
void seedArrivals(); void seedArrivals();
void findClockVertices(VertexSet &vertices); void findClockVertices(VertexSet &vertices);

View File

@ -352,12 +352,9 @@ Genclks::seedSrcPins(Clock *clk,
{ {
VertexSet src_vertices(graph_); VertexSet src_vertices(graph_);
clk->srcPinVertices(src_vertices, network_, graph_); clk->srcPinVertices(src_vertices, network_, graph_);
VertexSet::Iterator vertex_iter(src_vertices); for (Vertex *vertex : src_vertices)
while (vertex_iter.hasNext()) {
Vertex *vertex = vertex_iter.next();
iter.enqueue(vertex); iter.enqueue(vertex);
} }
}
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
@ -972,11 +969,22 @@ Genclks::recordSrcPaths(Clock *gclk)
network_->pathName(gclk_pin), network_->pathName(gclk_pin),
gclk->masterClk()->name()); gclk->masterClk()->name());
} }
// This can be narrowed to visited vertices. deleteGenclkSrcPaths(gclk);
VertexIterator vertex_iter(graph_); }
while (vertex_iter.hasNext()) {
Vertex *vertex = vertex_iter.next(); void
Genclks:: deleteGenclkSrcPaths(Clock *gclk)
{
GenclkInfo *genclk_info = genclkInfo(gclk);
GenClkInsertionSearchPred srch_pred(gclk, nullptr, genclk_info, this);
BfsFwdIterator insert_iter(BfsIndex::other, &srch_pred, this);
FilterPath *src_filter = genclk_info->srcFilter();
seedSrcPins(gclk, src_filter, insert_iter);
GenClkArrivalSearchPred eval_pred(gclk, this);
while (insert_iter.hasNext()) {
Vertex *vertex = insert_iter.next();
search_->deletePaths(vertex); search_->deletePaths(vertex);
insert_iter.enqueueAdjacentVertices(vertex, &srch_pred);
} }
} }

View File

@ -130,6 +130,7 @@ private:
VertexSet &path_vertices, VertexSet &path_vertices,
VertexSet &visited_vertices, VertexSet &visited_vertices,
EdgeSet *&fdbk_edges); EdgeSet *&fdbk_edges);
void deleteGenclkSrcPaths(Clock *gclk);
bool found_insertion_delays_; bool found_insertion_delays_;
GenclkSrcPathMap genclk_src_paths_; GenclkSrcPathMap genclk_src_paths_;

View File

@ -429,8 +429,10 @@ Search::deletePaths(Vertex *vertex)
debugPrint(debug_, "search", 4, "delete paths %s", debugPrint(debug_, "search", 4, "delete paths %s",
vertex->name(network_)); vertex->name(network_));
TagGroup *tag_group = tagGroup(vertex); TagGroup *tag_group = tagGroup(vertex);
if (tag_group) if (tag_group) {
graph_->deletePaths(vertex); graph_->deletePaths(vertex);
tag_group->decrRefCount();
}
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
@ -633,6 +635,16 @@ Search::deleteTagsPrev()
tag_groups_prev_.clear(); tag_groups_prev_.clear();
} }
void
Search::deleteUnusedTagGroups()
{
for (TagGroupIndex i = 0; i < tag_group_next_; i++) {
TagGroup *group = tag_groups_[i];
if (group && group->refCount() == 0)
deleteTagGroup(group);
}
}
VertexSeq VertexSeq
Search::filteredEndpoints() Search::filteredEndpoints()
{ {
@ -1062,6 +1074,7 @@ Search::findArrivals1(Level level)
Stats stats(debug_, report_); Stats stats(debug_, report_);
int arrival_count = arrival_iter_->visitParallel(level, arrival_visitor_); int arrival_count = arrival_iter_->visitParallel(level, arrival_visitor_);
deleteTagsPrev(); deleteTagsPrev();
deleteUnusedTagGroups();
stats.report("Find arrivals"); stats.report("Find arrivals");
if (arrival_iter_->empty() if (arrival_iter_->empty()
&& invalid_arrivals_->empty()) { && invalid_arrivals_->empty()) {
@ -2757,42 +2770,27 @@ Search::setVertexArrivals(Vertex *vertex,
TagGroup *prev_tag_group = tagGroup(vertex); TagGroup *prev_tag_group = tagGroup(vertex);
Path *prev_paths = graph_->paths(vertex); Path *prev_paths = graph_->paths(vertex);
TagGroup *tag_group = findTagGroup(tag_bldr); TagGroup *tag_group = findTagGroup(tag_bldr);
size_t path_count = tag_group->pathCount(); if (tag_group == prev_tag_group) {
// Reuse path array if it is the same size.
if (prev_tag_group
&& path_count == prev_tag_group->pathCount()) {
tag_bldr->copyPaths(tag_group, prev_paths); tag_bldr->copyPaths(tag_group, prev_paths);
vertex->setTagGroupIndex(tag_group->index());
if (tag_group->hasFilterTag()) {
LockGuard lock(filtered_arrivals_lock_);
filtered_arrivals_->insert(vertex);
}
requiredInvalid(vertex); requiredInvalid(vertex);
} }
else { else {
if (prev_tag_group) { if (prev_tag_group) {
graph_->deletePaths(vertex); graph_->deletePaths(vertex);
prev_tag_group->decrRefCount();
requiredInvalid(vertex); requiredInvalid(vertex);
} }
size_t path_count = tag_group->pathCount();
Path *paths = graph_->makePaths(vertex, path_count); Path *paths = graph_->makePaths(vertex, path_count);
tag_bldr->copyPaths(tag_group, paths); tag_bldr->copyPaths(tag_group, paths);
vertex->setTagGroupIndex(tag_group->index()); vertex->setTagGroupIndex(tag_group->index());
tag_group->incrRefCount();
}
if (tag_group->hasFilterTag()) { if (tag_group->hasFilterTag()) {
LockGuard lock(filtered_arrivals_lock_); LockGuard lock(filtered_arrivals_lock_);
filtered_arrivals_->insert(vertex); filtered_arrivals_->insert(vertex);
} }
} }
if (tag_group != prev_tag_group) {
LockGuard lock(tag_group_lock_);
tag_group->incrRefCount();
if (prev_tag_group) {
prev_tag_group->decrRefCount();
if (prev_tag_group->refCount() == 0)
deleteTagGroup(prev_tag_group);
}
}
}
} }
void void

View File

@ -252,7 +252,7 @@ vertex_worst_slack_path(Vertex *vertex,
} }
int int
tag_group_path_count() tag_group_count()
{ {
return Sta::sta()->tagGroupCount(); return Sta::sta()->tagGroupCount();
} }

View File

@ -24,6 +24,8 @@
#pragma once #pragma once
#include <atomic>
#include "Vector.hh" #include "Vector.hh"
#include "Map.hh" #include "Map.hh"
#include "Iterator.hh" #include "Iterator.hh"
@ -75,7 +77,7 @@ protected:
// tag -> path index // tag -> path index
PathIndexMap *path_index_map_; PathIndexMap *path_index_map_;
size_t hash_; size_t hash_;
int ref_count_; std::atomic<int> ref_count_;
unsigned int index_:tag_group_index_bits; unsigned int index_:tag_group_index_bits;
bool has_clk_tag_:1; bool has_clk_tag_:1;
bool has_genclk_src_tag_:1; bool has_genclk_src_tag_:1;