-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[mlir][tosa] Allow int64 tensors in tosa.intdiv
#167367
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
Conversation
This commit extends the tosa.intdiv operand/result types to allow int64 tensors. Change-Id: Idd32df6f493864610c9af6499625591a3977a9f6
|
@llvm/pr-subscribers-mlir-tosa Author: Luke Hutton (lhutton1) ChangesThis commit extends the tosa.intdiv operand/result types to allow int64 tensors. Full diff: https://github.com/llvm/llvm-project/pull/167367.diff 2 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
index 467dba3232f2b..635e77fc51983 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
@@ -826,12 +826,12 @@ def Tosa_IntDivOp : Tosa_ElementwiseOp<"intdiv", [SameOperandsAndResultElementTy
}];
let arguments = (ins
- Tosa_Int32Tensor:$input1,
- Tosa_Int32Tensor:$input2
+ Tosa_Int32Or64Tensor:$input1,
+ Tosa_Int32Or64Tensor:$input2
);
let results = (outs
- Tosa_Int32Tensor:$output
+ Tosa_Int32Or64Tensor:$output
);
list<Availability> availability = [
diff --git a/mlir/test/Dialect/Tosa/ops.mlir b/mlir/test/Dialect/Tosa/ops.mlir
index 22fde3b7d28a5..7743eaa6beb5b 100644
--- a/mlir/test/Dialect/Tosa/ops.mlir
+++ b/mlir/test/Dialect/Tosa/ops.mlir
@@ -342,6 +342,13 @@ func.func @test_intdiv(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>) -
return %0 : tensor<13x21x3xi32>
}
+// -----
+// CHECK-LABEL: intdiv_i64
+func.func @test_intdiv_i64(%arg0: tensor<13x21x1xi64>, %arg1: tensor<13x21x3xi64>) -> tensor<13x21x3xi64> {
+ %0 = tosa.intdiv %arg0, %arg1 : (tensor<13x21x1xi64>, tensor<13x21x3xi64>) -> tensor<13x21x3xi64>
+ return %0 : tensor<13x21x3xi64>
+}
+
// -----
// CHECK-LABEL: logical_and
func.func @test_logical_and(%arg0: tensor<13x21x3xi1>, %arg1: tensor<13x21x1xi1>) -> tensor<13x21x3xi1> {
|
|
@llvm/pr-subscribers-mlir Author: Luke Hutton (lhutton1) ChangesThis commit extends the tosa.intdiv operand/result types to allow int64 tensors. Full diff: https://github.com/llvm/llvm-project/pull/167367.diff 2 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
index 467dba3232f2b..635e77fc51983 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
@@ -826,12 +826,12 @@ def Tosa_IntDivOp : Tosa_ElementwiseOp<"intdiv", [SameOperandsAndResultElementTy
}];
let arguments = (ins
- Tosa_Int32Tensor:$input1,
- Tosa_Int32Tensor:$input2
+ Tosa_Int32Or64Tensor:$input1,
+ Tosa_Int32Or64Tensor:$input2
);
let results = (outs
- Tosa_Int32Tensor:$output
+ Tosa_Int32Or64Tensor:$output
);
list<Availability> availability = [
diff --git a/mlir/test/Dialect/Tosa/ops.mlir b/mlir/test/Dialect/Tosa/ops.mlir
index 22fde3b7d28a5..7743eaa6beb5b 100644
--- a/mlir/test/Dialect/Tosa/ops.mlir
+++ b/mlir/test/Dialect/Tosa/ops.mlir
@@ -342,6 +342,13 @@ func.func @test_intdiv(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>) -
return %0 : tensor<13x21x3xi32>
}
+// -----
+// CHECK-LABEL: intdiv_i64
+func.func @test_intdiv_i64(%arg0: tensor<13x21x1xi64>, %arg1: tensor<13x21x3xi64>) -> tensor<13x21x3xi64> {
+ %0 = tosa.intdiv %arg0, %arg1 : (tensor<13x21x1xi64>, tensor<13x21x3xi64>) -> tensor<13x21x3xi64>
+ return %0 : tensor<13x21x3xi64>
+}
+
// -----
// CHECK-LABEL: logical_and
func.func @test_logical_and(%arg0: tensor<13x21x3xi1>, %arg1: tensor<13x21x1xi1>) -> tensor<13x21x3xi1> {
|
Jerry-Ge
left a comment
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.
LGTM, thanks for the PR!
This commit extends the tosa.intdiv operand/result types to allow int64 tensors.
This commit extends the tosa.intdiv operand/result types to allow int64 tensors.