[Mlir-commits] [mlir] [mlir][TOSA] restore unrealized casts when lowering rescale ops (PR #141096)
Thomas Preud'homme
llvmlistbot at llvm.org
Sat May 24 03:58:42 PDT 2025
================
@@ -1182,6 +1217,39 @@ func.func @rescale_i8_unsigned_output(%arg0 : tensor<2xi8>) -> () {
return
}
+// -----
+// CHECK: #[[$MAP0:.*]] = affine_map<(d0) -> (d0)>
+
+// CHECK-LABEL: @rescale_i48_unsigned_output_implicit
+// CHECK-SAME: (%[[ARG0:[0-9a-zA-Z_]*]]:
+func.func @rescale_i48_unsigned_output_implicit(%arg0 : tensor<2xi48>) -> () {
+ // CHECK: [[C19689:%.+]] = arith.constant 19689
+ // CHECK: [[C15:%.+]] = arith.constant 15
+ // CHECK: [[INIT:%.+]] = tensor.empty()
+ // CHECK: [[GENERIC:%.+]] = linalg.generic {indexing_maps = [#[[$MAP0]], #[[$MAP0]]], iterator_types = ["parallel"]} ins(%[[ARG0]] : tensor<2xi48>) outs([[INIT]] : tensor<2xi8>)
+ // CHECK: ^bb0([[IN:%.+]]: i48, [[UNUSED:%.+]]: i8):
+ // CHECK-NOT: builtin.unrealized_conversion_cast [[IN]] : i48 to i48
----------------
RoboTux wrote:
I think it would be stronger to use just CHECK-NOT builtin.unrealized_conversion_cast, because it could catch a case where an i48 to **ui48** is inserted (say if the logic to create the cast created a type based on the signedness instead of reusing the type of the rescale op like you do).
https://github.com/llvm/llvm-project/pull/141096
More information about the Mlir-commits
mailing list