-
Notifications
You must be signed in to change notification settings - Fork 291
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] Add GroupSink pass #6184
Conversation
e1e303e
to
85cbe9d
Compare
This is currently a very basic implementation that relies on MLIR's |
85cbe9d
to
070970d
Compare
I was originally going to keep this in draft until this had a more advanced sinking approach ( Here is a simple end-to-end example showing what this can do: Input:
Output is below. Notice how // Generated by CIRCT firtool-1.53.0-205-g070970d77-dirty
module Foo_A(
input _a
);
wire b = _a;
wire c = b;
endmodule
module Foo(
input a
);
endmodule
// ----- 8< ----- FILE "groups_Foo_A.sv" ----- 8< -----
// Generated by CIRCT firtool-1.53.0-205-g070970d77-dirty
`ifndef groups_Foo_A
`define groups_Foo_A
bind Foo Foo_A foo_A (
._a (a)
);
`endif // groups_Foo_A |
numSunk = controlFlowSink( | ||
regionsToSink, domInfo, [](Operation *op, Region *) { | ||
return !hasDontTouch(op); | ||
}, |
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 will block sinking of any operation which has an inner symbol or DontTouchAnnotation
. This behavior is conservative and likely can be relaxed.
Add a new pass, GroupSink/firrtl-group-sink, which will sink operations that are only used by optional groups into optional groups. This is very simple at present. This pass uses `mlir::controlFlowSink` to sink ops into regions. This only works for very simple things in FIRRTL which have normal SSA dominance, e.g., nodes, constants, or primitive operations. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add the GroupSink pass (basic sinking of operations into groups) to the firtool pipeline just before LowerGroups. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
4019d64
to
16f4f76
Compare
Add a new pass, GroupSink/firrtl-group-sink, which will sink operations that are only used by optional groups into optional groups.