Skip to content

Commit 1f5b0da

Browse files
committed
Also handle truncf
1 parent 556026d commit 1f5b0da

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

mlir/include/mlir/Dialect/Arith/IR/ArithOps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1244,7 +1244,7 @@ def Arith_TruncIOp : Arith_IToICastOp<"trunci"> {
12441244

12451245
def Arith_TruncFOp :
12461246
Arith_Op<"truncf",
1247-
[Pure, SameOperandsAndResultShape,
1247+
[Pure, SameOperandsAndResultShape, SameInputOutputTensorDims,
12481248
DeclareOpInterfaceMethods<ArithRoundingModeInterface>,
12491249
DeclareOpInterfaceMethods<CastOpInterface>]>,
12501250
Arguments<(ins FloatLike:$in,

mlir/test/Dialect/Arith/invalid.mlir

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,14 @@ func.func @truncf_fl_to_scalable(%arg0 : vector<4xf64>) {
751751

752752
// -----
753753

754+
func.func @truncf_tensor_dim(%arg0 : tensor<4xf64>) {
755+
// expected-error@+1 {{'arith.truncf' op failed to verify that input and output have the same tensor dimensions}}
756+
%0 = arith.truncf %arg0 : tensor<4xf64> to tensor<?xf32>
757+
return
758+
}
759+
760+
// -----
761+
754762
func.func @extui_fl_to_scalable(%arg0 : vector<4xi32>) {
755763
// expected-error@+1 {{'arith.extui' op requires the same shape for all operands and results}}
756764
%0 = arith.extui %arg0 : vector<4xi32> to vector<[4]xi64>

0 commit comments

Comments
 (0)