tag group ref count w/threads
commit d7e45e73e7b3a5b9b3b00eeaaff6c5608fd15a44
Author: James Cherry <cherry@parallaxsw.com>
Date: Fri Sep 12 08:41:14 2025 -0700
tag group ref count w/threads
Signed-off-by: James Cherry <cherry@parallaxsw.com>
Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
parent
2412feec33
commit
30c8230f68
|
|
@ -332,6 +332,7 @@ protected:
|
|||
// These fields are written by multiple threads, so they
|
||||
// cannot share the same word as the following bit fields.
|
||||
uint32_t tag_group_index_;
|
||||
uint32_t object_idx_;
|
||||
// Each bit corresponds to a different BFS queue.
|
||||
std::atomic<uint8_t> bfs_in_queue_; // 8
|
||||
|
||||
|
|
@ -343,7 +344,6 @@ protected:
|
|||
// This flag distinguishes the driver and load vertices.
|
||||
bool is_bidirect_drvr_:1;
|
||||
|
||||
unsigned object_idx_:VertexTable::idx_bits; // 7
|
||||
bool is_reg_clk_:1;
|
||||
bool is_disabled_constraint_:1;
|
||||
bool is_gated_clk_enable_:1;
|
||||
|
|
|
|||
|
|
@ -421,6 +421,7 @@ protected:
|
|||
DcalcAnalysisPt *dcalc_ap_max);
|
||||
void deleteTags();
|
||||
void deleteTagsPrev();
|
||||
void deleteUnusedTagGroups();
|
||||
void seedInvalidArrivals();
|
||||
void seedArrivals();
|
||||
void findClockVertices(VertexSet &vertices);
|
||||
|
|
|
|||
|
|
@ -429,8 +429,10 @@ Search::deletePaths(Vertex *vertex)
|
|||
debugPrint(debug_, "search", 4, "delete paths %s",
|
||||
vertex->name(network_));
|
||||
TagGroup *tag_group = tagGroup(vertex);
|
||||
if (tag_group)
|
||||
if (tag_group) {
|
||||
graph_->deletePaths(vertex);
|
||||
tag_group->decrRefCount();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
@ -633,6 +635,16 @@ Search::deleteTagsPrev()
|
|||
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
|
||||
Search::filteredEndpoints()
|
||||
{
|
||||
|
|
@ -1062,6 +1074,7 @@ Search::findArrivals1(Level level)
|
|||
Stats stats(debug_, report_);
|
||||
int arrival_count = arrival_iter_->visitParallel(level, arrival_visitor_);
|
||||
deleteTagsPrev();
|
||||
deleteUnusedTagGroups();
|
||||
stats.report("Find arrivals");
|
||||
if (arrival_iter_->empty()
|
||||
&& invalid_arrivals_->empty()) {
|
||||
|
|
@ -2757,40 +2770,25 @@ Search::setVertexArrivals(Vertex *vertex,
|
|||
TagGroup *prev_tag_group = tagGroup(vertex);
|
||||
Path *prev_paths = graph_->paths(vertex);
|
||||
TagGroup *tag_group = findTagGroup(tag_bldr);
|
||||
size_t path_count = tag_group->pathCount();
|
||||
// Reuse path array if it is the same size.
|
||||
if (prev_tag_group
|
||||
&& path_count == prev_tag_group->pathCount()) {
|
||||
if (tag_group == prev_tag_group) {
|
||||
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);
|
||||
}
|
||||
else {
|
||||
if (prev_tag_group) {
|
||||
graph_->deletePaths(vertex);
|
||||
prev_tag_group->decrRefCount();
|
||||
requiredInvalid(vertex);
|
||||
}
|
||||
size_t path_count = tag_group->pathCount();
|
||||
Path *paths = graph_->makePaths(vertex, path_count);
|
||||
tag_bldr->copyPaths(tag_group, paths);
|
||||
|
||||
vertex->setTagGroupIndex(tag_group->index());
|
||||
if (tag_group->hasFilterTag()) {
|
||||
LockGuard lock(filtered_arrivals_lock_);
|
||||
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);
|
||||
}
|
||||
}
|
||||
if (tag_group->hasFilterTag()) {
|
||||
LockGuard lock(filtered_arrivals_lock_);
|
||||
filtered_arrivals_->insert(vertex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ vertex_worst_slack_path(Vertex *vertex,
|
|||
}
|
||||
|
||||
int
|
||||
tag_group_path_count()
|
||||
tag_group_count()
|
||||
{
|
||||
return Sta::sta()->tagGroupCount();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include "Vector.hh"
|
||||
#include "Map.hh"
|
||||
#include "Iterator.hh"
|
||||
|
|
@ -75,7 +77,7 @@ protected:
|
|||
// tag -> path index
|
||||
PathIndexMap *path_index_map_;
|
||||
size_t hash_;
|
||||
int ref_count_;
|
||||
std::atomic<int> ref_count_;
|
||||
unsigned int index_:tag_group_index_bits;
|
||||
bool has_clk_tag_:1;
|
||||
bool has_genclk_src_tag_:1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue