[Mlir-commits] [mlir] [mlir][tosa] Extend narrowing pass (PR #170712)
Vitalii Shutov
llvmlistbot at llvm.org
Mon Dec 15 02:55:43 PST 2025
================
@@ -0,0 +1,160 @@
+// RUN: mlir-opt -split-input-file -verify-diagnostics -tosa-narrow-f64-to-f32="convert-function-boundaries=0" %s | FileCheck %s --allow-unused-prefixes --check-prefixes=COMMON,DEFAULT
+// RUN: mlir-opt -split-input-file -verify-diagnostics -tosa-narrow-f64-to-f32="convert-function-boundaries=1" %s | FileCheck %s --allow-unused-prefixes --check-prefixes=COMMON,FUNCBOUND
+
+// -----
+
+// CHECK-LABEL: test_f64_identity_chain
+func.func @test_f64_identity_chain(%arg0: tensor<1xf64>) -> tensor<1xf64> {
+ // DEFAULT: %[[CAST_IN:.*]] = tosa.cast %arg0 : (tensor<1xf64>) -> tensor<1xf32>
+ // DEFAULT: %[[ID1:.*]] = tosa.identity %[[CAST_IN]] : (tensor<1xf32>) -> tensor<1xf32>
+ // FUNCBOUND: %[[ID1:.*]] = tosa.identity %arg0 : (tensor<1xf32>) -> tensor<1xf32>
+ %0 = tosa.identity %arg0 : (tensor<1xf64>) -> tensor<1xf64>
+ // COMMON: %[[ID2:.*]] = tosa.identity %[[ID1]] : (tensor<1xf32>) -> tensor<1xf32>
+ %1 = tosa.identity %0 : (tensor<1xf64>) -> tensor<1xf64>
+ // DEFAULT: %[[CAST_OUT:.*]] = tosa.cast %[[ID2]] : (tensor<1xf32>) -> tensor<1xf64>
+ // DEFAULT: return %[[CAST_OUT]] : tensor<1xf64>
+ // FUNCBOUND: return %[[ID2]] : tensor<1xf32>
+ return %1 : tensor<1xf64>
+}
+
+// -----
+
+// CHECK-LABEL: test_f64_const
+func.func @test_f64_const() -> tensor<2xf64> {
----------------
Lallapallooza wrote:
added `test_f64_const_precision_loss` and `test_f64_const_precision_loss_small`
https://github.com/llvm/llvm-project/pull/170712
More information about the Mlir-commits
mailing list