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
documentation: (toy) add toy accelerator dialect #1342
Conversation
@@ -441,17 +441,6 @@ class LowerToAffinePass(ModulePass): | |||
name = "toy-to-builtin" | |||
|
|||
def apply(self, ctx: MLContext, op: ModuleOp) -> None: | |||
# We define the specific operations, or dialects, that are legal targets for this |
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 initially copied this logic from the Toy tutorial, but it broke when I passed in an MLIR file directly, which ought to work. I don't think we really need to replicate this part of the tutorial for the time being
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #1342 +/- ##
=======================================
Coverage 89.65% 89.65%
=======================================
Files 191 191
Lines 24909 25007 +98
Branches 3758 3769 +11
=======================================
+ Hits 22331 22420 +89
- Misses 1984 1992 +8
- Partials 594 595 +1 ☔ View full report in Codecov by Sentry. |
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.
👍
@@ -4,6 +4,8 @@ | |||
# RUN: python -m toy %s --emit=toy-infer-shapes | filecheck %s | |||
# RUN: python -m toy %s --emit=affine | filecheck %s | |||
|
|||
# RUN: python -m toy %s --emit=affine --accelerate | filecheck %s |
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.
Did you check that this run? I'm not sure if things run if they are not in the first lines.
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.
Added an assert False, seems to work ok
@@ -1,5 +1,7 @@ | |||
# RUN: python -m toy %s --emit=scf | filecheck %s | |||
|
|||
# RUN: python -m toy %s --emit=scf --accelerate | filecheck %s |
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.
Same here
The main idea is to show how to divert the compilation flow to a toy accelerator. This is much simpler than the plan with snitch etc, but still shows the vague idea of matching on affine loops and raising them to a different builtin operation.
As part of the Toy compilation, we know that the accelerator matches all the possible affine loops that we create, meaning that we can compile it end-to-end in python without relying on MLIR.