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
dialects: (riscv) add func
to riscv_func
lowering
#1382
Conversation
func
to riscv_func
loweringfunc
to riscv_func
lowering
func
to riscv_func
loweringadd func
to riscv_func
lowering
add func
to riscv_func
loweringfunc
to riscv_func
lowering
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1382 +/- ##
==========================================
+ Coverage 89.87% 89.90% +0.02%
==========================================
Files 202 204 +2
Lines 25803 25872 +69
Branches 3864 3872 +8
==========================================
+ Hits 23191 23260 +69
Misses 1996 1996
Partials 616 616
☔ View full report in Codecov by Sentry. |
Seems ready for review |
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.
Overall not sure why we have so many stubs in here, but feel free to merge
) | ||
|
||
new_func = riscv_func.FuncOp( | ||
op.sym_name.data, rewriter.move_region_contents_to_new_regions(op.body) |
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 did not know we had this API, TIL! Very nice!
PatternRewriteWalker(LowerFuncOp()).rewrite_module(op) | ||
PatternRewriteWalker(LowerFuncCallOp()).rewrite_module(op) | ||
PatternRewriteWalker(LowerReturnOp()).rewrite_module(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.
Can we put these into one walker?
class LowerFuncCallOp(RewritePattern): | ||
@op_type_rewrite_pattern | ||
def match_and_rewrite(self, op: func.Call, rewriter: PatternRewriter) -> None: | ||
raise NotImplementedError("Function call lowering not implemented yet") |
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.
Not sure why this is even in the PR, it just does absolutely nothing?
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 like it, it's a nice stub for us to replace later, and then the failing unit tests are replaced with working unit tests, so we get a little win in the future also
class LowerReturnOp(RewritePattern): | ||
@op_type_rewrite_pattern | ||
def match_and_rewrite(self, op: func.Return, rewriter: PatternRewriter): | ||
if op.arguments: | ||
raise NotImplementedError("Only support return with no arguments for now") | ||
|
||
rewriter.replace_matched_op(riscv_func.ReturnOp(())) |
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.
And this is here but not tested, and also quite useless imo?
Just a very barebone lowering that will be used by the toy pipeline.