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

dialects: (riscv) add func to riscv_func lowering #1382

Merged
merged 4 commits into from Aug 2, 2023

Conversation

adutilleul
Copy link
Collaborator

Just a very barebone lowering that will be used by the toy pipeline.

@adutilleul adutilleul added the dialects Changes on the dialects label Aug 1, 2023
@adutilleul adutilleul self-assigned this Aug 1, 2023
@adutilleul adutilleul changed the title dialect: (riscv) func to riscv_func lowering dialects: (riscv) func to riscv_func lowering Aug 1, 2023
@adutilleul adutilleul changed the title dialects: (riscv) func to riscv_func lowering dialects: (riscv) add func to riscv_func lowering Aug 1, 2023
@adutilleul adutilleul changed the title dialects: (riscv) add func to riscv_func lowering dialects: (riscv) add func to riscv_func lowering Aug 1, 2023
@codecov
Copy link

codecov bot commented Aug 1, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02% 🎉

Comparison is base (af67976) 89.87% compared to head (2ae9867) 89.90%.

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              
Files Changed Coverage Δ
tests/backend/riscv/test_func_to_riscv_func.py 100.00% <100.00%> (ø)
...sl/backend/riscv/lowering/lower_func_riscv_func.py 100.00% <100.00%> (ø)
xdsl/tools/command_line_tool.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@superlopuh
Copy link
Member

Seems ready for review

@adutilleul adutilleul marked this pull request as ready for review August 1, 2023 12:23
Copy link
Collaborator

@AntonLydike AntonLydike left a 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)
Copy link
Collaborator

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!

Comment on lines 52 to 54
PatternRewriteWalker(LowerFuncOp()).rewrite_module(op)
PatternRewriteWalker(LowerFuncCallOp()).rewrite_module(op)
PatternRewriteWalker(LowerReturnOp()).rewrite_module(op)
Copy link
Collaborator

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?

Comment on lines +33 to +36
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")
Copy link
Collaborator

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?

Copy link
Member

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

Comment on lines +39 to +45
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(()))
Copy link
Collaborator

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?

@superlopuh superlopuh merged commit 109b32b into main Aug 2, 2023
10 checks passed
@superlopuh superlopuh deleted the adutilleul/riscv/func_to_riscv_func branch August 2, 2023 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialects Changes on the dialects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants