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
core: Add AffineMap #1029
core: Add AffineMap #1029
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1029 +/- ##
==========================================
- Coverage 87.00% 86.69% -0.32%
==========================================
Files 125 132 +7
Lines 19197 20656 +1459
Branches 2914 3129 +215
==========================================
+ Hits 16702 17907 +1205
- Misses 1999 2235 +236
- Partials 496 514 +18
☔ 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.
I added some style comments! Otherwise, the code seems good!
I would just like more documentation, and probably some more tests
tests/test_affine_builtins.py
Outdated
|
||
# (5 * d0) + s0 + 1 | ||
c = (a * 5) + b + 1 | ||
print(c) |
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.
For testing here, I would assert
that this is equal to AffineExpr
constructed manually (without the operators).
xdsl/ir.py
Outdated
SymbolId = ("s",) | ||
|
||
|
||
class _AffineExprStorage(ABC): |
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.
Could you write a bit of documentation for each of these classes? Mostly to help us understand.
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.
Thanks for the PR! This stil needs some more tests and some cleaning, but it still is exciting to get this into xDSL. The first step towards xDFPL 👍
Super happy to see affine being added, thanks @Groverkss! You're doing the lords work! |
@Groverkss, this is a great addition. I am looking forward to seeing this upstreamed. This will really allow us to parse and use one of the most unconventional MLIR dialects, with this funny AffineExpr encoding. Cool! I would love to see this merged. |
xdsl/ir.py
Outdated
Add = ("+",) | ||
Mul = ("*",) | ||
Mod = ("mod",) | ||
FloorDiv = ("floordiv",) | ||
CeilDiv = ("ceildiv",) | ||
Constant = ("const",) | ||
DimId = ("d",) | ||
SymbolId = ("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.
This can certainly be done better.
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.
done
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.
very cool
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.
Nice!
This patch adds AffineMap to core ir. AffineMap allows modeling many dialects in upstream MLIR like Linalg, Affine, Memref (load/store), SCF, etc.
This patch adds AffineMap to core ir. AffineMap allows modeling many dialects in upstream MLIR like Linalg, Affine, Memref (load/store), SCF, etc.