Revert "handle MT issues in setVertexArrivals, fix non-determ crash"
This reverts commit for serVertexArrivals MT safe change 16c2678e51.
This commit is contained in:
parent
0a8ccbd3c4
commit
3afeba7212
|
|
@ -1126,12 +1126,6 @@ Vertex::deletePaths()
|
||||||
tag_group_index_ = tag_group_index_max;
|
tag_group_index_ = tag_group_index_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Vertex::setPathsDeferred(Path *paths)
|
|
||||||
{
|
|
||||||
paths_ = paths;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Vertex::hasFanin() const
|
Vertex::hasFanin() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -264,9 +264,6 @@ public:
|
||||||
Path *makePaths(uint32_t count);
|
Path *makePaths(uint32_t count);
|
||||||
void setPaths(Path *paths);
|
void setPaths(Path *paths);
|
||||||
void deletePaths();
|
void deletePaths();
|
||||||
// Set paths_ without deleting the old array.
|
|
||||||
// Caller is responsible for deferred deletion of the old array.
|
|
||||||
void setPathsDeferred(Path *paths);
|
|
||||||
TagGroupIndex tagGroupIndex() const;
|
TagGroupIndex tagGroupIndex() const;
|
||||||
void setTagGroupIndex(TagGroupIndex tag_index);
|
void setTagGroupIndex(TagGroupIndex tag_index);
|
||||||
// Slew is annotated by sdc set_annotated_transition cmd.
|
// Slew is annotated by sdc set_annotated_transition cmd.
|
||||||
|
|
|
||||||
|
|
@ -414,7 +414,6 @@ protected:
|
||||||
void initVars();
|
void initVars();
|
||||||
void deleteTags();
|
void deleteTags();
|
||||||
void deleteTagsPrev();
|
void deleteTagsPrev();
|
||||||
void deletePendingPaths();
|
|
||||||
void deleteUnusedTagGroups();
|
void deleteUnusedTagGroups();
|
||||||
void seedInvalidArrivals();
|
void seedInvalidArrivals();
|
||||||
void seedArrivals();
|
void seedArrivals();
|
||||||
|
|
@ -601,10 +600,6 @@ protected:
|
||||||
std::mutex invalid_arrivals_lock_;
|
std::mutex invalid_arrivals_lock_;
|
||||||
BfsFwdIterator *arrival_iter_;
|
BfsFwdIterator *arrival_iter_;
|
||||||
ArrivalVisitor *arrival_visitor_;
|
ArrivalVisitor *arrival_visitor_;
|
||||||
// Old vertex path arrays deferred for deletion until after the parallel
|
|
||||||
// BFS level completes, preventing use-after-free in concurrent CRPR readers.
|
|
||||||
std::vector<Path*> paths_pending_delete_;
|
|
||||||
std::mutex paths_pending_delete_lock_;
|
|
||||||
|
|
||||||
// Some requireds exist.
|
// Some requireds exist.
|
||||||
bool requireds_exist_;
|
bool requireds_exist_;
|
||||||
|
|
|
||||||
|
|
@ -708,20 +708,6 @@ Search::deleteTagsPrev()
|
||||||
for (TagGroup** tag_groups: tag_groups_prev_)
|
for (TagGroup** tag_groups: tag_groups_prev_)
|
||||||
delete [] tag_groups;
|
delete [] tag_groups;
|
||||||
tag_groups_prev_.clear();
|
tag_groups_prev_.clear();
|
||||||
|
|
||||||
deletePendingPaths();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Free old vertex path arrays that were deferred during parallel BFS visits.
|
|
||||||
// Called after visitParallel completes so no thread can still hold a pointer
|
|
||||||
// into any of these arrays.
|
|
||||||
void
|
|
||||||
Search::deletePendingPaths()
|
|
||||||
{
|
|
||||||
LockGuard lock(paths_pending_delete_lock_);
|
|
||||||
for (Path *paths : paths_pending_delete_)
|
|
||||||
delete [] paths;
|
|
||||||
paths_pending_delete_.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -2829,28 +2815,8 @@ void
|
||||||
Search::setVertexArrivals(Vertex *vertex,
|
Search::setVertexArrivals(Vertex *vertex,
|
||||||
TagGroupBldr *tag_bldr)
|
TagGroupBldr *tag_bldr)
|
||||||
{
|
{
|
||||||
if (tag_bldr->empty()) {
|
if (tag_bldr->empty())
|
||||||
// Inline the deletePathsIncr logic using deferred deletion so that
|
deletePathsIncr(vertex);
|
||||||
// concurrent CRPR/latch readers that hold a pointer into the old path
|
|
||||||
// array are not left with a dangling pointer.
|
|
||||||
tnsNotifyBefore(vertex);
|
|
||||||
if (worst_slacks_)
|
|
||||||
worst_slacks_->worstSlackNotifyBefore(vertex);
|
|
||||||
TagGroup *tag_group = tagGroup(vertex);
|
|
||||||
if (tag_group) {
|
|
||||||
Path *old_paths = vertex->paths();
|
|
||||||
// Clear the tag group index first so concurrent readers observe a
|
|
||||||
// null tag group (and return early from Path::vertexPath) before
|
|
||||||
// we touch paths_.
|
|
||||||
vertex->setTagGroupIndex(tag_group_index_max);
|
|
||||||
vertex->setPathsDeferred(nullptr);
|
|
||||||
tag_group->decrRefCount();
|
|
||||||
if (old_paths) {
|
|
||||||
LockGuard lock(paths_pending_delete_lock_);
|
|
||||||
paths_pending_delete_.push_back(old_paths);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
TagGroup *prev_tag_group = tagGroup(vertex);
|
TagGroup *prev_tag_group = tagGroup(vertex);
|
||||||
Path *prev_paths = vertex->paths();
|
Path *prev_paths = vertex->paths();
|
||||||
|
|
@ -2861,25 +2827,13 @@ Search::setVertexArrivals(Vertex *vertex,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (prev_tag_group) {
|
if (prev_tag_group) {
|
||||||
// Clear the tag group index before replacing paths so concurrent
|
vertex->deletePaths();
|
||||||
// readers see a consistent null-tag-group state during the
|
|
||||||
// transition and do not mix the old tag group with the new array.
|
|
||||||
vertex->setTagGroupIndex(tag_group_index_max);
|
|
||||||
prev_tag_group->decrRefCount();
|
prev_tag_group->decrRefCount();
|
||||||
requiredInvalid(vertex);
|
requiredInvalid(vertex);
|
||||||
}
|
}
|
||||||
size_t path_count = tag_group->pathCount();
|
size_t path_count = tag_group->pathCount();
|
||||||
// Allocate the new array and switch paths_ directly from old to new
|
Path *paths = vertex->makePaths(path_count);
|
||||||
// without creating a null window or freeing the old array immediately.
|
tag_bldr->copyPaths(tag_group, paths);
|
||||||
// This prevents concurrent CRPR/latch readers from observing either a
|
|
||||||
// null pointer or a freed (dangling) pointer.
|
|
||||||
Path *new_paths = new Path[path_count];
|
|
||||||
vertex->setPathsDeferred(new_paths);
|
|
||||||
if (prev_paths) {
|
|
||||||
LockGuard lock(paths_pending_delete_lock_);
|
|
||||||
paths_pending_delete_.push_back(prev_paths);
|
|
||||||
}
|
|
||||||
tag_bldr->copyPaths(tag_group, new_paths);
|
|
||||||
vertex->setTagGroupIndex(tag_group->index());
|
vertex->setTagGroupIndex(tag_group->index());
|
||||||
tag_group->incrRefCount();
|
tag_group->incrRefCount();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue