[Mlir-commits] [mlir] 177ede2 - [mlir][tosa] Rename ReduceProd to ReduceProduct (#128751)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Feb 26 12:54:10 PST 2025
Author: Tai Ly
Date: 2025-02-26T12:54:07-08:00
New Revision: 177ede2122b8a913b1a86d86cb3acf17cdd93a86
URL: https://github.com/llvm/llvm-project/commit/177ede2122b8a913b1a86d86cb3acf17cdd93a86
DIFF: https://github.com/llvm/llvm-project/commit/177ede2122b8a913b1a86d86cb3acf17cdd93a86.diff
LOG: [mlir][tosa] Rename ReduceProd to ReduceProduct (#128751)
This patch renames TOSA ReduceProd operator to ReduceProduct to align
with the TOSA Spec 1.0
Signed-off-by: Tai Ly <tai.ly at arm.com>
Added:
Modified:
mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
mlir/lib/Dialect/Tosa/Transforms/TosaFolders.cpp
mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp
mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
mlir/test/Dialect/Tosa/availability.mlir
mlir/test/Dialect/Tosa/canonicalize.mlir
mlir/test/Dialect/Tosa/constant-op-fold.mlir
mlir/test/Dialect/Tosa/invalid.mlir
mlir/test/Dialect/Tosa/level_check.mlir
mlir/test/Dialect/Tosa/ops.mlir
mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
index bb770344e2ba6..ddfec2c9bfcd3 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
@@ -1740,8 +1740,8 @@ def Tosa_ReduceMinOp : Tosa_InferTensorTypeOp<"reduce_min"> {
//===----------------------------------------------------------------------===//
// Operator: reduce_prod
//===----------------------------------------------------------------------===//
-def Tosa_ReduceProdOp : Tosa_InferTensorTypeOp<"reduce_prod"> {
- let summary = "Reduce Prod operator";
+def Tosa_ReduceProductOp : Tosa_InferTensorTypeOp<"reduce_product"> {
+ let summary = "Reduce Product operator";
let description = [{
Reduce a tensor along the given axis by computing the product of the axis.
diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
index dfab37497d5c2..06831a642664e 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
@@ -1055,10 +1055,10 @@ static TypedAttr createInitialValueForReduceOp(Operation *op, Type elementTy,
if (isa<tosa::ReduceSumOp>(op) && isa<IntegerType>(elementTy))
return rewriter.getIntegerAttr(elementTy, 0);
- if (isa<tosa::ReduceProdOp>(op) && isa<FloatType>(elementTy))
+ if (isa<tosa::ReduceProductOp>(op) && isa<FloatType>(elementTy))
return rewriter.getFloatAttr(elementTy, 1.0);
- if (isa<tosa::ReduceProdOp>(op) && isa<IntegerType>(elementTy))
+ if (isa<tosa::ReduceProductOp>(op) && isa<IntegerType>(elementTy))
return rewriter.getIntegerAttr(elementTy, 1);
if (isa<tosa::ReduceMinOp>(op) && isa<FloatType>(elementTy))
@@ -1112,11 +1112,11 @@ static Value createLinalgBodyCalculationForReduceOp(Operation *op,
return rewriter.create<arith::AddIOp>(loc, args);
}
- if (isa<tosa::ReduceProdOp>(op) && isa<FloatType>(elementTy)) {
+ if (isa<tosa::ReduceProductOp>(op) && isa<FloatType>(elementTy)) {
return rewriter.create<arith::MulFOp>(loc, args);
}
- if (isa<tosa::ReduceProdOp>(op) && isa<IntegerType>(elementTy)) {
+ if (isa<tosa::ReduceProductOp>(op) && isa<IntegerType>(elementTy)) {
return rewriter.create<arith::MulIOp>(loc, args);
}
@@ -2874,7 +2874,7 @@ void mlir::tosa::populateTosaToLinalgConversionPatterns(
ReduceConverter<tosa::ReduceMinOp>,
ReduceConverter<tosa::ReduceMaxOp>,
ReduceConverter<tosa::ReduceSumOp>,
- ReduceConverter<tosa::ReduceProdOp>,
+ ReduceConverter<tosa::ReduceProductOp>,
ArgMaxConverter,
GatherConverter,
RescaleConverter,
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
index 4da1a7b6252e1..dcba9ef67a008 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
@@ -949,7 +949,7 @@ REDUCE_FOLDER(ReduceAllOp)
REDUCE_FOLDER(ReduceAnyOp)
REDUCE_FOLDER(ReduceMaxOp)
REDUCE_FOLDER(ReduceMinOp)
-REDUCE_FOLDER(ReduceProdOp)
+REDUCE_FOLDER(ReduceProductOp)
REDUCE_FOLDER(ReduceSumOp)
#undef REDUCE_FOLDER
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index cfa56aa05e812..7b50eceb081dd 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -1832,7 +1832,7 @@ REDUCE_SHAPE_INFER(tosa::ReduceAllOp)
REDUCE_SHAPE_INFER(tosa::ReduceAnyOp)
REDUCE_SHAPE_INFER(tosa::ReduceMaxOp)
REDUCE_SHAPE_INFER(tosa::ReduceMinOp)
-REDUCE_SHAPE_INFER(tosa::ReduceProdOp)
+REDUCE_SHAPE_INFER(tosa::ReduceProductOp)
REDUCE_SHAPE_INFER(tosa::ReduceSumOp)
#undef REDUCE_SHAPE_INFER
COMPATIBLE_RETURN_TYPES(tosa::ConcatOp)
@@ -1892,7 +1892,7 @@ LogicalResult tosa::ReduceAllOp::verify() { return verifyReduceOp(*this); }
LogicalResult tosa::ReduceAnyOp::verify() { return verifyReduceOp(*this); }
LogicalResult tosa::ReduceMaxOp::verify() { return verifyReduceOp(*this); }
LogicalResult tosa::ReduceMinOp::verify() { return verifyReduceOp(*this); }
-LogicalResult tosa::ReduceProdOp::verify() { return verifyReduceOp(*this); }
+LogicalResult tosa::ReduceProductOp::verify() { return verifyReduceOp(*this); }
LogicalResult tosa::ReduceSumOp::verify() { return verifyReduceOp(*this); }
static LogicalResult NAryInferReturnTypes(
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaFolders.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaFolders.cpp
index 43e9507b4d95a..1f5a906153cd9 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaFolders.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaFolders.cpp
@@ -408,7 +408,7 @@ void mlir::tosa::populateTosaConstantReduction(MLIRContext *ctx,
ctx, aggressiveReduceConstant);
patterns.add<ReduceConstantOptimization<ReduceMinOp>>(
ctx, aggressiveReduceConstant);
- patterns.add<ReduceConstantOptimization<ReduceProdOp>>(
+ patterns.add<ReduceConstantOptimization<ReduceProductOp>>(
ctx, aggressiveReduceConstant);
patterns.add<ReduceConstantOptimization<ReduceSumOp>>(
ctx, aggressiveReduceConstant);
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp
index 98d7c1dabd100..1d8aaa65c2976 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp
@@ -272,7 +272,7 @@ LogicalResult ProfileInfoDepot::populatationDispatch(Operation *op) {
POPULATE_PROFILE_INFO_COMMON(ReduceAny)
POPULATE_PROFILE_INFO_COMMON(ReduceMax)
POPULATE_PROFILE_INFO_COMMON(ReduceMin)
- POPULATE_PROFILE_INFO_COMMON(ReduceProd)
+ POPULATE_PROFILE_INFO_COMMON(ReduceProduct)
POPULATE_PROFILE_INFO_COMMON(ReduceSum)
POPULATE_PROFILE_INFO_COMMON(Equal)
POPULATE_PROFILE_INFO_COMMON(GreaterEqual)
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
index 708b3fc30c085..436890443ca9a 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
@@ -220,7 +220,7 @@ struct TosaValidation : public tosa::impl::TosaValidationBase<TosaValidation> {
CHECK_RANKS_FOR(ReduceAny);
CHECK_RANKS_FOR(ReduceMax);
CHECK_RANKS_FOR(ReduceMin);
- CHECK_RANKS_FOR(ReduceProd);
+ CHECK_RANKS_FOR(ReduceProduct);
CHECK_RANKS_FOR(ReduceSum);
// all data layout operators:
CHECK_RANKS_FOR(Concat);
diff --git a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
index 86e6f9ed9264b..78f2e173d7cb1 100644
--- a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
+++ b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
@@ -951,7 +951,7 @@ func.func @reduce_float(%arg0: tensor<5x4xf32>) -> () {
// CHECK: linalg.fill
// CHECK: linalg.reduce
// CHECK: arith.mulf
- %2 = tosa.reduce_prod %arg0 {axis = 0 : i32} : (tensor<5x4xf32>) -> tensor<1x4xf32>
+ %2 = tosa.reduce_product %arg0 {axis = 0 : i32} : (tensor<5x4xf32>) -> tensor<1x4xf32>
// CHECK: arith.constant 3.40282347E+38 : f32
// CHECK: linalg.fill
@@ -1027,7 +1027,7 @@ func.func @reduce_float_dyn_nonzero_batch(%arg0: tensor<5x?x4xf32>) -> () {
// CHECK: %[[DIM_1:.+]] = tensor.dim %[[REDUCE]], %[[C1_0]] : tensor<5x?xf32>
// CHECK: %[[C1_2:.+]] = arith.constant 1 : index
// CHECK: tensor.expand_shape %[[REDUCE]] {{\[}}[0], [1, 2]] output_shape [5, %[[DIM_1]], 1] : tensor<5x?xf32> into tensor<5x?x1xf32>
- %0 = tosa.reduce_prod %arg0 {axis = 2 : i32} : (tensor<5x?x4xf32>) -> tensor<5x?x1xf32>
+ %0 = tosa.reduce_product %arg0 {axis = 2 : i32} : (tensor<5x?x4xf32>) -> tensor<5x?x1xf32>
return
}
@@ -1085,7 +1085,7 @@ func.func @reduce_int(%arg0: tensor<5x4xi32>) -> () {
// CHECK: linalg.fill
// CHECK: linalg.reduce
// CHECK: arith.muli
- %2 = tosa.reduce_prod %arg0 {axis = 0 : i32} : (tensor<5x4xi32>) -> tensor<1x4xi32>
+ %2 = tosa.reduce_product %arg0 {axis = 0 : i32} : (tensor<5x4xi32>) -> tensor<1x4xi32>
// CHECK: arith.constant 2147483647 : i32
// CHECK: linalg.fill
diff --git a/mlir/test/Dialect/Tosa/availability.mlir b/mlir/test/Dialect/Tosa/availability.mlir
index abedabb40fc74..7324b0ea52e89 100644
--- a/mlir/test/Dialect/Tosa/availability.mlir
+++ b/mlir/test/Dialect/Tosa/availability.mlir
@@ -486,7 +486,7 @@ func.func @test_reduce_min(%arg0: tensor<13x21x3xf32>) -> tensor<1x21x3xf32> {
func.func @test_reduce_product(%arg0: tensor<13x21x3xf32>) -> tensor<1x21x3xf32> {
// CHECK: profiles: [ [pro_fp] ]
// CHECK: extensions: [ [bf16] ]
- %0 = tosa.reduce_prod %arg0 {axis = 0 : i32} : (tensor<13x21x3xf32>) -> tensor<1x21x3xf32>
+ %0 = tosa.reduce_product %arg0 {axis = 0 : i32} : (tensor<13x21x3xf32>) -> tensor<1x21x3xf32>
return %0 : tensor<1x21x3xf32>
}
diff --git a/mlir/test/Dialect/Tosa/canonicalize.mlir b/mlir/test/Dialect/Tosa/canonicalize.mlir
index bfc307d5187fa..66de6b23eae01 100644
--- a/mlir/test/Dialect/Tosa/canonicalize.mlir
+++ b/mlir/test/Dialect/Tosa/canonicalize.mlir
@@ -501,19 +501,19 @@ func.func @reduce_min_nofold(%arg0: tensor<?x1xf32>) -> tensor<?x1xf32> {
// -----
-// CHECK-LABEL: @reduce_prod_fold
-func.func @reduce_prod_fold(%arg0: tensor<?x1xf32>) -> tensor<?x1xf32> {
+// CHECK-LABEL: @reduce_product_fold
+func.func @reduce_product_fold(%arg0: tensor<?x1xf32>) -> tensor<?x1xf32> {
// CHECK: return %arg0
- %0 = tosa.reduce_prod %arg0 {axis = 1 : i32}: (tensor<?x1xf32>) -> tensor<?x1xf32>
+ %0 = tosa.reduce_product %arg0 {axis = 1 : i32}: (tensor<?x1xf32>) -> tensor<?x1xf32>
return %0 : tensor<?x1xf32>
}
// -----
-// CHECK-LABEL: @reduce_prod_nofold
-func.func @reduce_prod_nofold(%arg0: tensor<?x1xf32>) -> tensor<?x1xf32> {
- // CHECK: tosa.reduce_prod
- %0 = tosa.reduce_prod %arg0 {axis = 0 : i32}: (tensor<?x1xf32>) -> tensor<?x1xf32>
+// CHECK-LABEL: @reduce_product_nofold
+func.func @reduce_product_nofold(%arg0: tensor<?x1xf32>) -> tensor<?x1xf32> {
+ // CHECK: tosa.reduce_product
+ %0 = tosa.reduce_product %arg0 {axis = 0 : i32}: (tensor<?x1xf32>) -> tensor<?x1xf32>
return %0 : tensor<?x1xf32>
}
diff --git a/mlir/test/Dialect/Tosa/constant-op-fold.mlir b/mlir/test/Dialect/Tosa/constant-op-fold.mlir
index 190aa777d3470..db76eb54a54cf 100644
--- a/mlir/test/Dialect/Tosa/constant-op-fold.mlir
+++ b/mlir/test/Dialect/Tosa/constant-op-fold.mlir
@@ -721,7 +721,7 @@ func.func @reduce_sum_constant() -> tensor<2x3x1x5xi32> {
// CHECK: return %[[VAL_0]] : tensor<1x3xi32>
%const = "tosa.const"() <{value = dense<[[1,2,3], [4,5,6]]> : tensor<2x3xi32>}> : () -> tensor<2x3xi32>
- %0 = tosa.reduce_prod %const {axis = 0 : i32} : (tensor<2x3xi32>) -> tensor<1x3xi32>
+ %0 = tosa.reduce_product %const {axis = 0 : i32} : (tensor<2x3xi32>) -> tensor<1x3xi32>
return %0 : tensor<1x3xi32>
}
@@ -734,7 +734,7 @@ func.func @reduce_sum_constant() -> tensor<2x3x1x5xi32> {
// CHECK: }
%const = "tosa.const"() <{value = dense<[[1,2,3], [4,5,6]]> : tensor<2x3xi32>}> : () -> tensor<2x3xi32>
- %0 = tosa.reduce_prod %const {axis = 1 : i32} : (tensor<2x3xi32>) -> tensor<2x1xi32>
+ %0 = tosa.reduce_product %const {axis = 1 : i32} : (tensor<2x3xi32>) -> tensor<2x1xi32>
return %0 : tensor<2x1xi32>
}
@@ -746,7 +746,7 @@ func.func @reduce_prod_constant() -> tensor<3x1xi32> {
// CHECK: return %[[VAL_0]] : tensor<3x1xi32>
// CHECK: }
%const = "tosa.const"() <{value = dense<[[1, 2, 3], [4, 5, 6], [7, 8, 9]]> : tensor<3x3xi32>}> : () -> tensor<3x3xi32>
- %0 = tosa.reduce_prod %const {axis = 1 : i32} : (tensor<3x3xi32>) -> tensor<3x1xi32>
+ %0 = tosa.reduce_product %const {axis = 1 : i32} : (tensor<3x3xi32>) -> tensor<3x1xi32>
return %0 : tensor<3x1xi32>
}
@@ -758,7 +758,7 @@ func.func @reduce_prod_constant() -> tensor<2x1x4xi32> {
// CHECK: return %[[VAL_0]] : tensor<2x1x4xi32>
// CHECK: }
%const = "tosa.const"() <{value = dense<[[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]], [[13, 14, 15, 16], [17, 18, 19, 20], [21, 22, 23, 24]]]> : tensor<2x3x4xi32>}> : () -> tensor<2x3x4xi32>
- %0 = tosa.reduce_prod %const {axis = 1 : i32} : (tensor<2x3x4xi32>) -> tensor<2x1x4xi32>
+ %0 = tosa.reduce_product %const {axis = 1 : i32} : (tensor<2x3x4xi32>) -> tensor<2x1x4xi32>
return %0 : tensor<2x1x4xi32>
}
@@ -770,7 +770,7 @@ func.func @reduce_prod_constant() -> tensor<1x3x3xi32> {
// CHECK: return %[[VAL_0]] : tensor<1x3x3xi32>
// CHECK: }
%const = "tosa.const"() <{value = dense<[[[1, 2, 3], [4, 5, 6], [7, 8, 9]], [[10, 11, 12], [13, 14, 15], [16, 17, 18]], [[19, 20, 21], [22, 23, 24], [25, 26, 27]]]> : tensor<3x3x3xi32>}> : () -> tensor<3x3x3xi32>
- %0 = tosa.reduce_prod %const {axis = 0 : i32} : (tensor<3x3x3xi32>) -> tensor<1x3x3xi32>
+ %0 = tosa.reduce_product %const {axis = 0 : i32} : (tensor<3x3x3xi32>) -> tensor<1x3x3xi32>
return %0 : tensor<1x3x3xi32>
}
@@ -782,7 +782,7 @@ func.func @reduce_prod_constant() -> tensor<2x2x2x1xi32> {
// CHECK: return %[[VAL_0]] : tensor<2x2x2x1xi32>
// CHECK: }
%const = "tosa.const"() <{value = dense<[[[[1, 2], [3, 4]], [[5, 6], [7, 8]]], [[[9, 10], [11, 12]], [[13, 14], [15, 16]]]]> : tensor<2x2x2x2xi32>}> : () -> tensor<2x2x2x2xi32>
- %0 = tosa.reduce_prod %const {axis = 3 : i32} : (tensor<2x2x2x2xi32>) -> tensor<2x2x2x1xi32>
+ %0 = tosa.reduce_product %const {axis = 3 : i32} : (tensor<2x2x2x2xi32>) -> tensor<2x2x2x1xi32>
return %0 : tensor<2x2x2x1xi32>
}
@@ -794,7 +794,7 @@ func.func @reduce_prod_constant() -> tensor<1x1x1xi32> {
// CHECK: return %[[VAL_0]] : tensor<1x1x1xi32>
// CHECK: }
%const = "tosa.const"() <{value = dense<[[[42]]]> : tensor<1x1x1xi32>}> : () -> tensor<1x1x1xi32>
- %0 = tosa.reduce_prod %const {axis = 0 : i32} : (tensor<1x1x1xi32>) -> tensor<1x1x1xi32>
+ %0 = tosa.reduce_product %const {axis = 0 : i32} : (tensor<1x1x1xi32>) -> tensor<1x1x1xi32>
return %0 : tensor<1x1x1xi32>
}
diff --git a/mlir/test/Dialect/Tosa/invalid.mlir b/mlir/test/Dialect/Tosa/invalid.mlir
index c8ffbffb550ba..123c65e1b4fcd 100644
--- a/mlir/test/Dialect/Tosa/invalid.mlir
+++ b/mlir/test/Dialect/Tosa/invalid.mlir
@@ -365,8 +365,8 @@ func.func @test_reduce_min_type_mismatch(%arg0 : tensor<2x3x4x5xf32>) -> () {
// -----
func.func @test_reduce_prod_type_mismatch(%arg0 : tensor<2x3x4x5xf32>) -> () {
- // expected-error at +1 {{'tosa.reduce_prod' op expect reduced dimension size to be 1, got 3}}
- %0 = tosa.reduce_prod %arg0 {axis = 1 : i32} : (tensor<2x3x4x5xf32>) -> tensor<2x3x4x5xf32>
+ // expected-error at +1 {{'tosa.reduce_product' op expect reduced dimension size to be 1, got 3}}
+ %0 = tosa.reduce_product %arg0 {axis = 1 : i32} : (tensor<2x3x4x5xf32>) -> tensor<2x3x4x5xf32>
return
}
@@ -405,8 +405,8 @@ func.func @test_reduce_min_invalid_axis(%arg0 : tensor<2x3x4xf32>) -> () {
// -----
func.func @test_reduce_prod_invalid_axis(%arg0 : tensor<2x3x4xf32>) -> () {
- // expected-error at +1 {{'tosa.reduce_prod' op expect input tensor rank (3) to be larger than reduce axis (3)}}
- %0 = tosa.reduce_prod %arg0 {axis = 3 : i32} : (tensor<2x3x4xf32>) -> tensor<2x3x1xf32>
+ // expected-error at +1 {{'tosa.reduce_product' op expect input tensor rank (3) to be larger than reduce axis (3)}}
+ %0 = tosa.reduce_product %arg0 {axis = 3 : i32} : (tensor<2x3x4xf32>) -> tensor<2x3x1xf32>
return
}
diff --git a/mlir/test/Dialect/Tosa/level_check.mlir b/mlir/test/Dialect/Tosa/level_check.mlir
index a7f44f40c4efc..d2958efe1bb24 100644
--- a/mlir/test/Dialect/Tosa/level_check.mlir
+++ b/mlir/test/Dialect/Tosa/level_check.mlir
@@ -45,8 +45,8 @@ func.func @test_reduce_min(%arg0: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1
// -----
func.func @test_reduce_prod(%arg0: tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32> {
- // expected-error at +1 {{'tosa.reduce_prod' op failed level check: operand rank(shape) <= MAX_RANK}}
- %0 = "tosa.reduce_prod"(%arg0) {axis = 0 : i32} : (tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32>
+ // expected-error at +1 {{'tosa.reduce_product' op failed level check: operand rank(shape) <= MAX_RANK}}
+ %0 = "tosa.reduce_product"(%arg0) {axis = 0 : i32} : (tensor<1x1x1x1x13x21x3xf32>) -> tensor<1x1x1x1x13x21x3xf32>
return %0 : tensor<1x1x1x1x13x21x3xf32>
}
diff --git a/mlir/test/Dialect/Tosa/ops.mlir b/mlir/test/Dialect/Tosa/ops.mlir
index 5fe96d6bec53b..bea73ab92f2e3 100644
--- a/mlir/test/Dialect/Tosa/ops.mlir
+++ b/mlir/test/Dialect/Tosa/ops.mlir
@@ -558,7 +558,7 @@ func.func @test_reduce_min(%arg0: tensor<13x21x3xf32>) -> tensor<21x3xf32> {
// -----
// CHECK-LABEL: reduce_product
func.func @test_reduce_product(%arg0: tensor<13x21x3xf32>) -> tensor<21x3xf32> {
- %0 = tosa.reduce_prod %arg0 {axis = 0 : i32} : (tensor<13x21x3xf32>) -> tensor<1x21x3xf32>
+ %0 = tosa.reduce_product %arg0 {axis = 0 : i32} : (tensor<13x21x3xf32>) -> tensor<1x21x3xf32>
%2 = tosa.const_shape {value = dense<[21, 3]> : tensor<2xindex>} : () -> !tosa.shape<2>
%1 = tosa.reshape %0, %2 : (tensor<1x21x3xf32>, !tosa.shape<2>) -> tensor<21x3xf32>
return %1 : tensor<21x3xf32>
diff --git a/mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir b/mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir
index ad1871a3a2730..b87e9a78bf144 100644
--- a/mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir
+++ b/mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir
@@ -417,8 +417,8 @@ func.func @test_reduce_float(%arg0 : tensor<2x3x?x?xf32>) -> () {
// CHECK: tosa.reduce_min %arg0 {axis = 3 : i32} : (tensor<2x3x?x?xf32>) -> tensor<2x3x?x1xf32>
%5 = tosa.reduce_min %arg0 {axis = 3 : i32} : (tensor<2x3x?x?xf32>) -> tensor<?x?x?x?xf32>
- // CHECK: tosa.reduce_prod %arg0 {axis = 3 : i32} : (tensor<2x3x?x?xf32>) -> tensor<2x3x?x1xf32>
- %6 = tosa.reduce_prod %arg0 {axis = 3 : i32} : (tensor<2x3x?x?xf32>) -> tensor<?x?x?x?xf32>
+ // CHECK: tosa.reduce_product %arg0 {axis = 3 : i32} : (tensor<2x3x?x?xf32>) -> tensor<2x3x?x1xf32>
+ %6 = tosa.reduce_product %arg0 {axis = 3 : i32} : (tensor<2x3x?x?xf32>) -> tensor<?x?x?x?xf32>
return
}
More information about the Mlir-commits
mailing list