Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIRRTL] Cache symbol table in LowerLayers #7436

Merged
merged 1 commit into from
Aug 7, 2024
Merged

Conversation

seldridge
Copy link
Member

Precompute a symbol table inside LowerLayers in order to do SymbolRefAttr -> LayerOp lookups. This is expected to fix an intermittent crash as well as improve performance.

Fixes #7434.

h/t @youngar for the fix suggestion.

@seldridge seldridge requested a review from darthscsi as a code owner August 5, 2024 02:14
@seldridge seldridge requested a review from youngar August 5, 2024 02:14
Precompute a symbol to layer mapping inside LowerLayers and uses this
instead of a symbol table.  This is both faster and avoids problems of
trying to compute a symbol table while modules may be created.

Repurpose the functions that were being used to create macro declarations
to also compute this symbol to layer mapping.  Rename these to indicate
that they are now doing generic layer preprocessing.

Fixes #7434.

h/t @youngar for the fix suggestion.

Signed-off-by: Schuyler Eldridge <[email protected]>
@seldridge seldridge force-pushed the dev/seldridge/issue-7434 branch from e3cc671 to 46326f7 Compare August 6, 2024 19:27
@seldridge seldridge requested a review from youngar August 6, 2024 19:27
Comment on lines -126 to +127
static SmallString<32> macroNameForLayer(ArrayRef<StringAttr> layerName) {
static SmallString<32>
macroNameForLayer(ArrayRef<FlatSymbolRefAttr> layerName) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This change, and others that are s/StringAttr/FlatSymbolRefAttr/ exist because the former is always trivially accessible from the latter while the latter is necessary for constructing SymbolRefAttrs. This became necessary due to wanting to compute macros and the SymbolRefAttr -> LayerOp mapping at the same time.

@seldridge seldridge merged commit c08ac4b into main Aug 7, 2024
4 checks passed
@seldridge seldridge deleted the dev/seldridge/issue-7434 branch August 7, 2024 15:50
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.

[FIRRTL] crash in LowerLayers
3 participants