Removes the identityn operator from TOSA MLIR definition.
Removes TosaToLinAlg mappings
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D102329
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 <size_t> 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<size_vals, %value.dtype>
- }
-
- }
-
- %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.
}
//===----------------------------------------------------------------------===//
-// 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<Tosa_TensorUpto6D>:$input1
- );
-
- let results = (outs
- Variadic<Tosa_TensorUpto6D>:$output
- );
-}
-
-//===----------------------------------------------------------------------===//
// TOSA Spec Section 2.14
// Operator Class: Custom Operators.
//===----------------------------------------------------------------------===//
PointwiseConverter<tosa::ReluNOp>,
PointwiseConverter<tosa::SigmoidOp>,
IdentityNConverter<tosa::IdentityOp>,
- IdentityNConverter<tosa::IdentityNOp>,
ReduceConverter<tosa::ReduceAllOp>,
ReduceConverter<tosa::ReduceAnyOp>,
ReduceConverter<tosa::ReduceMinOp>,
%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>
}
// -----
}
// -----
-// 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<f32>, %arg1: tensor<f32>, %arg2: tensor<i1>) -> tensor<f32> {
%0 = "tosa.cond_if"(%arg2, %arg0, %arg1) ( {