-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add support for integer division to TCP #97
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,6 +160,27 @@ def Tcp_DivFOp : Tcp_BinaryElementwiseOp<"divf", [SameOperandsAndResultElementTy | |
let assemblyFormat = "$in1 `,` $in2 attr-dict `:` type($in1) `,` type($in2) `->` type($out)"; | ||
} | ||
|
||
def Tcp_DivIOp : Tcp_BinaryElementwiseOp<"divi", [SameOperandsAndResultElementType]> { | ||
let summary = "Computes elementwise integer division"; | ||
|
||
let description = [{ | ||
Computes the integer division of `in1` and `in2`. | ||
}]; | ||
|
||
let arguments = (ins | ||
Tcp_IntTensor:$in1, | ||
Tcp_IntTensor:$in2, | ||
Tcp_SignednessAttr:$signedness, | ||
Tcp_RoundingModeAttr:$rounding_mode | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need a "Ceil" rounding mode here? Are they any cases where that is necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think there's a good use-case for the However, I think the RoundingMode type itself should have ceil in it for completion though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need the rounding mode here? Should we just stick to using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that the arith dialect has straightforward mapping to ceildiv, why not just have it for the sake of expressibility? I do not have a strong opinion on this though. We could just leave it out now and introduce it later if we find a need for it. |
||
); | ||
|
||
let results = (outs | ||
Tcp_IntTensor:$out | ||
); | ||
|
||
let assemblyFormat = "$in1 `,` $in2 attr-dict `:` type($in1) `,` type($in2) `->` type($out)"; | ||
} | ||
|
||
def Tcp_ConstOp : Tcp_Op<"const", [ConstantLike, Pure]> { | ||
let summary = "Constant op"; | ||
|
||
|
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.
minor nit: fix spacing here and below