Skip to content

Commit 67b7bbe

Browse files
justin-ngo-armvivekkhandelwal1
authored andcommitted
[TOSA] TOSA updates for LLVM hash 72144d1
1: [TOSA] Update rescale input_/output_zp and double_round attribute * Update tosa.rescale input_/output_zp as inputs according to TOSA 1.0 * Update double_round bool attribute to rounding_mode in alignment with TOSA 1.0. rounding_mode supports "SINGLE_ROUND", "INEXACT_ROUND", and "DOUBLE_ROUND". Existing double_round behaviours are mapped as followed: - double_round = true -> rounding_mode = "DOUBLE_ROUND" - double_round = false -> rounding_mode = "SINGLE_ROUND" 2: [TOSA] Update tosa.negate's zero-points to inputs Update LIT tests and XFAIL sets 3: [TOSA] Update tosa.int_div to tosa.intdiv Update LIT tests
1 parent 8f84285 commit 67b7bbe

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/Conversion/TorchToTosa/basic.mlir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,7 @@ func.func @torch.aten.div.Tensor_mode$float_trunc(%arg0: !torch.vtensor<[?, ?],f
17031703
// CHECK: %[[VAL_4:.*]] = torch.constant.str "trunc"
17041704
// CHECK: %[[VAL_5:.*]] = tosa.cast %[[VAL_3]] : (tensor<?x?xi64>) -> tensor<?x?xi32>
17051705
// CHECK: %[[VAL_6:.*]] = tosa.cast %[[VAL_2]] : (tensor<?x?xi64>) -> tensor<?x?xi32>
1706-
// CHECK: %[[VAL_7:.*]] = tosa.int_div %[[VAL_5]], %[[VAL_6]] : (tensor<?x?xi32>, tensor<?x?xi32>) -> tensor<?x?xi32>
1706+
// CHECK: %[[VAL_7:.*]] = tosa.intdiv %[[VAL_5]], %[[VAL_6]] : (tensor<?x?xi32>, tensor<?x?xi32>) -> tensor<?x?xi32>
17071707
// CHECK: %[[VAL_8:.*]] = tosa.cast %[[VAL_7]] : (tensor<?x?xi32>) -> tensor<?x?xi64>
17081708
// CHECK: %[[VAL_9:.*]] = torch_c.from_builtin_tensor %[[VAL_8]] : tensor<?x?xi64> -> !torch.vtensor<[?,?],si64>
17091709
// CHECK: return %[[VAL_9]] : !torch.vtensor<[?,?],si64>
@@ -1745,7 +1745,7 @@ func.func @torch.aten.div.Tensor_mode$float_floor(%arg0: !torch.vtensor<[?, ?],f
17451745
// CHECK: %[[VAL_4:.*]] = torch.constant.str "floor"
17461746
// CHECK: %[[VAL_5:.*]] = tosa.cast %[[VAL_3]] : (tensor<?x?xi64>) -> tensor<?x?xi32>
17471747
// CHECK: %[[VAL_6:.*]] = tosa.cast %[[VAL_2]] : (tensor<?x?xi64>) -> tensor<?x?xi32>
1748-
// CHECK: %[[VAL_7:.*]] = tosa.int_div %[[VAL_5]], %[[VAL_6]] : (tensor<?x?xi32>, tensor<?x?xi32>) -> tensor<?x?xi32>
1748+
// CHECK: %[[VAL_7:.*]] = tosa.intdiv %[[VAL_5]], %[[VAL_6]] : (tensor<?x?xi32>, tensor<?x?xi32>) -> tensor<?x?xi32>
17491749
// CHECK: %[[VAL_8:.*]] = "tosa.const"() <{values = dense<0> : tensor<i32>}> : () -> tensor<i32>
17501750
// CHECK: %[[VAL_9:.*]] = "tosa.const"() <{values = dense<1> : tensor<i32>}> : () -> tensor<i32>
17511751
// CHECK: %[[VAL_10:.*]] = tosa.const_shape {values = dense<1> : tensor<2xindex>} : () -> !tosa.shape<2>
@@ -1802,7 +1802,7 @@ func.func @torch.aten.div.Tensor_mode$float_basic(%arg0: !torch.vtensor<[?, ?],f
18021802
// CHECK: %[[VAL_4:.*]] = torch.constant.str ""
18031803
// CHECK: %[[VAL_5:.*]] = tosa.cast %[[VAL_3]] : (tensor<?x?xi64>) -> tensor<?x?xi32>
18041804
// CHECK: %[[VAL_6:.*]] = tosa.cast %[[VAL_2]] : (tensor<?x?xi64>) -> tensor<?x?xi32>
1805-
// CHECK: %[[VAL_7:.*]] = tosa.int_div %[[VAL_5]], %[[VAL_6]] : (tensor<?x?xi32>, tensor<?x?xi32>) -> tensor<?x?xi32>
1805+
// CHECK: %[[VAL_7:.*]] = tosa.intdiv %[[VAL_5]], %[[VAL_6]] : (tensor<?x?xi32>, tensor<?x?xi32>) -> tensor<?x?xi32>
18061806
// CHECK: %[[VAL_8:.*]] = tosa.cast %[[VAL_7]] : (tensor<?x?xi32>) -> tensor<?x?xi64>
18071807
// CHECK: %[[VAL_9:.*]] = torch_c.from_builtin_tensor %[[VAL_8]] : tensor<?x?xi64> -> !torch.vtensor<[?,?],si64>
18081808
// CHECK: return %[[VAL_9]] : !torch.vtensor<[?,?],si64>

test/Conversion/TorchToTosa/torch-backend-to-tosa-backend-pipeline.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func.func @torch.aten.div.Tensor$mixed_type_fp(%arg0: !torch.vtensor<[?, ?],f32>
111111
// CHECK-SAME: %[[VAL_0:.*]]: tensor<?x?xi16>,
112112
// CHECK-SAME: %[[VAL_1:.*]]: tensor<?x?xi32>
113113
// CHECK: %[[VAL_2:.*]] = tosa.cast %[[VAL_0]] : (tensor<?x?xi16>) -> tensor<?x?xi32>
114-
// CHECK: %[[VAL_3:.*]] = tosa.int_div %[[VAL_2]], %[[VAL_1]] : (tensor<?x?xi32>, tensor<?x?xi32>) -> tensor<?x?xi32>
114+
// CHECK: %[[VAL_3:.*]] = tosa.intdiv %[[VAL_2]], %[[VAL_1]] : (tensor<?x?xi32>, tensor<?x?xi32>) -> tensor<?x?xi32>
115115
func.func @torch.aten.div.Tensor$mixed_type_int(%arg0: !torch.vtensor<[?, ?],si16>, %arg1: !torch.vtensor<[?, ?],si32>) -> !torch.vtensor<[?, ?],si32> {
116116
%0 = torch.aten.div.Tensor %arg0, %arg1 : !torch.vtensor<[?, ?],si16>, !torch.vtensor<[?, ?],si32> -> !torch.vtensor<[?, ?],si32>
117117
return %0 : !torch.vtensor<[?, ?],si32>

0 commit comments

Comments
 (0)