Reland "[mlir][tosa] Combine unranked/ranked tensor types into single type" (#211708)
Reverts llvm/llvm-project#211701 Relands llvm/llvm-project#209737 The buildbot failure was misattributed to this change. Real cause is https://github.com/llvm/llvm-project/pull/207274
This commit is contained in:
parent
755f3e41de
commit
050c2ef111
4 changed files with 66 additions and 94 deletions
|
|
@ -174,33 +174,28 @@ def AtLeastRankOne : And<[
|
|||
def IsValidBlockScaledTensorType
|
||||
: CPred<"::mlir::succeeded(::mlir::tosa::verifyBlockScaledTensorType($_self, false))">;
|
||||
|
||||
// We include unranked tensors as a supported type for all possible tosa
|
||||
// Tensors as unranked does not guarantee invalid. If unranked tensors exist
|
||||
// they should be shape propagated using Tosa's shape inference pass and verified
|
||||
// to not include any remaining unranked tensors.
|
||||
class TosaTensorOf<list<Type> allowedTypes,
|
||||
list<Pred> extraRankedTensorPreds = [],
|
||||
string summary = "tosa-conformant tensor">
|
||||
: TensorOf<allowedTypes,
|
||||
[Or<[HasNo0Dimensions, IsUnrankedTensorTypePred]>,
|
||||
[Or<[
|
||||
IsUnrankedTensorTypePred,
|
||||
And<!listconcat([IsRankedTensorTypePred, HasNo0Dimensions], extraRankedTensorPreds)>
|
||||
]>,
|
||||
IsValidBlockScaledTensorType],
|
||||
summary>;
|
||||
|
||||
class TosaRankedTensorOf<list<Type> allowedTypes, list<Pred> preds = [],
|
||||
string summary = "tosa-conformant ranked tensor">
|
||||
: RankedTensorOf<
|
||||
allowedTypes,
|
||||
!listconcat([HasNo0Dimensions, IsValidBlockScaledTensorType], preds),
|
||||
summary>;
|
||||
|
||||
class TosaUnrankedTensorOf<list<Type> allowedTypes, list<Pred> preds = [],
|
||||
string summary = "tosa-conformant unranked tensor">
|
||||
: UnrankedTensorOf<allowedTypes,
|
||||
!listconcat([IsValidBlockScaledTensorType], preds),
|
||||
summary>;
|
||||
|
||||
class TosaTensorRankOf<list<Type> allowedTypes, list<int> ranks>
|
||||
: TosaRankedTensorOf<allowedTypes,
|
||||
: TosaTensorOf<allowedTypes,
|
||||
[HasAnyRankOfPred<ranks>],
|
||||
!interleave(!foreach(rank, ranks, rank # "D"), "/") # " tensor">;
|
||||
!interleave(!foreach(rank, ranks, rank # "D"), "/") # " tosa-conformant tensor">;
|
||||
|
||||
class TosaScalarTensorOf<list<Type> allowedTypes, list<int> ranks>
|
||||
: TosaRankedTensorOf<allowedTypes,
|
||||
: TosaTensorOf<allowedTypes,
|
||||
[HasAnyRankOfPred<ranks>, AllDimensionsAreSizeOne],
|
||||
"tosa-conformant scalar tensor">;
|
||||
|
||||
|
|
@ -217,9 +212,6 @@ def Tosa_FloatTensor : TosaTensorOf<[AnyFloat]>;
|
|||
// Either ranked or unranked tensor of TOSA supported element types.
|
||||
def Tosa_Tensor : TosaTensorOf<[Tosa_AnyNumber]>;
|
||||
|
||||
// Must be ranked but no further constraints
|
||||
def Tosa_RankedTensor : TosaRankedTensorOf<[Tosa_AnyNumber]>;
|
||||
|
||||
// Any tensor element type allowed in Tosa ops.
|
||||
def Tosa_ElementType : Type<Or<[Tosa_Int.predicate, Tosa_QuantizedInt.predicate,
|
||||
AnyFloat.predicate]>, "tosa.dtype">;
|
||||
|
|
@ -231,68 +223,48 @@ class Tosa_TensorOfOrNone<list<Type> allowedTypes, string description = ""> :
|
|||
// Tensor types with constrained ranks.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def Tosa_Rank0Tensor : TosaTensorRankOf<[Tosa_AnyNumber], [0]>;
|
||||
def Tosa_ScalarTensor : TosaScalarTensorOf<[Tosa_AnyNumber], [1]>;
|
||||
def Tosa_ScalarInt8Tensor : TosaScalarTensorOf<[Tosa_Int8], [1]>;
|
||||
def Tosa_ScalarIntOrFloatTensor : TosaScalarTensorOf<[Tosa_Int, AnyFloat], [1]>;
|
||||
def Tosa_ScalarInt32Tensor : TosaScalarTensorOf<[Tosa_Int32], [1]>;
|
||||
|
||||
def Tosa_ScalarTensor : AnyTypeOf<[TosaUnrankedTensorOf<[Tosa_Int, AnyFloat]>, TosaScalarTensorOf<[Tosa_AnyNumber], [1]>]>;
|
||||
def Tosa_ScalarInt8Tensor : AnyTypeOf<[TosaUnrankedTensorOf<[Tosa_Int8]>, TosaScalarTensorOf<[Tosa_Int8], [1]>]>;
|
||||
def Tosa_ScalarIntOrFloatTensor : AnyTypeOf<[TosaUnrankedTensorOf<[Tosa_Int, AnyFloat]>, TosaScalarTensorOf<[Tosa_Int, AnyFloat], [1]>]>;
|
||||
def Tosa_ScalarInt32Tensor : AnyTypeOf<[TosaUnrankedTensorOf<[Tosa_Int32]>, TosaScalarTensorOf<[Tosa_Int32], [1]>]>;
|
||||
|
||||
// We include unranked tensors as a supported type for all possible tosa
|
||||
// Tensors as unranked does not guarantee invalid. If unranked tensors exist
|
||||
// they should be shape propagate used Tosa's shape inference pass and verified
|
||||
// to not include any remaining unranked tensors.
|
||||
def Tosa_UnrankedTensor : TosaUnrankedTensorOf<[Tosa_AnyNumber]>;
|
||||
|
||||
def Tosa_Tensor1D : AnyTypeOf<[Tosa_UnrankedTensor, TosaTensorRankOf<[Tosa_AnyNumber], [1]>], "1-d tosa-conformant tensor", "::mlir::TensorType">;
|
||||
def Tosa_Tensor2D : AnyTypeOf<[Tosa_UnrankedTensor, TosaTensorRankOf<[Tosa_AnyNumber], [2]>], "2-d tosa-conformant tensor", "::mlir::TensorType">;
|
||||
def Tosa_Tensor3D : AnyTypeOf<[Tosa_UnrankedTensor, TosaTensorRankOf<[Tosa_AnyNumber], [3]>], "3-d tosa-conformant tensor", "::mlir::TensorType">;
|
||||
def Tosa_Tensor4D : AnyTypeOf<[Tosa_UnrankedTensor, TosaTensorRankOf<[Tosa_AnyNumber], [4]>], "4-d tosa-conformant tensor", "::mlir::TensorType">;
|
||||
def Tosa_Tensor5D : AnyTypeOf<[Tosa_UnrankedTensor, TosaTensorRankOf<[Tosa_AnyNumber], [5]>], "5-d tosa-conformant tensor", "::mlir::TensorType">;
|
||||
def Tosa_Tensor1D : TosaTensorRankOf<[Tosa_AnyNumber], [1]>;
|
||||
def Tosa_Tensor2D : TosaTensorRankOf<[Tosa_AnyNumber], [2]>;
|
||||
def Tosa_Tensor3D : TosaTensorRankOf<[Tosa_AnyNumber], [3]>;
|
||||
def Tosa_Tensor4D : TosaTensorRankOf<[Tosa_AnyNumber], [4]>;
|
||||
def Tosa_Tensor5D : TosaTensorRankOf<[Tosa_AnyNumber], [5]>;
|
||||
|
||||
// 1D tensor of specific types
|
||||
def Tosa_1DInt8Tensor : 1DTensorOf<[Tosa_Int8]>;
|
||||
def Tosa_1DInt16Or32Tensor : 1DTensorOf<[Tosa_Int16Or32]>;
|
||||
def Tosa_1DInt8Tensor : TosaTensorRankOf<[Tosa_Int8], [1]>;
|
||||
def Tosa_1DInt16Or32Tensor : TosaTensorRankOf<[Tosa_Int16Or32], [1]>;
|
||||
|
||||
// Ranked tensors up to given rank.
|
||||
def Tosa_Tensor1Dto4D : AnyTypeOf<[
|
||||
Tosa_UnrankedTensor, TosaTensorRankOf<[Tosa_AnyNumber], [1,2,3,4]>]>;
|
||||
def Tosa_Tensor1Dto6D : AnyTypeOf<[
|
||||
Tosa_UnrankedTensor, TosaTensorRankOf<[Tosa_AnyNumber], [1,2,3,4,5,6]>]>;
|
||||
// Tensors up to a given rank. Unranked tensors are accepted.
|
||||
def Tosa_Tensor1Dto4D : TosaTensorRankOf<[Tosa_AnyNumber], [1,2,3,4]>;
|
||||
def Tosa_Tensor1Dto6D : TosaTensorRankOf<[Tosa_AnyNumber], [1,2,3,4,5,6]>;
|
||||
|
||||
def Tosa_TensorUpto4D : AnyTypeOf<[
|
||||
Tosa_UnrankedTensor, TosaTensorRankOf<[Tosa_AnyNumber], [0,1,2,3,4]>]>;
|
||||
def Tosa_TensorUpto4D : TosaTensorRankOf<[Tosa_AnyNumber], [0,1,2,3,4]>;
|
||||
|
||||
def Tosa_IndexTensor1D : AnyTypeOf<[
|
||||
Tosa_UnrankedTensor, TosaTensorRankOf<[Tosa_Int32, Tosa_Int64], [1]>]>;
|
||||
def Tosa_IndexTensor2D : AnyTypeOf<[
|
||||
Tosa_UnrankedTensor, TosaTensorRankOf<[Tosa_Int32, Tosa_Int64], [2]>]>;
|
||||
def Tosa_IndexTensor1D : TosaTensorRankOf<[Tosa_Int32, Tosa_Int64], [1]>;
|
||||
def Tosa_IndexTensor2D : TosaTensorRankOf<[Tosa_Int32, Tosa_Int64], [2]>;
|
||||
|
||||
def Tosa_TensorAtLeast1D : AnyTypeOf<[
|
||||
Tosa_UnrankedTensor, TosaRankedTensorOf<[Tosa_AnyNumber], [AtLeastRankOne]>], "tosa-conformant tensor of at least rank 1", "::mlir::TensorType">;
|
||||
def Tosa_TensorAtLeast1D
|
||||
: TosaTensorOf<[Tosa_AnyNumber], [AtLeastRankOne],
|
||||
"tosa-conformant tensor of at least rank 1">;
|
||||
|
||||
def Tosa_MXFPDataTensor3D
|
||||
: AnyTypeOf<[TosaUnrankedTensorOf<[Tosa_MXFPValue]>,
|
||||
TosaTensorRankOf<[Tosa_MXFPValue], [3]>]>;
|
||||
: TosaTensorRankOf<[Tosa_MXFPValue], [3]>;
|
||||
def Tosa_MXFPScaleTensor3D
|
||||
: AnyTypeOf<[TosaUnrankedTensorOf<[Tosa_MXFPScale]>,
|
||||
TosaTensorRankOf<[Tosa_MXFPScale], [3]>]>;
|
||||
: TosaTensorRankOf<[Tosa_MXFPScale], [3]>;
|
||||
def Tosa_MXFPDataTensor4D
|
||||
: AnyTypeOf<[TosaUnrankedTensorOf<[Tosa_MXFPValue]>,
|
||||
TosaTensorRankOf<[Tosa_MXFPValue], [4]>]>;
|
||||
: TosaTensorRankOf<[Tosa_MXFPValue], [4]>;
|
||||
def Tosa_MXFPScaleTensor4D
|
||||
: AnyTypeOf<[TosaUnrankedTensorOf<[Tosa_MXFPScale]>,
|
||||
TosaTensorRankOf<[Tosa_MXFPScale], [4]>]>;
|
||||
: TosaTensorRankOf<[Tosa_MXFPScale], [4]>;
|
||||
def Tosa_MXFPDataTensorAtLeast1D
|
||||
: AnyTypeOf<[TosaUnrankedTensorOf<[Tosa_MXFPValue]>,
|
||||
TosaRankedTensorOf<[Tosa_MXFPValue], [AtLeastRankOne]>],
|
||||
"tosa-conformant tensor of at least rank 1",
|
||||
"::mlir::TensorType">;
|
||||
: TosaTensorOf<[Tosa_MXFPValue], [AtLeastRankOne],
|
||||
"tosa-conformant tensor of at least rank 1">;
|
||||
def Tosa_MXFPScaleTensorAtLeast1D
|
||||
: AnyTypeOf<[TosaUnrankedTensorOf<[Tosa_MXFPScale]>,
|
||||
TosaRankedTensorOf<[Tosa_MXFPScale], [AtLeastRankOne]>],
|
||||
"tosa-conformant tensor of at least rank 1",
|
||||
"::mlir::TensorType">;
|
||||
: TosaTensorOf<[Tosa_MXFPScale], [AtLeastRankOne],
|
||||
"tosa-conformant tensor of at least rank 1">;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Generic scalar, vector, or tensor of a particular type.
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ func.func @tensor_with_unknown_rank(%arg0: tensor<*xi32>) -> tensor<*xi32> {
|
|||
|
||||
// check that tosa verify kick in
|
||||
func.func @test_avg_pool2d_zero_dim_input(%arg0: tensor<1x0x?x9xf32>, %arg1: tensor<1xf32>, %arg2: tensor<1xf32>) -> tensor<1x7x7x9xf32> {
|
||||
// expected-error@+1 {{'tosa.avg_pool2d' op operand #0 must be 4-d tosa-conformant tensor, but got 'tensor<1x0x?x9xf32>'}}
|
||||
// expected-error@+1 {{'tosa.avg_pool2d' op operand #0 must be 4D tosa-conformant tensor of number values, but got 'tensor<1x0x?x9xf32>'}}
|
||||
%0 = "tosa.avg_pool2d"(%arg0, %arg1, %arg2) {acc_type = f32, kernel = array<i64: 2, 2>, pad = array<i64: 0, 1, 0, 1>, stride = array<i64: 1, 1>}
|
||||
: (tensor<1x0x?x9xf32>, tensor<1xf32>, tensor<1xf32>) -> tensor<1x7x7x9xf32>
|
||||
return %0 : tensor<1x7x7x9xf32>
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ func.func @test_concat_input_output_rank_mismatch(%arg0: tensor<2x2xf32>, %arg1:
|
|||
func.func @test_pad_invalid_padConst_rank(%arg0: tensor<13x21xf32>) {
|
||||
%0 = tosa.const_shape {values = dense<1> : tensor<4xindex>} : () -> !tosa.shape<4>
|
||||
%1 = "tosa.const"() {values = dense<3.14> : tensor<2xf32>} : () -> tensor<2xf32>
|
||||
// expected-error@+1 {{'tosa.pad' op operand #2 must be tosa-conformant unranked tensor of unsigned integer or signless integer or floating-point values or tosa-conformant scalar tensor of number values, but got 'tensor<2xf32>'}}
|
||||
// expected-error@+1 {{'tosa.pad' op operand #2 must be tosa-conformant scalar tensor of number values, but got 'tensor<2xf32>'}}
|
||||
%2 = tosa.pad %arg0, %0, %1 : (tensor<13x21xf32>, !tosa.shape<4>, tensor<2xf32>) -> tensor<13x21xf32>
|
||||
return
|
||||
}
|
||||
|
|
@ -435,7 +435,7 @@ func.func @test_const_attribute_type_mismatch() -> tensor<100x100xf32> {
|
|||
func.func @test_conv2d_static_zero_dim_input(%arg0: tensor<1x29x0x4xf32>, %arg1: tensor<16x3x3x4xf32>, %arg2: tensor<16xf32>) -> tensor<1x27x27x16xf32> {
|
||||
%input_zp = "tosa.const"() <{values = dense<0> : tensor<1xi32>}> : () -> tensor<1xi32>
|
||||
%weight_zp = "tosa.const"() <{values = dense<0> : tensor<1xi32>}> : () -> tensor<1xi32>
|
||||
// expected-error@+1 {{'tosa.conv2d' op operand #0 must be 4-d tosa-conformant tensor, but got 'tensor<1x29x0x4xf32>'}}
|
||||
// expected-error@+1 {{'tosa.conv2d' op operand #0 must be 4D tosa-conformant tensor of number values, but got 'tensor<1x29x0x4xf32>'}}
|
||||
%0 = tosa.conv2d %arg0, %arg1, %arg2, %input_zp, %weight_zp {acc_type = f32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 0, 0, 0>, stride = array<i64: 1, 1>}
|
||||
: (tensor<1x29x0x4xf32>, tensor<16x3x3x4xf32>, tensor<16xf32>, tensor<1xi32>, tensor<1xi32>) -> tensor<1x27x27x16xf32>
|
||||
return %0 : tensor<1x27x27x16xf32>
|
||||
|
|
@ -446,7 +446,7 @@ func.func @test_conv2d_static_zero_dim_input(%arg0: tensor<1x29x0x4xf32>, %arg1:
|
|||
func.func @test_conv2d_zero_dim_input(%arg0: tensor<1x?x0x4xf32>, %arg1: tensor<16x3x3x4xf32>, %arg2: tensor<16xf32>) -> tensor<1x27x27x16xf32> {
|
||||
%input_zp = "tosa.const"() <{values = dense<0> : tensor<1xi32>}> : () -> tensor<1xi32>
|
||||
%weight_zp = "tosa.const"() <{values = dense<0> : tensor<1xi32>}> : () -> tensor<1xi32>
|
||||
// expected-error@+1 {{'tosa.conv2d' op operand #0 must be 4-d tosa-conformant tensor, but got 'tensor<1x?x0x4xf32>'}}
|
||||
// expected-error@+1 {{'tosa.conv2d' op operand #0 must be 4D tosa-conformant tensor of number values, but got 'tensor<1x?x0x4xf32>'}}
|
||||
%0 = tosa.conv2d %arg0, %arg1, %arg2, %input_zp, %weight_zp {acc_type = f32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 0, 0, 0>, stride = array<i64: 1, 1>}
|
||||
: (tensor<1x?x0x4xf32>, tensor<16x3x3x4xf32>, tensor<16xf32>, tensor<1xi32>, tensor<1xi32>) -> tensor<1x27x27x16xf32>
|
||||
return %0 : tensor<1x27x27x16xf32>
|
||||
|
|
@ -456,7 +456,7 @@ func.func @test_conv2d_zero_dim_input(%arg0: tensor<1x?x0x4xf32>, %arg1: tensor<
|
|||
// -----
|
||||
|
||||
func.func @test_avg_pool2d_static_zero_dim_input(%arg0: tensor<1x0x7x9xf32>, %arg1: tensor<1xf32>, %arg2: tensor<1xf32>) -> tensor<1x7x7x9xf32> {
|
||||
// expected-error@+1 {{'tosa.avg_pool2d' op operand #0 must be 4-d tosa-conformant tensor, but got 'tensor<1x0x7x9xf32>'}}
|
||||
// expected-error@+1 {{'tosa.avg_pool2d' op operand #0 must be 4D tosa-conformant tensor of number values, but got 'tensor<1x0x7x9xf32>'}}
|
||||
%0 = "tosa.avg_pool2d"(%arg0, %arg1, %arg2) {acc_type = f32, kernel = array<i64: 2, 2>, pad = array<i64: 0, 1, 0, 1>, stride = array<i64: 1, 1>}
|
||||
: (tensor<1x0x7x9xf32>, tensor<1xf32>, tensor<1xf32>) -> tensor<1x7x7x9xf32>
|
||||
return %0 : tensor<1x7x7x9xf32>
|
||||
|
|
@ -465,7 +465,7 @@ func.func @test_avg_pool2d_static_zero_dim_input(%arg0: tensor<1x0x7x9xf32>, %ar
|
|||
// -----
|
||||
|
||||
func.func @test_avg_pool2d_zero_dim_input(%arg0: tensor<1x0x?x9xf32>, %arg1: tensor<1xf32>, %arg2: tensor<1xf32>) -> tensor<1x7x7x9xf32> {
|
||||
// expected-error@+1 {{'tosa.avg_pool2d' op operand #0 must be 4-d tosa-conformant tensor, but got 'tensor<1x0x?x9xf32>'}}
|
||||
// expected-error@+1 {{'tosa.avg_pool2d' op operand #0 must be 4D tosa-conformant tensor of number values, but got 'tensor<1x0x?x9xf32>'}}
|
||||
%0 = "tosa.avg_pool2d"(%arg0, %arg1, %arg2) {acc_type = f32, kernel = array<i64: 2, 2>, pad = array<i64: 0, 1, 0, 1>, stride = array<i64: 1, 1>}
|
||||
: (tensor<1x0x?x9xf32>, tensor<1xf32>, tensor<1xf32>) -> tensor<1x7x7x9xf32>
|
||||
return %0 : tensor<1x7x7x9xf32>
|
||||
|
|
@ -565,7 +565,7 @@ func.func @test_tile_io_rank_mismatch() {
|
|||
|
||||
// CHECK-LABEL: test_table_rank0_table
|
||||
func.func @test_table_rank0_table(%arg0: tensor<64xi16>, %arg1: tensor<i16>) {
|
||||
// expected-error@+1 {{'tosa.table' op operand #1 must be 1-d tosa-conformant tensor, but got 'tensor<i16>'}}
|
||||
// expected-error@+1 {{'tosa.table' op operand #1 must be 1D tosa-conformant tensor of number values, but got 'tensor<i16>'}}
|
||||
%0 = tosa.table %arg0, %arg1 : (tensor<64xi16>, tensor<i16>) -> tensor<64xi16>
|
||||
return
|
||||
}
|
||||
|
|
@ -903,7 +903,7 @@ func.func @test_non_tosa_ops() {
|
|||
func.func @test_pad_rank0_pad_const(%arg0: tensor<13x21x3xf8E4M3FN>) -> tensor<13x21x3xf8E5M2> {
|
||||
%padding = tosa.const_shape {values = dense<0> : tensor<6xindex>} : () -> !tosa.shape<6>
|
||||
%cst = "tosa.const"() { values = dense<-0.0> : tensor<f8E4M3FN> } : () -> tensor<f8E4M3FN>
|
||||
// expected-error@+1 {{'tosa.pad' op operand #2 must be tosa-conformant unranked tensor of unsigned integer or signless integer or floating-point values or tosa-conformant scalar tensor of number values, but got 'tensor<f8E4M3FN>'}}
|
||||
// expected-error@+1 {{'tosa.pad' op operand #2 must be tosa-conformant scalar tensor of number values, but got 'tensor<f8E4M3FN>'}}
|
||||
%0 = tosa.pad %arg0, %padding, %cst : (tensor<13x21x3xf8E4M3FN>, !tosa.shape<6>, tensor<f8E4M3FN>) -> tensor<13x21x3xf8E5M2>
|
||||
return %0 : tensor<13x21x3xf8E5M2>
|
||||
}
|
||||
|
|
@ -913,7 +913,7 @@ func.func @test_pad_rank0_pad_const(%arg0: tensor<13x21x3xf8E4M3FN>) -> tensor<1
|
|||
func.func @test_conv2d_rank0_zp(%arg0: tensor<1x29x29x4xi8>, %arg1: tensor<16x3x3x4xi8>, %arg2: tensor<16xi8>) -> tensor<1x27x27x16xi32> {
|
||||
%input_zp = "tosa.const"() <{values = dense<0> : tensor<i8>}> : () -> tensor<i8>
|
||||
%weight_zp = "tosa.const"() <{values = dense<0> : tensor<1xi8>}> : () -> tensor<1xi8>
|
||||
// expected-error@+1 {{'tosa.conv2d' op operand #3 must be tosa-conformant unranked tensor of unsigned integer or signless integer or floating-point values or tosa-conformant scalar tensor of unsigned integer or signless integer or floating-point values, but got 'tensor<i8>'}}
|
||||
// expected-error@+1 {{'tosa.conv2d' op operand #3 must be tosa-conformant scalar tensor of unsigned integer or signless integer or floating-point values, but got 'tensor<i8>'}}
|
||||
%0 = tosa.conv2d %arg0, %arg1, %arg2, %input_zp, %weight_zp {acc_type = i32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 0, 0, 0>, stride = array<i64: 1, 1>}
|
||||
: (tensor<1x29x29x4xi8>, tensor<16x3x3x4xi8>, tensor<16xi8>, tensor<i8>, tensor<1xi8>) -> tensor<1x27x27x16xi32>
|
||||
return %0 : tensor<1x27x27x16xi32>
|
||||
|
|
@ -1022,7 +1022,7 @@ func.func @test_sub_with_unequal_result_ranks(%arg0: tensor<1x21x3xf32>, %arg1:
|
|||
// CHECK-LABEL: test_mul_non_scalar_shift_2d
|
||||
func.func @test_mul_non_scalar_shift_2d(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x1x3xf32>) -> tensor<13x21x3xf32> {
|
||||
%shift = "tosa.const"() <{values = dense<0> : tensor<1x1xi8>}> : () -> tensor<1x1xi8>
|
||||
// expected-error@+1 {{'tosa.mul' op operand #2 must be tosa-conformant unranked tensor of 8-bit signless integer values or tosa-conformant scalar tensor of 8-bit signless integer values, but got 'tensor<1x1xi8>'}}
|
||||
// expected-error@+1 {{'tosa.mul' op operand #2 must be tosa-conformant scalar tensor of 8-bit signless integer values, but got 'tensor<1x1xi8>'}}
|
||||
%0 = tosa.mul %arg0, %arg1, %shift : (tensor<13x21x3xf32>, tensor<13x1x3xf32>, tensor<1x1xi8>) -> tensor<13x21x3xf32>
|
||||
return %0 : tensor<13x21x3xf32>
|
||||
}
|
||||
|
|
@ -1031,7 +1031,7 @@ func.func @test_mul_non_scalar_shift_2d(%arg0: tensor<13x21x3xf32>, %arg1: tenso
|
|||
// CHECK-LABEL: test_mul_non_scalar_shift_1d
|
||||
func.func @test_mul_non_scalar_shift_1d(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x1x3xf32>) -> tensor<13x21x3xf32> {
|
||||
%shift = "tosa.const"() <{values = dense<0> : tensor<2xi8>}> : () -> tensor<2xi8>
|
||||
// expected-error@+1 {{'tosa.mul' op operand #2 must be tosa-conformant unranked tensor of 8-bit signless integer values or tosa-conformant scalar tensor of 8-bit signless integer values, but got 'tensor<2xi8>'}}
|
||||
// expected-error@+1 {{'tosa.mul' op operand #2 must be tosa-conformant scalar tensor of 8-bit signless integer values, but got 'tensor<2xi8>'}}
|
||||
%0 = tosa.mul %arg0, %arg1, %shift : (tensor<13x21x3xf32>, tensor<13x1x3xf32>, tensor<2xi8>) -> tensor<13x21x3xf32>
|
||||
return %0 : tensor<13x21x3xf32>
|
||||
}
|
||||
|
|
@ -1392,7 +1392,7 @@ func.func @test_rescale_invalid_multiplier_type(%arg0: tensor<13x21x3xi32>) -> t
|
|||
%shift = "tosa.const"() {values = dense<30> : tensor<1xi16> } : () -> tensor<1xi16>
|
||||
%input_zp = "tosa.const"() {values = dense<0> : tensor<1xi32>} : () -> tensor<1xi32>
|
||||
%output_zp = "tosa.const"() {values = dense<0> : tensor<1xi32>} : () -> tensor<1xi32>
|
||||
// expected-error@+1 {{'tosa.rescale' op operand #1 must be 1D tensor of 16-bit signless integer or 32-bit signless integer values, but got 'tensor<1xi48>'}}
|
||||
// expected-error@+1 {{'tosa.rescale' op operand #1 must be 1D tosa-conformant tensor of 16-bit signless integer or 32-bit signless integer values, but got 'tensor<1xi48>'}}
|
||||
%0 = tosa.rescale %arg0, %multiplier, %shift, %input_zp, %output_zp {rounding_mode = SINGLE_ROUND, per_channel = false, scale32 = true, input_unsigned = false, output_unsigned = false} : (tensor<13x21x3xi32>, tensor<1xi48>, tensor<1xi16>, tensor<1xi32>, tensor<1xi32>) -> tensor<13x21x3xf32>
|
||||
return %0 : tensor<13x21x3xf32>
|
||||
}
|
||||
|
|
@ -1404,7 +1404,7 @@ func.func @test_rescale_invalid_shift_type(%arg0: tensor<13x21x3xi32>) -> tensor
|
|||
%shift = "tosa.const"() {values = dense<30> : tensor<1xi16> } : () -> tensor<1xi16>
|
||||
%input_zp = "tosa.const"() {values = dense<1> : tensor<1xi32>} : () -> tensor<1xi32>
|
||||
%output_zp = "tosa.const"() {values = dense<0> : tensor<1xi32>} : () -> tensor<1xi32>
|
||||
// expected-error@+1 {{'tosa.rescale' op operand #2 must be 1D tensor of 8-bit signless integer values, but got 'tensor<1xi16>'}}
|
||||
// expected-error@+1 {{'tosa.rescale' op operand #2 must be 1D tosa-conformant tensor of 8-bit signless integer values, but got 'tensor<1xi16>'}}
|
||||
%0 = tosa.rescale %arg0, %multiplier, %shift, %input_zp, %output_zp {rounding_mode = SINGLE_ROUND, per_channel = false, scale32 = true, input_unsigned = false, output_unsigned = false} : (tensor<13x21x3xi32>, tensor<1xi32>, tensor<1xi16>, tensor<1xi32>, tensor<1xi32>) -> tensor<13x21x3xf32>
|
||||
return %0 : tensor<13x21x3xf32>
|
||||
}
|
||||
|
|
@ -1513,7 +1513,7 @@ func.func @test_rescale_invalid_multiplier_rank(%arg0: tensor<13x21x3xi16>) -> t
|
|||
%shift = "tosa.const"() {values = dense<30> : tensor<1xi8> } : () -> tensor<1xi8>
|
||||
%input_zp = "tosa.const"() {values = dense<0> : tensor<1xi16>} : () -> tensor<1xi16>
|
||||
%output_zp = "tosa.const"() {values = dense<0> : tensor<1xi16>} : () -> tensor<1xi16>
|
||||
// expected-error@+1 {{'tosa.rescale' op operand #1 must be 1D tensor of 16-bit signless integer or 32-bit signless integer values, but got 'tensor<1x1xi32>'}}
|
||||
// expected-error@+1 {{'tosa.rescale' op operand #1 must be 1D tosa-conformant tensor of 16-bit signless integer or 32-bit signless integer values, but got 'tensor<1x1xi32>'}}
|
||||
%0 = tosa.rescale %arg0, %multiplier, %shift, %input_zp, %output_zp {rounding_mode = SINGLE_ROUND, per_channel = false, scale32 = true, input_unsigned = false, output_unsigned = true} : (tensor<13x21x3xi16>, tensor<1x1xi32>, tensor<1xi8>, tensor<1xi16>, tensor<1xi16>) -> tensor<13x21x3xi16>
|
||||
return %0 : tensor<13x21x3xi16>
|
||||
}
|
||||
|
|
@ -1525,7 +1525,7 @@ func.func @test_rescale_invalid_shift_rank(%arg0: tensor<13x21x3xi16>) -> tensor
|
|||
%shift = "tosa.const"() {values = dense<30> : tensor<1x1xi8> } : () -> tensor<1x1xi8>
|
||||
%input_zp = "tosa.const"() {values = dense<1> : tensor<1xi16>} : () -> tensor<1xi16>
|
||||
%output_zp = "tosa.const"() {values = dense<0> : tensor<1xi16>} : () -> tensor<1xi16>
|
||||
// expected-error@+1 {{'tosa.rescale' op operand #2 must be 1D tensor of 8-bit signless integer values, but got 'tensor<1x1xi8>'}}
|
||||
// expected-error@+1 {{'tosa.rescale' op operand #2 must be 1D tosa-conformant tensor of 8-bit signless integer values, but got 'tensor<1x1xi8>'}}
|
||||
%0 = tosa.rescale %arg0, %multiplier, %shift, %input_zp, %output_zp {rounding_mode = SINGLE_ROUND, per_channel = false, scale32 = true, input_unsigned = false, output_unsigned = true} : (tensor<13x21x3xi16>, tensor<1xi32>, tensor<1x1xi8>, tensor<1xi16>, tensor<1xi16>) -> tensor<13x21x3xi16>
|
||||
return %0 : tensor<13x21x3xi16>
|
||||
}
|
||||
|
|
@ -1949,7 +1949,7 @@ func.func @test_maxpool2d_unexpected_output_width(%arg0: tensor<1x32x32x8xf32>)
|
|||
// -----
|
||||
|
||||
func.func @test_scalar_argmax(%arg0: tensor<i32>) -> tensor<i32> {
|
||||
// expected-error@+1 {{'tosa.argmax' op operand #0 must be tosa-conformant tensor of at least rank 1, but got 'tensor<i32>'}}
|
||||
// expected-error@+1 {{'tosa.argmax' op operand #0 must be tosa-conformant tensor of at least rank 1 of number values, but got 'tensor<i32>'}}
|
||||
%0 = tosa.argmax %arg0 {axis = 0 : i32} : (tensor<i32>) -> tensor<i32>
|
||||
return %0 : tensor<i32>
|
||||
}
|
||||
|
|
@ -1957,7 +1957,7 @@ func.func @test_scalar_argmax(%arg0: tensor<i32>) -> tensor<i32> {
|
|||
// -----
|
||||
|
||||
func.func @test_scalar_reduce_all(%arg0: tensor<i1>) -> tensor<i1> {
|
||||
// expected-error@+1 {{'tosa.reduce_all' op operand #0 must be tosa-conformant tensor of at least rank 1, but got 'tensor<i1>'}}
|
||||
// expected-error@+1 {{'tosa.reduce_all' op operand #0 must be tosa-conformant tensor of at least rank 1 of number values, but got 'tensor<i1>'}}
|
||||
%0 = tosa.reduce_all %arg0 {axis = 0 : i32} : (tensor<i1>) -> tensor<i1>
|
||||
return %0 : tensor<i1>
|
||||
}
|
||||
|
|
@ -1965,7 +1965,7 @@ func.func @test_scalar_reduce_all(%arg0: tensor<i1>) -> tensor<i1> {
|
|||
// -----
|
||||
|
||||
func.func @test_scalar_inputs_concat(%arg0: tensor<f32>, %arg1: tensor<f32>) -> tensor<2xf32> {
|
||||
// expected-error@+1 {{'tosa.concat' op operand #0 must be variadic of tosa-conformant tensor of at least rank 1, but got 'tensor<f32>'}}
|
||||
// expected-error@+1 {{'tosa.concat' op operand #0 must be variadic of tosa-conformant tensor of at least rank 1 of number values, but got 'tensor<f32>'}}
|
||||
%0 = tosa.concat %arg0, %arg1 {axis = 0 : i32} : (tensor<f32>, tensor<f32>) -> tensor<2xf32>
|
||||
return %0 : tensor<2xf32>
|
||||
}
|
||||
|
|
@ -1975,7 +1975,7 @@ func.func @test_scalar_inputs_concat(%arg0: tensor<f32>, %arg1: tensor<f32>) ->
|
|||
func.func @test_scalar_pad(%arg0: tensor<f32>) -> tensor<f32> {
|
||||
%0 = "tosa.const"() {values = dense<3.14> : tensor<1xf32>} : () -> tensor<1xf32>
|
||||
%padding = tosa.const_shape {values = dense<0> : tensor<6xindex>} : () -> !tosa.shape<6>
|
||||
// expected-error@+1 {{'tosa.pad' op operand #0 must be tosa-conformant tensor of at least rank 1, but got 'tensor<f32>'}}
|
||||
// expected-error@+1 {{'tosa.pad' op operand #0 must be tosa-conformant tensor of at least rank 1 of number values, but got 'tensor<f32>'}}
|
||||
%1 = tosa.pad %arg0, %padding, %0 : (tensor<f32>, !tosa.shape<6>, tensor<1xf32>) -> tensor<f32>
|
||||
return %1 : tensor<f32>
|
||||
}
|
||||
|
|
@ -1983,7 +1983,7 @@ func.func @test_scalar_pad(%arg0: tensor<f32>) -> tensor<f32> {
|
|||
// -----
|
||||
|
||||
func.func @test_scalar_reverse(%arg0: tensor<f32>) -> tensor<f32> {
|
||||
// expected-error@+1 {{'tosa.reverse' op operand #0 must be tosa-conformant tensor of at least rank 1, but got 'tensor<f32>'}}
|
||||
// expected-error@+1 {{'tosa.reverse' op operand #0 must be tosa-conformant tensor of at least rank 1 of number values, but got 'tensor<f32>'}}
|
||||
%0 = tosa.reverse %arg0 {axis = 0: i32} : (tensor<f32>) -> tensor<f32>
|
||||
return %arg0 : tensor<f32>
|
||||
}
|
||||
|
|
@ -1992,7 +1992,7 @@ func.func @test_scalar_reverse(%arg0: tensor<f32>) -> tensor<f32> {
|
|||
|
||||
func.func @test_scalar_tile(%arg0: tensor<f32>) -> tensor<*xf32> {
|
||||
%cst = tosa.const_shape { values = dense<[]> : tensor<0xindex> } : () -> !tosa.shape<0>
|
||||
// expected-error@+1 {{'tosa.tile' op operand #0 must be tosa-conformant tensor of at least rank 1, but got 'tensor<f32>'}}
|
||||
// expected-error@+1 {{'tosa.tile' op operand #0 must be tosa-conformant tensor of at least rank 1 of number values, but got 'tensor<f32>'}}
|
||||
%0 = tosa.tile %arg0, %cst: (tensor<f32>, !tosa.shape<0>) -> tensor<*xf32>
|
||||
return %0 : tensor<*xf32>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ func.func @test_large_constant_permutation() {
|
|||
// -----
|
||||
|
||||
func.func @test_scalar_output_transpose(%arg0: tensor<*xf32>) -> tensor<f32> {
|
||||
// expected-error@+1 {{'tosa.transpose' op result #0 must be tosa-conformant tensor of at least rank 1, but got 'tensor<f32>'}}
|
||||
// expected-error@+1 {{'tosa.transpose' op result #0 must be tosa-conformant tensor of at least rank 1 of number values, but got 'tensor<f32>'}}
|
||||
%1 = tosa.transpose %arg0 {perms = array<i32: 2, 0, 1>} : (tensor<*xf32>) -> tensor<f32>
|
||||
return %1 : tensor<f32>
|
||||
}
|
||||
|
|
@ -187,7 +187,7 @@ func.func @test_slice_invalid_size() {
|
|||
func.func @test_scalar_slice(%arg0: tensor<f32>) -> tensor<f32> {
|
||||
%0 = tosa.const_shape {values = dense<[]> : tensor<0xindex>} : () -> !tosa.shape<0>
|
||||
%1 = tosa.const_shape {values = dense<[]> : tensor<0xindex>} : () -> !tosa.shape<0>
|
||||
// expected-error@+1 {{'tosa.slice' op operand #0 must be tosa-conformant tensor of at least rank 1, but got 'tensor<f32>'}}
|
||||
// expected-error@+1 {{'tosa.slice' op operand #0 must be tosa-conformant tensor of at least rank 1 of number values, but got 'tensor<f32>'}}
|
||||
%2 = tosa.slice %arg0, %0, %1 : (tensor<f32>, !tosa.shape<0>, !tosa.shape<0>) -> tensor<f32>
|
||||
return %2 : tensor<f32>
|
||||
}
|
||||
|
|
@ -1593,7 +1593,7 @@ func.func @cast_from_block_scaled_incompatible_input_output_shape(%arg0: tensor<
|
|||
// -----
|
||||
|
||||
func.func @cast_from_block_scaled_not_scalar(%arg0: tensor<f4E2M1FN>, %arg1: tensor<f8E8M0FNU>) -> tensor<f32> {
|
||||
// expected-error@+1 {{'tosa.cast_from_block_scaled' op operand #0 must be tosa-conformant tensor of at least rank 1, but got 'tensor<f4E2M1FN>'}}
|
||||
// expected-error@+1 {{'tosa.cast_from_block_scaled' op operand #0 must be tosa-conformant tensor of at least rank 1 of micro-scaling format number values, but got 'tensor<f4E2M1FN>'}}
|
||||
%0 = tosa.cast_from_block_scaled %arg0, %arg1 {block_size = #tosa.block_size<BLOCK_SIZE_32> : i32} : (tensor<f4E2M1FN>, tensor<f8E8M0FNU>) -> tensor<f32>
|
||||
return %0 : tensor<f32>
|
||||
}
|
||||
|
|
@ -1641,7 +1641,7 @@ func.func @test_cast_to_block_scaled_incompatible_input_output_shape(%arg0: tens
|
|||
// -----
|
||||
|
||||
func.func @test_cast_to_block_scaled_not_scalar(%arg0: tensor<f32>) -> (tensor<f4E2M1FN>, tensor<f8E8M0FNU>) {
|
||||
// expected-error@+1 {{'tosa.cast_to_block_scaled' op operand #0 must be tosa-conformant tensor of at least rank 1, but got 'tensor<f32>'}}
|
||||
// expected-error@+1 {{'tosa.cast_to_block_scaled' op operand #0 must be tosa-conformant tensor of at least rank 1 of number values, but got 'tensor<f32>'}}
|
||||
%0:2 = tosa.cast_to_block_scaled %arg0 {block_size = #tosa.block_size<BLOCK_SIZE_32>} : (tensor<f32>) -> (tensor<f4E2M1FN>, tensor<f8E8M0FNU>)
|
||||
return %0#0, %0#1 : tensor<f4E2M1FN>, tensor<f8E8M0FNU>
|
||||
}
|
||||
|
|
@ -1761,7 +1761,7 @@ func.func @test_dim_invalid_axis(%arg0: tensor<1x2x3xi32>) -> !tosa.shape<1> {
|
|||
// -----
|
||||
|
||||
func.func @test_dim_scalar(%arg0: tensor<i32>) -> !tosa.shape<1> {
|
||||
// expected-error@+1 {{'tosa.dim' op operand #0 must be tosa-conformant tensor of at least rank 1, but got 'tensor<i32>'}}
|
||||
// expected-error@+1 {{'tosa.dim' op operand #0 must be tosa-conformant tensor of at least rank 1 of number values, but got 'tensor<i32>'}}
|
||||
%0 = tosa.dim %arg0 {axis = 4 : i32} : (tensor<i32>) -> !tosa.shape<1>
|
||||
return %0 : !tosa.shape<1>
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue