Skip to content

Commit aa61216

Browse files
Tai78641var-const
authored andcommitted
[mlir][tosa] Rename int_div to intdiv (llvm#135080)
This patch renames Tosa Operator int_div to intdiv to align with 1.0 spec Signed-off-by: Tai Ly <[email protected]>
1 parent d23d55a commit aa61216

File tree

9 files changed

+26
-26
lines changed

9 files changed

+26
-26
lines changed

mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ profileComplianceMap = {
6464
{"tosa.bitwise_xor",
6565
{{{Profile::pro_int},
6666
{{i8T, i8T, i8T}, {i16T, i16T, i16T}, {i32T, i32T, i32T}}}}},
67-
{"tosa.int_div",
67+
{"tosa.intdiv",
6868
{{{Profile::pro_int, Profile::pro_fp}, {{i32T, i32T, i32T}}, anyOf}}},
6969
{"tosa.logical_and",
7070
{{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT, boolT}}, anyOf}}},

mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,9 +749,9 @@ def Tosa_BitwiseXorOp : Tosa_ElementwiseOp<"bitwise_xor", [
749749
}
750750

751751
//===----------------------------------------------------------------------===//
752-
// Operator: int_div
752+
// Operator: intdiv
753753
//===----------------------------------------------------------------------===//
754-
def Tosa_IntDivOp : Tosa_ElementwiseOp<"int_div", [SameOperandsAndResultElementType]> {
754+
def Tosa_IntDivOp : Tosa_ElementwiseOp<"intdiv", [SameOperandsAndResultElementType]> {
755755
let summary = "Integer divide operator.";
756756

757757
let description = [{

mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ func.func @test_simple_i32(%arg0: tensor<1xi32>, %unsigned: tensor<1xui32>, %uns
661661

662662
// CHECK: linalg.generic
663663
// CHECK: arith.divsi
664-
%40 = tosa.int_div %arg0, %arg0 : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32>
664+
%4 = tosa.intdiv %arg0, %arg0 : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32>
665665

666666
// CHECK: linalg.generic
667667
// CHECK: ^bb0(%[[ARG1:.*]]: i32, %[[ARG2:.*]]: i32):

mlir/test/Dialect/Tosa/availability.mlir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,11 @@ func.func @test_bitwise_xor(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi3
186186
}
187187

188188
// -----
189-
// CHECK-LABEL: int_div
190-
func.func @test_int_div(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> {
189+
// CHECK-LABEL: intdiv
190+
func.func @test_intdiv(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> {
191191
// CHECK: profiles: [ [pro_int, pro_fp] ]
192192
// CHECK: extensions: [ ]
193-
%0 = tosa.int_div %arg0, %arg1 : (tensor<13x21x1xi32>, tensor<13x21x3xi32>) -> tensor<13x21x3xi32>
193+
%0 = tosa.intdiv %arg0, %arg1 : (tensor<13x21x1xi32>, tensor<13x21x3xi32>) -> tensor<13x21x3xi32>
194194
return %0 : tensor<13x21x3xi32>
195195
}
196196

mlir/test/Dialect/Tosa/canonicalize.mlir

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,11 +1204,11 @@ func.func nested @do_not_fold_reciprocal_int() -> tensor<3x600x1200xi32> {
12041204

12051205
// -----
12061206

1207-
// CHECK-LABEL: @do_not_fold_int_div_division_by_0
1208-
func.func @do_not_fold_int_div_division_by_0() -> tensor<1x24x2xi32> {
1209-
// CHECK: tosa.int_div
1207+
// CHECK-LABEL: @do_not_fold_intdiv_division_by_0
1208+
func.func @do_not_fold_intdiv_division_by_0() -> tensor<1x24x2xi32> {
1209+
// CHECK: tosa.intdiv
12101210
%1 = "tosa.const"() <{values = dense<0> : tensor<1x24x2xi32>}> : () -> tensor<1x24x2xi32>
12111211
%4 = "tosa.const"() <{values = dense<20> : tensor<1x24x2xi32>}> : () -> tensor<1x24x2xi32>
1212-
%16 = tosa.int_div %4, %1 : (tensor<1x24x2xi32>, tensor<1x24x2xi32>) -> tensor<1x24x2xi32>
1212+
%16 = tosa.intdiv %4, %1 : (tensor<1x24x2xi32>, tensor<1x24x2xi32>) -> tensor<1x24x2xi32>
12131213
return %16 : tensor<1x24x2xi32>
12141214
}

mlir/test/Dialect/Tosa/constant-op-fold.mlir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func.func @fold_add_splat_f32() -> tensor<10xf32> {
194194
func.func @fold_div_zero_lhs_i32(%arg0: tensor<i32>) -> tensor<i32> {
195195
%zero = "tosa.const"() {values = dense<0> : tensor<i32>} : () -> tensor<i32>
196196
// CHECK: %[[ZERO:.+]] = "tosa.const"() <{values = dense<0>
197-
%div = tosa.int_div %zero, %arg0 : (tensor<i32>, tensor<i32>) -> tensor<i32>
197+
%div = tosa.intdiv %zero, %arg0 : (tensor<i32>, tensor<i32>) -> tensor<i32>
198198
// CHECK: return %[[ZERO]]
199199
return %div : tensor<i32>
200200
}
@@ -204,7 +204,7 @@ func.func @fold_div_zero_lhs_i32(%arg0: tensor<i32>) -> tensor<i32> {
204204
// CHECK-LABEL: @fold_div_one_rhs_i32
205205
func.func @fold_div_one_rhs_i32(%arg0: tensor<i32>) -> tensor<i32> {
206206
%one = "tosa.const"() {values = dense<1> : tensor<i32>} : () -> tensor<i32>
207-
%div = tosa.int_div %arg0, %one : (tensor<i32>, tensor<i32>) -> tensor<i32>
207+
%div = tosa.intdiv %arg0, %one : (tensor<i32>, tensor<i32>) -> tensor<i32>
208208
// CHECK: return %arg0
209209
return %div : tensor<i32>
210210
}
@@ -216,7 +216,7 @@ func.func @fold_div_splat_i32() -> tensor<i32> {
216216
%lhs = "tosa.const"() {values = dense<10> : tensor<i32>} : () -> tensor<i32>
217217
%rhs = "tosa.const"() {values = dense<-3> : tensor<i32>} : () -> tensor<i32>
218218
// CHECK: %[[SPLAT:.+]] = "tosa.const"() <{values = dense<-3>
219-
%div = tosa.int_div %lhs, %rhs : (tensor<i32>, tensor<i32>) -> tensor<i32>
219+
%div = tosa.intdiv %lhs, %rhs : (tensor<i32>, tensor<i32>) -> tensor<i32>
220220
// CHECK: return %[[SPLAT]]
221221
return %div : tensor<i32>
222222
}

mlir/test/Dialect/Tosa/level_check.mlir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ func.func @test_bitwise_xor_rank_invalid(%arg0: tensor<1x1x1x1x13x21x3xi32>, %ar
8080

8181
// -----
8282

83-
func.func @test_int_div_rank_invalid(%arg0: tensor<1x1x1x1x13x21x3xi32>, %arg1: tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32> {
84-
// expected-error@+1 {{'tosa.int_div' op failed level check: operand rank(shape) <= MAX_RANK}}
85-
%0 = tosa.int_div %arg0, %arg1 : (tensor<1x1x1x1x13x21x3xi32>, tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32>
83+
func.func @test_intdiv_rank_invalid(%arg0: tensor<1x1x1x1x13x21x3xi32>, %arg1: tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32> {
84+
// expected-error@+1 {{'tosa.intdiv' op failed level check: operand rank(shape) <= MAX_RANK}}
85+
%0 = tosa.intdiv %arg0, %arg1 : (tensor<1x1x1x1x13x21x3xi32>, tensor<1x1x1x1x13x21x3xi32>) -> tensor<1x1x1x1x13x21x3xi32>
8686
return %0 : tensor<1x1x1x1x13x21x3xi32>
8787
}
8888

mlir/test/Dialect/Tosa/ops.mlir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,9 @@ func.func @test_bitwise_xor(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi3
308308
}
309309

310310
// -----
311-
// CHECK-LABEL: int_div
312-
func.func @test_int_div(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> {
313-
%0 = tosa.int_div %arg0, %arg1 : (tensor<13x21x1xi32>, tensor<13x21x3xi32>) -> tensor<13x21x3xi32>
311+
// CHECK-LABEL: intdiv
312+
func.func @test_intdiv(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> {
313+
%0 = tosa.intdiv %arg0, %arg1 : (tensor<13x21x1xi32>, tensor<13x21x3xi32>) -> tensor<13x21x3xi32>
314314
return %0 : tensor<13x21x3xi32>
315315
}
316316

mlir/test/Dialect/Tosa/profile_all_unsupported.mlir

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ func.func @test_add_i32(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>)
1212
}
1313

1414
// -----
15-
func.func @test_int_div(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> {
16-
// expected-error@+1 {{'tosa.int_div' op illegal: requires any of [pro_int, pro_fp] but not enabled in target}}
17-
%0 = tosa.int_div %arg0, %arg1 : (tensor<13x21x1xi32>, tensor<13x21x3xi32>) -> tensor<13x21x3xi32>
15+
func.func @test_intdiv(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> {
16+
// expected-error@+1 {{'tosa.intdiv' op illegal: requires any of [pro_int, pro_fp] but not enabled in target}}
17+
%0 = tosa.intdiv %arg0, %arg1 : (tensor<13x21x1xi32>, tensor<13x21x3xi32>) -> tensor<13x21x3xi32>
1818
return %0 : tensor<13x21x3xi32>
1919
}
2020

@@ -117,9 +117,9 @@ func.func @test_add_i32(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>)
117117
}
118118

119119
// -----
120-
func.func @test_int_div(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> {
121-
// expected-error@+1 {{'tosa.int_div' op illegal: requires any of [pro_int, pro_fp] but not enabled in target}}
122-
%0 = tosa.int_div %arg0, %arg1 : (tensor<13x21x1xi32>, tensor<13x21x3xi32>) -> tensor<13x21x3xi32>
120+
func.func @test_intdiv(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> {
121+
// expected-error@+1 {{'tosa.intdiv' op illegal: requires any of [pro_int, pro_fp] but not enabled in target}}
122+
%0 = tosa.intdiv %arg0, %arg1 : (tensor<13x21x1xi32>, tensor<13x21x3xi32>) -> tensor<13x21x3xi32>
123123
return %0 : tensor<13x21x3xi32>
124124
}
125125

0 commit comments

Comments
 (0)