-
Notifications
You must be signed in to change notification settings - Fork 85
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: (math) Add support for custom format and container types to math
dialect ops
#3786
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3786 +/- ##
==========================================
- Coverage 91.25% 91.23% -0.03%
==========================================
Files 461 461
Lines 57594 57446 -148
Branches 5546 5546
==========================================
- Hits 52560 52411 -149
- Misses 3611 3612 +1
Partials 1423 1423 ☔ View full report in Codecov by Sentry. |
xdsl/dialects/math.py
Outdated
@@ -529,12 +462,18 @@ class FPowIOp(IRDLOperation): | |||
""" | |||
|
|||
name = "math.fpowi" | |||
|
|||
T1: ClassVar = VarConstraint("T1", floatingPointLike) | |||
T2: ClassVar = VarConstraint("T2", signlessIntegerLike) |
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.
seems unnecessary, although I guess it doesn't hurt much
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 agree, there's no reason to have this variable
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'll amend, it's a leftover from reusing the base classes.
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.
It seems like the assembly format cannot infer the type of result
type of result 'result' cannot be inferred, consider adding a 'type($result)' directive to the custom assembly format
Hence, I ended up keep one of them.
xdsl/dialects/math.py
Outdated
@@ -529,12 +462,18 @@ class FPowIOp(IRDLOperation): | |||
""" | |||
|
|||
name = "math.fpowi" | |||
|
|||
T1: ClassVar = VarConstraint("T1", floatingPointLike) | |||
T2: ClassVar = VarConstraint("T2", signlessIntegerLike) |
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 agree, there's no reason to have this variable
|
||
T1: ClassVar = VarConstraint("T1", floatingPointLike) | ||
T2: ClassVar = VarConstraint("T2", signlessIntegerLike) | ||
|
||
fastmath = opt_prop_def(FastMathFlagsAttr) |
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.
A lot of the other fastmath flags in mlir are default valued props instead of optional props. Is the math dialect different?
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.
What do you mean by "a lot"? Our arith
and llvm
dialect uses of the flags differ, but the net result is the same, as absence means none
.
I'll check MLIR later and amend in a separate PR just for the flags as required.
I also wanted to check the relevant interface, so another incentive to do so.
… `math` dialect ops (xdslproject#3786) This PR: - Adds support for custom format - Adds support for container types in the operands and results of the relevant ops (e.g., `tensor`) - Tests (including interoperability) of the above Resolves: xdslproject#3739, xdslproject#2739
This PR:
tensor
)Resolves: #3739, #2739