Skip to content

add MT info to tag doc#387

Merged
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:sta_update_doc
Jul 9, 2026
Merged

add MT info to tag doc#387
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:sta_update_doc

Conversation

@dsengupta0628

Copy link
Copy Markdown
Contributor

Added a section on how threading is handled to the tag and scene doc as requested in #386

Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
@dsengupta0628 dsengupta0628 self-assigned this Jul 9, 2026
@dsengupta0628 dsengupta0628 requested a review from maliberty July 9, 2026 00:56

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the doc/TagsAndScenes.md documentation to add a detailed section on threading and concurrency in OpenSTA, explaining the thread pool, parallel phases, level-barrier invariants, and locking mechanisms. The reviewer pointed out a critical concurrency bug in the referenced implementation of Search::findTagGroup where a self-assignment prevents the atomic pointer tag_groups_ from being updated, which violates the documented design.

Comment thread doc/TagsAndScenes.md
Comment on lines +760 to +766
pointers are atomic (`std::atomic<Tag**> tags_`, `std::atomic<TagGroup**>
tag_groups_`, `include/sta/Search.hh:632,641`) and growth is copy-then-publish:
under the table lock, a double-size array is allocated, existing entries are
copied, and only then is the atomic pointer swung
(`search/Search.cc:2919-2930,2659-2670` — "make the new array and copy the
contents into it before updating tags_ so that other threads can use
Search::tag(TagIndex) without returning gubbish"). The retired arrays are

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While the documentation correctly describes the intended copy-then-publish design, there is a critical concurrency bug in the referenced code at Search::findTagGroup (search/Search.cc:2667). In Search::findTagGroup, the local variable tag_groups is self-assigned (tag_groups = tag_groups;) instead of updating the member variable tag_groups_ (tag_groups_ = tag_groups;). As a result, the atomic pointer tag_groups_ is never actually updated when the table grows, which violates the thread-safety invariant described here and can lead to out-of-bounds reads or stale data. It is highly recommended to submit a separate fix for search/Search.cc:2667 to correctly update tag_groups_.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hallucination. Line 2667 reads tag_groups_ = tag_groups; - member (trailing underscore) assigned from local. No self-assignment. Atomic pointer updated correctly, same pattern as tags_ grow in findTag (Search.cc:2927). Also, self-assignment of a local would trigger -Wself-assign warnings and the doc'd invariant would break visibly in any multi-thread run with >128 tag groups - it doesn't.

You likely misread the two identifiers differing only by trailing underscore.

@maliberty maliberty merged commit 97d84f0 into The-OpenROAD-Project:master Jul 9, 2026
7 checks passed
@maliberty maliberty deleted the sta_update_doc branch July 9, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants