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][LowerToHW] Fix race by processing ports before parallel, fix failure path. #5818

Merged
merged 3 commits into from
Aug 9, 2023

Conversation

dtzSiFive
Copy link
Contributor

Fixes #5816 .

Lowering of operations in body is still done in parallel.

Type aliases are used by the port lowering code (tryEliminatingConnectsToValue), but should already be populated for all ports+operations before call to lowerPortsAndMoveBody.

Don't spawn out threads just to walk ports of each module
(and the touchups done re:connections involving them),
just handle this as part of existing FModuleOp -> HWModuleOp lowering.

Tweak code to exit early if cause for pass failure is encountered.
(previously it indicated failure but continued on)
@dtzSiFive
Copy link
Contributor Author

In 6283c30 I switched to handling these as we visit each, commit prior just splits the current parallel processing into two phases to avoid the race (sine we weren't fully done handling ports yet).

The switch is because this work appears rather light (similar to the work done in lowerModule these days, serially), and spawning out a lot of threads to do minor amount of work in each may not be a win.

Fixup exit path when encountering error while touching the code.

Copy link
Contributor

@mikeurbach mikeurbach left a comment

Choose a reason for hiding this comment

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

I think this makes sense. We really need sanitizers in CI 😓

@dtzSiFive
Copy link
Contributor Author

Thanks! And yes, we do!

@dtzSiFive dtzSiFive merged commit 758cb85 into llvm:main Aug 9, 2023
5 checks passed
@dtzSiFive dtzSiFive deleted the fix/lower-to-hw-race-symbol branch August 9, 2023 19:01
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][LowerToHW] race on attribute dictionary
2 participants