Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2324,7 +2324,10 @@ struct RFFT2dConverter final : public OpRewritePattern<RFFT2dOp> {
auto loc = rfft2d.getLoc();
auto input = rfft2d.getInput();
auto elementType =
cast<FloatType>(cast<ShapedType>(input.getType()).getElementType());
dyn_cast<FloatType>(cast<ShapedType>(input.getType()).getElementType());
if (!elementType)
return rewriter.notifyMatchFailure(rfft2d,
"only supports float element types");

// Compute the output type and set of dynamic sizes
llvm::SmallVector<Value> dynamicSizes;
Expand Down
9 changes: 9 additions & 0 deletions mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-invalid.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,12 @@ func.func @unranked_add(%arg0 : tensor<10x10xf32> , %arg1 : tensor<10x10xf32>, %
%2 = tosa.reshape %0 {new_shape = array<i64: 10, 10>} : (tensor<*xf32>) -> tensor<10x10xf32>
return %2 : tensor<10x10xf32>
}

// -----

// CHECK-LABEL: @rfft2d_with_non_float_type
func.func @rfft2d_with_non_float_type(%arg0 : tensor<1x1x1xi32>) -> (tensor<1x1x1xi32>, tensor<1x1x1xi32>) {
// expected-error@+1 {{failed to legalize operation 'tosa.rfft2d'}}
%real, %imag = tosa.rfft2d %arg0 : (tensor<1x1x1xi32>) -> (tensor<1x1x1xi32>, tensor<1x1x1xi32>)
return %real, %imag : tensor<1x1x1xi32>, tensor<1x1x1xi32>
}