[Mlir-commits] [mlir] [mlir][tosa] Remove Convolution Type Verifiers (PR #134077)
Jack Frankland
llvmlistbot at llvm.org
Wed Apr 2 06:51:15 PDT 2025
https://github.com/FranklandJack updated https://github.com/llvm/llvm-project/pull/134077
>From 88b2ac736765e8019bd438f3035f3c256d3f262c Mon Sep 17 00:00:00 2001
From: Jack Frankland <jack.frankland at arm.com>
Date: Wed, 2 Apr 2025 13:34:33 +0100
Subject: [PATCH] [mlir][tosa] Remove Convolution Type Verifiers
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.
Remove the only lit test that checked this constraint. This test used
quantized integer types and so would always fail the check since these
types aren't supported by the operator as opposed to an invalid
input/output combination which would have been a more realistic negative
test.
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 <jack.frankland at arm.com>
---
mlir/lib/Dialect/Tosa/IR/TosaOps.cpp | 12 +-----------
mlir/test/Dialect/Tosa/invalid.mlir | 9 ---------
2 files changed, 1 insertion(+), 20 deletions(-)
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index cdba332792eb0..b8d81213d9004 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -425,17 +425,7 @@ static LogicalResult verifyConvOpModes(T op) {
if (auto quantType = llvm::dyn_cast<mlir::quant::QuantizedType>(resultEType))
resultEType = quantType.getStorageType();
- // check allowed input/result element types combinations
- if ((inputEType.isInteger(8) && resultEType.isInteger(32)) ||
- (inputEType.isInteger(16) && resultEType.isInteger(48)) ||
- (isa<Float8E5M2Type>(inputEType) && resultEType.isF16()) ||
- (isa<Float8E4M3FNType>(inputEType) && resultEType.isF16()) ||
- (inputEType.isF16() && resultEType.isF16()) ||
- (inputEType.isBF16() && resultEType.isBF16()) ||
- (inputEType.isF32() && resultEType.isF32()))
- return success();
-
- return op.emitOpError("input/output element types are incompatible.");
+ return success();
}
// verify that inType and outType have same element types
diff --git a/mlir/test/Dialect/Tosa/invalid.mlir b/mlir/test/Dialect/Tosa/invalid.mlir
index ac8a247da24a7..10b8929b16a88 100644
--- a/mlir/test/Dialect/Tosa/invalid.mlir
+++ b/mlir/test/Dialect/Tosa/invalid.mlir
@@ -181,15 +181,6 @@ func.func @test_conv2d_quant_any_acc(%arg0: tensor<1x4x4x4x!quant.any<i8<-8:7>>>
return %0 : tensor<1x4x4x8x!quant.any<i8<-8:7>>>
}
-// -----
-// CHECK-LABEL: conv2d_quant_any_result
-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>>> {
- %zp = "tosa.const" () { values = dense<0> : tensor<1xi8> } : () -> tensor<1xi8>
- // expected-error at +1 {{'tosa.conv2d' op input/output element types are incompatible}}
- %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>>>
- return %0 : tensor<1x4x4x8x!quant.any<i8<-8:7>>>
-}
-
// -----
func.func @test_concat(%arg0 : tensor<2x1xf32>, %arg1 : tensor<2x2xf32>) -> tensor<?x?xf32> {
More information about the Mlir-commits
mailing list