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

documentation: (toy) add toy accelerator dialect #1342

Merged
merged 3 commits into from Jul 27, 2023

Conversation

superlopuh
Copy link
Member

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.

@superlopuh superlopuh added the documentation Improvements or additions to documentation label Jul 25, 2023
@superlopuh superlopuh self-assigned this Jul 25, 2023
@@ -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
Copy link
Member Author

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
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (5394ea9) 89.65% compared to head (9990e6c) 89.65%.
Report is 8 commits behind head on main.

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     

see 16 files with indirect coverage changes

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

Copy link
Collaborator

@math-fehr math-fehr left a 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
Copy link
Collaborator

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.

Copy link
Member Author

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@superlopuh superlopuh merged commit b3a7e5c into main Jul 27, 2023
10 checks passed
@superlopuh superlopuh deleted the sasha/wm/toy-accelerator branch July 27, 2023 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants