[Mlir-commits] [mlir] [mlir][tosa] Support more float types in resource transpose folding (PR #213226)

Luke Hutton llvmlistbot at llvm.org
Fri Jul 31 09:27:22 PDT 2026


================
@@ -165,6 +165,86 @@ func.func @transpose_fold_dense_resource() -> tensor<2x2xf32> {
   }
 #-}
 
+// -----
+
+// CHECK-LABEL: @transpose_fold_dense_resource_f8e5m2
+func.func @transpose_fold_dense_resource_f8e5m2() -> tensor<2x2xf8E5M2> {
+  %0 = "tosa.const"() <{values = dense_resource<resource> : tensor<2x2xf8E5M2>}> : () -> tensor<2x2xf8E5M2>
+
+  //               CHECK: %[[CST:.+]] = "tosa.const"() <{
+  // CHECK-SAME{LITERAL}: values = dense<[[1.000000e+00, 3.000000e+00], [2.000000e+00, 4.000000e+00]]> : tensor<2x2xf8E5M2>
----------------
lhutton1 wrote:

Materializing a DenseElementsAttr from a DenseResourceAttr in the folding is interesting behaviour and I hadn't realised it when support for DenseResourceAttrs was first added. To make things worse we don't appear to have a constraint on the size of the DenseResourceAttr to pull in and fold. 

It's not worth blocking this PR on it since the issue already existed, but something I wanted to highlight for further investigation.

https://github.com/llvm/llvm-project/pull/213226


More information about the Mlir-commits mailing list