[Mlir-commits] [mlir] 9d191f1 - [mlir][tosa] Fix RFFT2D verifier for width=1 (#130279)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Mar 7 05:14:59 PST 2025
Author: Thomas Preud'homme
Date: 2025-03-07T13:14:55Z
New Revision: 9d191f11825875cb21363b1e1a9303e06fa1316c
URL: https://github.com/llvm/llvm-project/commit/9d191f11825875cb21363b1e1a9303e06fa1316c
DIFF: https://github.com/llvm/llvm-project/commit/9d191f11825875cb21363b1e1a9303e06fa1316c.diff
LOG: [mlir][tosa] Fix RFFT2D verifier for width=1 (#130279)
Current formula assumes width is a multiple of 2 but TOSA only requires
a power of 2, which 1 is.
Added:
Modified:
mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
mlir/test/Dialect/Tosa/ops.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index 086ffb753c333..5fdf5f4b5cb6a 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -888,7 +888,7 @@ LogicalResult tosa::RFFT2dOp::verify() {
// Output width dimension expected to be input_width / 2 + 1
const int64_t outputWidth = outputType.getDimSize(2);
if (!ShapedType::isDynamic(width) && !ShapedType::isDynamic(outputWidth) &&
- (outputWidth - 1) * 2 != width)
+ (outputWidth != (width / 2) + 1))
return emitOpError(
"expected output width to be equal to input_width / 2 + 1, got ")
<< outputWidth;
diff --git a/mlir/test/Dialect/Tosa/ops.mlir b/mlir/test/Dialect/Tosa/ops.mlir
index 2e60a3449f1c6..f9cd342ccf1d4 100644
--- a/mlir/test/Dialect/Tosa/ops.mlir
+++ b/mlir/test/Dialect/Tosa/ops.mlir
@@ -175,6 +175,13 @@ func.func @test_rfft2d(%arg0: tensor<13x8x16xf32>) -> (tensor<13x8x9xf32>, tenso
return %0, %1 : tensor<13x8x9xf32>, tensor<13x8x9xf32>
}
+// -----
+// CHECK-LABEL: rfft2d_width1
+func.func @test_rfft2d_width1(%arg0: tensor<1x1x1xf32>) -> (tensor<1x1x1xf32>, tensor<1x1x1xf32>) {
+ %0, %1 = tosa.rfft2d %arg0 : (tensor<1x1x1xf32>) -> (tensor<1x1x1xf32>, tensor<1x1x1xf32>)
+ return %0, %1 : tensor<1x1x1xf32>, tensor<1x1x1xf32>
+}
+
// -----
// CHECK-LABEL: rfft2d_with_local_bound
func.func @test_rfft2d_with_local_bound(%arg0: tensor<13x8x16xf32>) -> (tensor<13x8x9xf32>, tensor<13x8x9xf32>) {
More information about the Mlir-commits
mailing list