[Mlir-commits] [mlir] [mlir][tosa] Skip dense resource folding tests on big-endian platforms (PR #214479)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Aug 6 05:50:39 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Thibaut Goetghebuer-Planchon (Tessil)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/214479.diff
2 Files Affected:
- (added) mlir/test/Dialect/Tosa/tosa-layerwise-constant-fold-dense-resource.mlir (+141)
- (modified) mlir/test/Dialect/Tosa/tosa-layerwise-constant-fold.mlir (-138)
``````````diff
diff --git a/mlir/test/Dialect/Tosa/tosa-layerwise-constant-fold-dense-resource.mlir b/mlir/test/Dialect/Tosa/tosa-layerwise-constant-fold-dense-resource.mlir
new file mode 100644
index 0000000000000..86c8f64adbc6b
--- /dev/null
+++ b/mlir/test/Dialect/Tosa/tosa-layerwise-constant-fold-dense-resource.mlir
@@ -0,0 +1,141 @@
+// RUN: mlir-opt --split-input-file --tosa-layerwise-constant-fold %s | FileCheck %s
+
+// Skip big-endian platforms for dense resources
+// XFAIL: target={{(s390x|sparc.*)-.*}}
+// XFAIL: system-aix
+
+// CHECK-LABEL: @transpose_fold_dense_resource
+func.func @transpose_fold_dense_resource() -> tensor<2x2xf32> {
+ %0 = "tosa.const"() <{values = dense_resource<resource> : tensor<2x2xf32>}> : () -> tensor<2x2xf32>
+
+ // CHECK-NOT: tosa.transpose
+ %2 = tosa.transpose %0 { perms = array<i32: 1, 0> }: (tensor<2x2xf32>) -> tensor<2x2xf32>
+ return %2 : tensor<2x2xf32>
+}
+{-#
+ dialect_resources: {
+ builtin: {
+ resource: "0x040000003f800000400000004040000040800000"
+ }
+ }
+#-}
+
+// -----
+
+// CHECK-LABEL: @transpose_fold_dense_resource_f8e4m3fn
+func.func @transpose_fold_dense_resource_f8e4m3fn() -> tensor<2x2xf8E4M3FN> {
+ %0 = "tosa.const"() <{values = dense_resource<resource> : tensor<2x2xf8E4M3FN>}> : () -> tensor<2x2xf8E4M3FN>
+
+ // CHECK: %[[CST:.+]] = "tosa.const"() <{
+ // CHECK-SAME{LITERAL}: values = dense<[[1.000000e+00, 3.000000e+00], [2.000000e+00, 4.000000e+00]]> : tensor<2x2xf8E4M3FN>
+ %1 = tosa.transpose %0 { perms = array<i32: 1, 0> }: (tensor<2x2xf8E4M3FN>) -> tensor<2x2xf8E4M3FN>
+ // CHECK: return %[[CST]]
+ return %1 : tensor<2x2xf8E4M3FN>
+}
+{-#
+ dialect_resources: {
+ builtin: {
+ resource: "0x0100000038404448"
+ }
+ }
+#-}
+
+// -----
+
+// 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>
+ %1 = tosa.transpose %0 { perms = array<i32: 1, 0> }: (tensor<2x2xf8E5M2>) -> tensor<2x2xf8E5M2>
+ // CHECK: return %[[CST]]
+ return %1 : tensor<2x2xf8E5M2>
+}
+{-#
+ dialect_resources: {
+ builtin: {
+ resource: "0x010000003c404244"
+ }
+ }
+#-}
+
+// -----
+
+// CHECK-LABEL: @transpose_fold_dense_resource_f4e2m1fn
+func.func @transpose_fold_dense_resource_f4e2m1fn() -> tensor<2x2xf4E2M1FN> {
+ %0 = "tosa.const"() <{values = dense_resource<resource> : tensor<2x2xf4E2M1FN>}> : () -> tensor<2x2xf4E2M1FN>
+
+ // CHECK: %[[CST:.+]] = "tosa.const"() <{
+ // CHECK-SAME{LITERAL}: values = dense<[[1.000000e+00, 3.000000e+00], [2.000000e+00, 4.000000e+00]]> : tensor<2x2xf4E2M1FN>
+ %1 = tosa.transpose %0 { perms = array<i32: 1, 0> }: (tensor<2x2xf4E2M1FN>) -> tensor<2x2xf4E2M1FN>
+ // CHECK: return %[[CST]]
+ return %1 : tensor<2x2xf4E2M1FN>
+}
+{-#
+ dialect_resources: {
+ builtin: {
+ resource: "0x0100000002040506"
+ }
+ }
+#-}
+
+// -----
+
+// CHECK-LABEL: @transpose_fold_dense_resource_f16
+func.func @transpose_fold_dense_resource_f16() -> tensor<2x2xf16> {
+ %0 = "tosa.const"() <{values = dense_resource<resource> : tensor<2x2xf16>}> : () -> tensor<2x2xf16>
+
+ // CHECK: %[[CST:.+]] = "tosa.const"() <{
+ // CHECK-SAME{LITERAL}: values = dense<[[1.000000e+00, 3.000000e+00], [2.000000e+00, 4.000000e+00]]> : tensor<2x2xf16>
+ %1 = tosa.transpose %0 { perms = array<i32: 1, 0> }: (tensor<2x2xf16>) -> tensor<2x2xf16>
+ // CHECK: return %[[CST]]
+ return %1 : tensor<2x2xf16>
+}
+{-#
+ dialect_resources: {
+ builtin: {
+ resource: "0x02000000003c004000420044"
+ }
+ }
+#-}
+
+// -----
+
+// CHECK-LABEL: @transpose_fold_dense_resource_bf16
+func.func @transpose_fold_dense_resource_bf16() -> tensor<2x2xbf16> {
+ %0 = "tosa.const"() <{values = dense_resource<resource> : tensor<2x2xbf16>}> : () -> tensor<2x2xbf16>
+
+ // CHECK: %[[CST:.+]] = "tosa.const"() <{
+ // CHECK-SAME{LITERAL}: values = dense<[[1.000000e+00, 3.000000e+00], [2.000000e+00, 4.000000e+00]]> : tensor<2x2xbf16>
+ %1 = tosa.transpose %0 { perms = array<i32: 1, 0> }: (tensor<2x2xbf16>) -> tensor<2x2xbf16>
+ // CHECK: return %[[CST]]
+ return %1 : tensor<2x2xbf16>
+}
+{-#
+ dialect_resources: {
+ builtin: {
+ resource: "0x02000000803f004040408040"
+ }
+ }
+#-}
+
+// -----
+
+// CHECK-LABEL: @transpose_fold_dense_resource_f64
+func.func @transpose_fold_dense_resource_f64() -> tensor<2x2xf64> {
+ %0 = "tosa.const"() <{values = dense_resource<resource> : tensor<2x2xf64>}> : () -> tensor<2x2xf64>
+
+ // CHECK: %[[CST:.+]] = "tosa.const"() <{
+ // CHECK-SAME{LITERAL}: values = dense<[[1.000000e+00, 3.000000e+00], [2.000000e+00, 4.000000e+00]]> : tensor<2x2xf64>
+ %1 = tosa.transpose %0 { perms = array<i32: 1, 0> }: (tensor<2x2xf64>) -> tensor<2x2xf64>
+ // CHECK: return %[[CST]]
+ return %1 : tensor<2x2xf64>
+}
+{-#
+ dialect_resources: {
+ builtin: {
+ resource: "0x08000000000000000000f03f000000000000004000000000000008400000000000001040"
+ }
+ }
+#-}
diff --git a/mlir/test/Dialect/Tosa/tosa-layerwise-constant-fold.mlir b/mlir/test/Dialect/Tosa/tosa-layerwise-constant-fold.mlir
index 296c72bb366a4..9f745d4f57640 100644
--- a/mlir/test/Dialect/Tosa/tosa-layerwise-constant-fold.mlir
+++ b/mlir/test/Dialect/Tosa/tosa-layerwise-constant-fold.mlir
@@ -147,144 +147,6 @@ func.func @transpose_nofold_quantized_types() -> tensor<1x1x2x2x!quant.uniform<i
return %0: tensor<1x1x2x2x!quant.uniform<i8<-127:127>:f32:3, {1.000000e-01,1.000000e-01}>>
}
-// -----
-
-// CHECK-LABEL: @transpose_fold_dense_resource
-func.func @transpose_fold_dense_resource() -> tensor<2x2xf32> {
- %0 = "tosa.const"() <{values = dense_resource<resource> : tensor<2x2xf32>}> : () -> tensor<2x2xf32>
-
- // CHECK-NOT: tosa.transpose
- %2 = tosa.transpose %0 { perms = array<i32: 1, 0> }: (tensor<2x2xf32>) -> tensor<2x2xf32>
- return %2 : tensor<2x2xf32>
-}
-{-#
- dialect_resources: {
- builtin: {
- resource: "0x040000003f800000400000004040000040800000"
- }
- }
-#-}
-
-// -----
-
-// CHECK-LABEL: @transpose_fold_dense_resource_f8e4m3fn
-func.func @transpose_fold_dense_resource_f8e4m3fn() -> tensor<2x2xf8E4M3FN> {
- %0 = "tosa.const"() <{values = dense_resource<resource> : tensor<2x2xf8E4M3FN>}> : () -> tensor<2x2xf8E4M3FN>
-
- // CHECK: %[[CST:.+]] = "tosa.const"() <{
- // CHECK-SAME{LITERAL}: values = dense<[[1.000000e+00, 3.000000e+00], [2.000000e+00, 4.000000e+00]]> : tensor<2x2xf8E4M3FN>
- %1 = tosa.transpose %0 { perms = array<i32: 1, 0> }: (tensor<2x2xf8E4M3FN>) -> tensor<2x2xf8E4M3FN>
- // CHECK: return %[[CST]]
- return %1 : tensor<2x2xf8E4M3FN>
-}
-{-#
- dialect_resources: {
- builtin: {
- resource: "0x0100000038404448"
- }
- }
-#-}
-
-// -----
-
-// 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>
- %1 = tosa.transpose %0 { perms = array<i32: 1, 0> }: (tensor<2x2xf8E5M2>) -> tensor<2x2xf8E5M2>
- // CHECK: return %[[CST]]
- return %1 : tensor<2x2xf8E5M2>
-}
-{-#
- dialect_resources: {
- builtin: {
- resource: "0x010000003c404244"
- }
- }
-#-}
-
-// -----
-
-// CHECK-LABEL: @transpose_fold_dense_resource_f4e2m1fn
-func.func @transpose_fold_dense_resource_f4e2m1fn() -> tensor<2x2xf4E2M1FN> {
- %0 = "tosa.const"() <{values = dense_resource<resource> : tensor<2x2xf4E2M1FN>}> : () -> tensor<2x2xf4E2M1FN>
-
- // CHECK: %[[CST:.+]] = "tosa.const"() <{
- // CHECK-SAME{LITERAL}: values = dense<[[1.000000e+00, 3.000000e+00], [2.000000e+00, 4.000000e+00]]> : tensor<2x2xf4E2M1FN>
- %1 = tosa.transpose %0 { perms = array<i32: 1, 0> }: (tensor<2x2xf4E2M1FN>) -> tensor<2x2xf4E2M1FN>
- // CHECK: return %[[CST]]
- return %1 : tensor<2x2xf4E2M1FN>
-}
-{-#
- dialect_resources: {
- builtin: {
- resource: "0x0100000002040506"
- }
- }
-#-}
-
-// -----
-
-// CHECK-LABEL: @transpose_fold_dense_resource_f16
-func.func @transpose_fold_dense_resource_f16() -> tensor<2x2xf16> {
- %0 = "tosa.const"() <{values = dense_resource<resource> : tensor<2x2xf16>}> : () -> tensor<2x2xf16>
-
- // CHECK: %[[CST:.+]] = "tosa.const"() <{
- // CHECK-SAME{LITERAL}: values = dense<[[1.000000e+00, 3.000000e+00], [2.000000e+00, 4.000000e+00]]> : tensor<2x2xf16>
- %1 = tosa.transpose %0 { perms = array<i32: 1, 0> }: (tensor<2x2xf16>) -> tensor<2x2xf16>
- // CHECK: return %[[CST]]
- return %1 : tensor<2x2xf16>
-}
-{-#
- dialect_resources: {
- builtin: {
- resource: "0x02000000003c004000420044"
- }
- }
-#-}
-
-// -----
-
-// CHECK-LABEL: @transpose_fold_dense_resource_bf16
-func.func @transpose_fold_dense_resource_bf16() -> tensor<2x2xbf16> {
- %0 = "tosa.const"() <{values = dense_resource<resource> : tensor<2x2xbf16>}> : () -> tensor<2x2xbf16>
-
- // CHECK: %[[CST:.+]] = "tosa.const"() <{
- // CHECK-SAME{LITERAL}: values = dense<[[1.000000e+00, 3.000000e+00], [2.000000e+00, 4.000000e+00]]> : tensor<2x2xbf16>
- %1 = tosa.transpose %0 { perms = array<i32: 1, 0> }: (tensor<2x2xbf16>) -> tensor<2x2xbf16>
- // CHECK: return %[[CST]]
- return %1 : tensor<2x2xbf16>
-}
-{-#
- dialect_resources: {
- builtin: {
- resource: "0x02000000803f004040408040"
- }
- }
-#-}
-
-// -----
-
-// CHECK-LABEL: @transpose_fold_dense_resource_f64
-func.func @transpose_fold_dense_resource_f64() -> tensor<2x2xf64> {
- %0 = "tosa.const"() <{values = dense_resource<resource> : tensor<2x2xf64>}> : () -> tensor<2x2xf64>
-
- // CHECK: %[[CST:.+]] = "tosa.const"() <{
- // CHECK-SAME{LITERAL}: values = dense<[[1.000000e+00, 3.000000e+00], [2.000000e+00, 4.000000e+00]]> : tensor<2x2xf64>
- %1 = tosa.transpose %0 { perms = array<i32: 1, 0> }: (tensor<2x2xf64>) -> tensor<2x2xf64>
- // CHECK: return %[[CST]]
- return %1 : tensor<2x2xf64>
-}
-{-#
- dialect_resources: {
- builtin: {
- resource: "0x08000000000000000000f03f000000000000004000000000000008400000000000001040"
- }
- }
-#-}
-
// -----
func.func @reduce_sum_constant() -> tensor<1x3xi32> {
``````````
</details>
https://github.com/llvm/llvm-project/pull/214479
More information about the Mlir-commits
mailing list