diff --git a/mlir/docs/Dialects/TOSA.md b/mlir/docs/Dialects/TOSA.md --- a/mlir/docs/Dialects/TOSA.md +++ b/mlir/docs/Dialects/TOSA.md @@ -61,41 +61,6 @@ described in the TOSA specification document under Section 1.3 Operator Selection. Explanation of the thinking behind some operators is listed here: -### IDENTITYN - -tosa.IDENTITYN is used to form a list of Operator results during -lowering of operations such as tf.Split from a sequence of tosa.SLICE -ops. If there are alternate ways to express this lowering without the -tosa.IDENTITYN op, the tosa.IDENTITYN op could be removed from TOSA. - -``` -Value lower_split_op(Value %value, size_t axis, size_t -num_split) { Value %output[] - - size_t slice_size = %value.shape[axis] / num_split - - for (int i = 0; i < num_split; i++) { - vector begin_vals, size_vals - - for (int j = 0; j < %value.rank; j++) { - if (j == axis) { - begin_vals.push_back(slice_size * i) - size_vals.push_back(slice_size) - } else { - begin_vals.push_back(0) - size_vals.push_bac(%value.shape[j]) - } - - %output[i] = tosa.SLICE(%value) {start=begin_vals, size=size_vals} (tensor<%value.type>) -> tensor - } - - } - - %output_list = tosa.IDENTITYN(%output) (tensor<%output:*.type>) -> tensor<%output_list:*.type> - return %output_list -} -``` - ### COND\_IF and WHILE\_LOOP Several neural networks express conditional control flow at the tensor level. diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td --- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td +++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td @@ -1585,28 +1585,6 @@ ); } -//===----------------------------------------------------------------------===// -// Operator: identityn -//===----------------------------------------------------------------------===// -//===----------------------------------------------------------------------===// -// Further described in docs/Rationale/RationaleTOSADialect.md . -//===----------------------------------------------------------------------===// -def Tosa_IdentityNOp: Tosa_Op<"identityn", [NoSideEffect]> { - let summary = "IdentityN operator"; - let description = [{ - Returns a list of tensors with the same shape, type, and contents as the - input list of tensors. - }]; - - let arguments = (ins - Variadic:$input1 - ); - - let results = (outs - Variadic:$output - ); -} - //===----------------------------------------------------------------------===// // TOSA Spec Section 2.14 // Operator Class: Custom Operators. diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp --- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp +++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp @@ -2328,7 +2328,6 @@ PointwiseConverter, PointwiseConverter, IdentityNConverter, - IdentityNConverter, ReduceConverter, ReduceConverter, ReduceConverter, diff --git a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir --- a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir +++ b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir @@ -482,10 +482,8 @@ %0 = "tosa.identity"(%arg0) : (tensor<1xf32>) -> tensor<1xf32> %1 = "tosa.identity"(%arg1) : (tensor<1xi32>) -> tensor<1xi32> - %2:2 = "tosa.identityn"(%0, %1) : (tensor<1xf32>, tensor<1xi32>) -> (tensor<1xf32>, tensor<1xi32>) - // CHECK: return %arg0, %arg1 - return %2#0, %2#1 : tensor<1xf32>, tensor<1xi32> + return %0, %1 : tensor<1xf32>, tensor<1xi32> } // ----- diff --git a/mlir/test/Dialect/Tosa/ops.mlir b/mlir/test/Dialect/Tosa/ops.mlir --- a/mlir/test/Dialect/Tosa/ops.mlir +++ b/mlir/test/Dialect/Tosa/ops.mlir @@ -473,13 +473,6 @@ return %0 : tensor<13x21x3xi32> } -// ----- -// CHECK-LABEL: identityn -func @test_identityn(%arg0: tensor<1xi32>, %arg1: tensor<1xi32>) -> tensor<1xi32> { - %0:2 = "tosa.identityn"(%arg0, %arg1) : (tensor<1xi32>, tensor<1xi32>) -> (tensor<1xi32>, tensor<1xi32>) - return %0#0 : tensor<1xi32> -} - // ----- // CHECK-LABEL: cond_if func @test_cond_if(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor {