[Mlir-commits] [mlir] 7e2707a - [mlir][nfc] Add a negative test for --linalg-specialize-generic-ops (#127600)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Feb 18 05:57:52 PST 2025


Author: Andrzej WarzyƄski
Date: 2025-02-18T13:57:49Z
New Revision: 7e2707ad4673869fcca119a0ad8bd25aa38a5503

URL: https://github.com/llvm/llvm-project/commit/7e2707ad4673869fcca119a0ad8bd25aa38a5503
DIFF: https://github.com/llvm/llvm-project/commit/7e2707ad4673869fcca119a0ad8bd25aa38a5503.diff

LOG: [mlir][nfc] Add a negative test for --linalg-specialize-generic-ops (#127600)

Following on from #126737, adds a negative test that:
* prior to #126737, would incorrectly generated empty output,
* with the fix in-tree, simply outputs the input IR (i.e. the
  specialization "fails").

I've also made minor editorial changes.

Added: 
    

Modified: 
    mlir/test/Dialect/Linalg/specialize-generic-ops-fail.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/test/Dialect/Linalg/specialize-generic-ops-fail.mlir b/mlir/test/Dialect/Linalg/specialize-generic-ops-fail.mlir
index 542a7ed4a198b..357f2c11a7936 100644
--- a/mlir/test/Dialect/Linalg/specialize-generic-ops-fail.mlir
+++ b/mlir/test/Dialect/Linalg/specialize-generic-ops-fail.mlir
@@ -6,11 +6,26 @@
 // CHECK-LABEL: @transpose_and_broadcast
 // CHECK: linalg.generic
 func.func @transpose_and_broadcast(%arg0: tensor<7x8xf32>, %arg1: tensor<8x7x9xf32>) -> tensor<8x7x9xf32> {
-  %0 = linalg.generic
-        {indexing_maps = [#map, #map1], iterator_types = ["parallel", "parallel", "parallel"]}
-        ins(%arg0 : tensor<7x8xf32>) outs(%arg1 : tensor<8x7x9xf32>) {
-        ^bb0(%in: f32, %out: f32):
-           linalg.yield %in : f32
+  %res = linalg.generic {
+    indexing_maps = [#map, #map1], iterator_types = ["parallel", "parallel", "parallel"]
+  } ins(%arg0 : tensor<7x8xf32>) outs(%arg1 : tensor<8x7x9xf32>) {
+  ^bb0(%in: f32, %out: f32):
+    linalg.yield %in : f32
   } -> tensor<8x7x9xf32>
-  return %0 : tensor<8x7x9xf32>
+  return %res : tensor<8x7x9xf32>
+}
+
+// -----
+
+#map = affine_map<(d0) -> (d0)>
+// CHECK-LABEL: @neither_permutation_nor_broadcast
+// CHECK: linalg.generic
+func.func @neither_permutation_nor_broadcast(%init : tensor<8xi32>) -> tensor<8xi32> {
+  %res = linalg.generic {
+    indexing_maps = [#map], iterator_types = ["parallel"]
+  } outs(%init: tensor<8xi32>) {
+  ^bb0(%out: i32):
+    linalg.yield %out: i32
+  } -> tensor<8xi32>
+  return %res : tensor<8xi32>
 }


        


More information about the Mlir-commits mailing list