Skip to content

Commit ab22c35

Browse files
committed
[AutoBump] Merge with fixes of 93ffe17 (Jun 15)
2 parents 5006bfc + 93ffe17 commit ab22c35

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2483,7 +2483,10 @@ struct RFFT2dConverter final : public OpConversionPattern<RFFT2dOp> {
24832483
auto loc = rfft2d.getLoc();
24842484
auto input = operands.getInput();
24852485
auto elementType =
2486-
cast<FloatType>(cast<ShapedType>(input.getType()).getElementType());
2486+
dyn_cast<FloatType>(cast<ShapedType>(input.getType()).getElementType());
2487+
if (!elementType)
2488+
return rewriter.notifyMatchFailure(rfft2d,
2489+
"only supports float element types");
24872490

24882491
// Compute the output type and set of dynamic sizes
24892492
llvm::SmallVector<Value> dynamicSizes;

mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-invalid.mlir

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,12 @@ func.func @clamp_on_large_int(%arg0: tensor<1xui64>) -> tensor<1xui64> {
3636
%0 = tosa.clamp %arg0 {min_int = -1 : i64, max_int = 5 : i64, min_fp = 1.0 : f32, max_fp = 5.0 : f32} : (tensor<1xui64>) -> tensor<1xui64>
3737
return %0 : tensor<1xui64>
3838
}
39+
40+
// -----
41+
42+
// CHECK-LABEL: @rfft2d_with_non_float_type
43+
func.func @rfft2d_with_non_float_type(%arg0 : tensor<1x1x1xi32>) -> (tensor<1x1x1xi32>, tensor<1x1x1xi32>) {
44+
// expected-error@+1 {{failed to legalize operation 'tosa.rfft2d'}}
45+
%real, %imag = tosa.rfft2d %arg0 : (tensor<1x1x1xi32>) -> (tensor<1x1x1xi32>, tensor<1x1x1xi32>)
46+
return %real, %imag : tensor<1x1x1xi32>, tensor<1x1x1xi32>
47+
}

0 commit comments

Comments
 (0)