-
Notifications
You must be signed in to change notification settings - Fork 324
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
[Transforms][circt-synth] Add HierarchicalRunner pass #8254
Conversation
Add a new pass that allows running passes under hierarchy. This is useful when we want to run synthesis passes only on real designs. This implementation is based on MLIR's upstream CompositePass and Inliner utilities. The pass takes a pipeline string and runs it on modules in the design hierarchy. It supports configurable options including the pipeline to run under hierarchy, the name of the top-level module, and whether to include bound instances in the hierarchy traversal. The implementation updates circt-synth tool with the required library dependencies and necessary dialect and pass headers.
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.
Running different passes by module hierarchy is a valuable feature, especially when a designer wants to ungroup (inline) certain kinds of modules by some rules. It's good to know you implemented this feature. Nice job!
auto *node = worklist.pop_back_val(); | ||
if (!node) | ||
continue; |
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.
I'm curious about the pop-out node. In what situation will it be nullptr?
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.
Yeah good point. It wouldn't be possible.
for (auto *child : *node) { | ||
auto childOp = child->getInstance(); | ||
if (!childOp || | ||
(!includeBoundInstances && childOp->hasAttr("doNotPrint"))) |
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.
Does the "doNotPrint" attribute have the same semantics as "set_dont_touch" in SDC?
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.
"doNotPrint" is used for instances instantiated by SystemVerilog bind. Normally they won't be instantiated in the synthesizable parts. It's not good that we are relying on this vaguely defined attribute, and we have wanted to fix (See #2231) but no effort has been made so far.
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.
LGTM! Nice idea to use the instance graph to only run a bunch of passes on a specific hierarchy 👍
Just out of curiosity: have you come across any uses of this in the wild?
Thank you for the review!
It's generally necessary for circt-synth to skip verification code. Sometimes verification code has constructs that are hard to synthesize such as 32bit div/mod. Also it saves a lot of resources when targeting sub hierarchy. |
Add a new pass that allows running passes under hierarchy. This is useful when we want to run synthesis passes only on real designs.
This implementation is based on MLIR's upstream CompositePass and Inliner utilities. The pass takes a pipeline string and runs it on modules in the design hierarchy. It supports configurable options including the pipeline to run under hierarchy, the name of the top-level module, and whether to include bound instances in the hierarchy traversal.
The implementation updates circt-synth tool with the required library dependencies and necessary dialect and pass headers.