-
Notifications
You must be signed in to change notification settings - Fork 404
[FIRRTL] Ensure all types and attributes are walkable #9007
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
Conversation
seldridge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only lightly reviewed. Looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lightly reviewed. This looks good.
| Builder builder{&context}; | ||
| }; | ||
|
|
||
| TEST_F(TypeWalkTest, BundleTypeWalk) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kind of test could be golfed down to a single field. Not critical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only lightly reviewed.
|
Also, thank you for figuring out that this was the issue and fixing this! |
Upstream MLIR requires type and attribute storages to define a `getAsKey` function, and for the return type to be something that implements the corresponding attribute/type walk. Most of our FIRRTL types and attributes predate these requirements. This PR is mostly busy work, adding `getAsKey` to the types and attributes that don't yet have it, and changing `std::pair` to `std::tuple`. (For some reason upstream type/attribute walking works on tuples, but not pairs.) Also add unit tests for attributes and types that ensure the walks actually work. These tweaks allow circt-reduce to be a lot more clever about which ops it touches, because it can see a lot more symbol uses now. I also expect the `InnerSymbolDCE` pass to potentially benefit from this, at least if inner symbols are weirdly nested within FIRRTL attributes and types. Most of this was done by Claude Sonnet 4, with a lot of handholding.
9d894d8 to
4496357
Compare
Upstream MLIR requires type and attribute storages to define a
getAsKeyfunction, and for the return type to be something that implements the corresponding attribute/type walk. Most of our FIRRTL types and attributes predate these requirements. This PR is mostly busy work, addinggetAsKeyto the types and attributes that don't yet have it, and changingstd::pairtostd::tuple. (For some reason upstream type/attribute walking works on tuples, but not pairs.) Also add unit tests for attributes and types that ensure the walks actually work.These tweaks allow circt-reduce to be a lot more clever about which ops it touches, because it can see a lot more symbol uses now. I also expect the
InnerSymbolDCEpass to potentially benefit from this, at least if inner symbols are weirdly nested within FIRRTL attributes and types.Most of this was done by Claude Sonnet 4, with a lot of handholding.