Skip to content

Commit 3871a47

Browse files
FranklandJackgithub-actions[bot]
authored andcommitted
Automerge: [mlir][tosa] Remove Convolution Type Verifiers (#134077)
Remove the test in the convolution verifier that checks the input and output element types of convolution operations conform to the constraints imposed by the TOSA 1.0 specification. These checks are too strict for users of the TOSA dialect who wish to allow more types than those allowed by the spec and provide compatibility issues with earlier TOSA implementation which allowed more type combinations. Users who do wish to constrain the convolution types combination to only those allowed by the TOSA 1.0 spec should run the TOSA validation pass which already performs these checks. Signed-off-by: Jack Frankland <[email protected]>
2 parents a230ba3 + 6f324bd commit 3871a47

File tree

2 files changed

+1
-20
lines changed

2 files changed

+1
-20
lines changed

mlir/lib/Dialect/Tosa/IR/TosaOps.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -425,17 +425,7 @@ static LogicalResult verifyConvOpModes(T op) {
425425
if (auto quantType = llvm::dyn_cast<mlir::quant::QuantizedType>(resultEType))
426426
resultEType = quantType.getStorageType();
427427

428-
// check allowed input/result element types combinations
429-
if ((inputEType.isInteger(8) && resultEType.isInteger(32)) ||
430-
(inputEType.isInteger(16) && resultEType.isInteger(48)) ||
431-
(isa<Float8E5M2Type>(inputEType) && resultEType.isF16()) ||
432-
(isa<Float8E4M3FNType>(inputEType) && resultEType.isF16()) ||
433-
(inputEType.isF16() && resultEType.isF16()) ||
434-
(inputEType.isBF16() && resultEType.isBF16()) ||
435-
(inputEType.isF32() && resultEType.isF32()))
436-
return success();
437-
438-
return op.emitOpError("input/output element types are incompatible.");
428+
return success();
439429
}
440430

441431
// verify that inType and outType have same element types

mlir/test/Dialect/Tosa/invalid.mlir

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,6 @@ func.func @test_conv2d_quant_any_acc(%arg0: tensor<1x4x4x4x!quant.any<i8<-8:7>>>
181181
return %0 : tensor<1x4x4x8x!quant.any<i8<-8:7>>>
182182
}
183183

184-
// -----
185-
// CHECK-LABEL: conv2d_quant_any_result
186-
func.func @test_conv2d_quant_any_result(%arg0: tensor<1x4x4x4x!quant.any<i8<-8:7>>>, %arg1: tensor<8x1x1x4x!quant.any<i8<-8:7>>>, %arg2: tensor<8x!quant.any<i8<-8:7>>>) -> tensor<1x4x4x8x!quant.any<i8<-8:7>>> {
187-
%zp = "tosa.const" () { values = dense<0> : tensor<1xi8> } : () -> tensor<1xi8>
188-
// expected-error@+1 {{'tosa.conv2d' op input/output element types are incompatible}}
189-
%0 = tosa.conv2d %arg0, %arg1, %arg2, %zp, %zp {acc_type = i32, dilation = array<i64: 1, 1>, pad = array<i64: 0, 0, 0, 0>, stride = array<i64: 1, 1>, local_bound = true} : (tensor<1x4x4x4x!quant.any<i8<-8:7>>>, tensor<8x1x1x4x!quant.any<i8<-8:7>>>, tensor<8x!quant.any<i8<-8:7>>>, tensor<1xi8>, tensor<1xi8>) -> tensor<1x4x4x8x!quant.any<i8<-8:7>>>
190-
return %0 : tensor<1x4x4x8x!quant.any<i8<-8:7>>>
191-
}
192-
193184
// -----
194185

195186
func.func @test_concat(%arg0 : tensor<2x1xf32>, %arg1 : tensor<2x2xf32>) -> tensor<?x?xf32> {

0 commit comments

Comments
 (0)